diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2011-04-06 16:05:26 +0000 | 
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2011-04-06 16:05:26 +0000 | 
| commit | 5de5313abe955284ee29777971cbc92e9280a6a9 (patch) | |
| tree | b6ec96baaa0432aa9e19225b7cb2eb92702abd7d /clang/lib/CodeGen | |
| parent | 87e3367d329ab91d1971f529dcacba7d2251eb23 (diff) | |
| download | bcm5719-llvm-5de5313abe955284ee29777971cbc92e9280a6a9.tar.gz bcm5719-llvm-5de5313abe955284ee29777971cbc92e9280a6a9.zip  | |
Refine rules for atomic property api to
pass a previously failing clang test.
// rdar://8808439
llvm-svn: 129004
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGObjC.cpp | 19 | 
1 files changed, 17 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index fed19b4267a..cfe566e6f0c 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -293,7 +293,10 @@ void CodeGenFunction::GenerateObjCGetter(ObjCImplementationDecl *IMP,          GenerateObjCGetterBody(Ivar, IsAtomic, IsStrong);        }        else { -        if (PID->getGetterCXXConstructor()) { +        const CXXRecordDecl *classDecl = IVART->getAsCXXRecordDecl(); +         +        if (PID->getGetterCXXConstructor() && +            classDecl && !classDecl->hasTrivialConstructor()) {            ReturnStmt *Stmt =               new (getContext()) ReturnStmt(SourceLocation(),                                             PID->getGetterCXXConstructor(), @@ -379,6 +382,18 @@ void CodeGenFunction::GenerateObjCAtomicSetterBody(ObjCMethodDecl *OMD,             GetCopyStructFn, ReturnValueSlot(), Args);  } +static bool +IvarAssignHasTrvialAssignment(const ObjCPropertyImplDecl *PID, +                              QualType IvarT) { +  bool HasTrvialAssignment = true; +  if (PID->getSetterCXXAssignment()) { +    const CXXRecordDecl *classDecl = IvarT->getAsCXXRecordDecl(); +    HasTrvialAssignment =  +      (!classDecl || classDecl->hasTrivialCopyAssignment()); +  } +  return HasTrvialAssignment; +} +  /// GenerateObjCSetter - Generate an Objective-C property setter  /// function. The given Decl must be an ObjCImplementationDecl. @synthesize  /// is illegal within a category. @@ -448,7 +463,7 @@ void CodeGenFunction::GenerateObjCSetter(ObjCImplementationDecl *IMP,               ReturnValueSlot(), Args);    } else if (IsAtomic && hasAggregateLLVMType(IVART) &&               !IVART->isAnyComplexType() && -             !PID->getGetterCXXConstructor() && +             IvarAssignHasTrvialAssignment(PID, IVART) &&               ((Triple.getArch() == llvm::Triple::x86 &&                (getContext().getTypeSizeInChars(IVART)                 > CharUnits::fromQuantity(4))) ||  | 

