if ((!(PD->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_atomic))
|| /* temporary */ true)
return 0;
+ llvm::Constant * HelperFn = 0;
if (forSetter) {
if (hasTrivialSetExpr(PID))
return 0;
+ assert(PID->getSetterCXXAssignment() && "SetterCXXAssignment - null");
+ if ((HelperFn = CGM.getAtomicSetterHelperFnMap(Ty)))
+ return HelperFn;
}
- else
+ else {
if (hasTrivialGetExpr(PID))
return 0;
- llvm::Constant * HelperFn = CGM.getAtomicHelperFnMap(Ty);
- if (HelperFn)
- return HelperFn;
+ assert(PID->getGetterCXXConstructor() && "getGetterCXXConstructor - null");
+ if ((HelperFn = CGM.getAtomicGetterHelperFnMap(Ty)))
+ return HelperFn;
+ }
- assert(PID->getSetterCXXAssignment() && "SetterCXXAssignment - null");
ASTContext &C = getContext();
IdentifierInfo *II
VK_LValue, OK_Ordinary, SourceLocation());
Expr *Args[2] = { DST, SRC };
- CallExpr *CalleeExp = cast<CallExpr>(PID->getSetterCXXAssignment());
+ CallExpr *CalleeExp = forSetter ? cast<CallExpr>(PID->getSetterCXXAssignment())
+ : cast<CallExpr>(PID->getGetterCXXConstructor());
CXXOperatorCallExpr *TheCall =
new (C) CXXOperatorCallExpr(C, OO_Equal, CalleeExp->getCallee(),
Args, 2, DestTy->getPointeeType(),
FinishFunction();
HelperFn = llvm::ConstantExpr::getBitCast(Fn, VoidPtrTy);
- CGM.setAtomicHelperFnMap(Ty, HelperFn);
+ if (forSetter)
+ CGM.setAtomicSetterHelperFnMap(Ty, HelperFn);
+ else
+ CGM.setAtomicGetterHelperFnMap(Ty, HelperFn);
return HelperFn;
}
llvm::StringMap<llvm::GlobalVariable*> ConstantStringMap;
llvm::DenseMap<const Decl*, llvm::Value*> StaticLocalDeclMap;
- llvm::DenseMap<QualType, llvm::Constant *> AtomicHelperFnMap;
+ llvm::DenseMap<QualType, llvm::Constant *> AtomicSetterHelperFnMap;
+ llvm::DenseMap<QualType, llvm::Constant *> AtomicGetterHelperFnMap;
/// CXXGlobalInits - Global variables with initializers that need to run
/// before main.
StaticLocalDeclMap[D] = GV;
}
- llvm::Constant *getAtomicHelperFnMap(QualType Ty) {
- return AtomicHelperFnMap[Ty];
+ llvm::Constant *getAtomicSetterHelperFnMap(QualType Ty) {
+ return AtomicSetterHelperFnMap[Ty];
}
- void setAtomicHelperFnMap(QualType Ty,
+ void setAtomicSetterHelperFnMap(QualType Ty,
llvm::Constant *Fn) {
- AtomicHelperFnMap[Ty] = Fn;
+ AtomicSetterHelperFnMap[Ty] = Fn;
+ }
+
+ llvm::Constant *getAtomicGetterHelperFnMap(QualType Ty) {
+ return AtomicGetterHelperFnMap[Ty];
+ }
+ void setAtomicGetterHelperFnMap(QualType Ty,
+ llvm::Constant *Fn) {
+ AtomicGetterHelperFnMap[Ty] = Fn;
}
CGDebugInfo *getModuleDebugInfo() { return DebugInfo; }