зеркало из https://github.com/microsoft/clang-1.git
objc++: more atomic property api code for
c++ object properties. wip. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147750 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
2215eef02c
Коммит
b08cfb3c59
|
@ -2549,18 +2549,22 @@ CodeGenFunction::GenerateObjCAtomicCopyHelperFunction(
|
|||
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
|
||||
|
@ -2615,7 +2619,8 @@ CodeGenFunction::GenerateObjCAtomicCopyHelperFunction(
|
|||
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(),
|
||||
|
@ -2625,7 +2630,10 @@ CodeGenFunction::GenerateObjCAtomicCopyHelperFunction(
|
|||
|
||||
FinishFunction();
|
||||
HelperFn = llvm::ConstantExpr::getBitCast(Fn, VoidPtrTy);
|
||||
CGM.setAtomicHelperFnMap(Ty, HelperFn);
|
||||
if (forSetter)
|
||||
CGM.setAtomicSetterHelperFnMap(Ty, HelperFn);
|
||||
else
|
||||
CGM.setAtomicGetterHelperFnMap(Ty, HelperFn);
|
||||
return HelperFn;
|
||||
|
||||
}
|
||||
|
|
|
@ -277,7 +277,8 @@ class CodeGenModule : public CodeGenTypeCache {
|
|||
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.
|
||||
|
@ -400,12 +401,20 @@ public:
|
|||
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; }
|
||||
|
|
Загрузка…
Ссылка в новой задаче