aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaObjCProperty.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-10-06 18:38:18 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-10-06 18:38:18 +0000
commit57e264e9f4ff0a72f3585a960cdf63437b76fa93 (patch)
tree3b1ce9a1319ede79cc801bedc4f04ed86de5be2e /lib/Sema/SemaObjCProperty.cpp
parentd51e43af0b3a6897b971f316c4de2035ec82d1f2 (diff)
objc++: For atomic properties of c++ class objec typet, appropriate
operator= is called. Issue a warning for non-trivial case until runtime support is provided. // rdar://6137845 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141302 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaObjCProperty.cpp')
-rw-r--r--lib/Sema/SemaObjCProperty.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp
index 880e9bfb2b..5a54f57580 100644
--- a/lib/Sema/SemaObjCProperty.cpp
+++ b/lib/Sema/SemaObjCProperty.cpp
@@ -16,6 +16,7 @@
#include "clang/Sema/Initialization.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/ExprObjC.h"
+#include "clang/AST/ExprCXX.h"
#include "llvm/ADT/DenseSet.h"
using namespace clang;
@@ -800,6 +801,20 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
VK_LValue, SourceLocation());
ExprResult Res = BuildBinOp(S, lhs->getLocEnd(),
BO_Assign, lhs, rhs);
+ if (property->getPropertyAttributes() &
+ ObjCPropertyDecl::OBJC_PR_atomic) {
+ Expr *callExpr = Res.takeAs<Expr>();
+ if (const CXXOperatorCallExpr *CXXCE =
+ dyn_cast_or_null<CXXOperatorCallExpr>(callExpr)) {
+ const CallExpr *CE = cast<CallExpr>(CXXCE);
+ if (const FunctionDecl *FuncDecl = CE->getDirectCallee()) {
+ if (!FuncDecl->isTrivial())
+ Diag(PropertyLoc,
+ diag::warn_atomic_property_nontrivial_assign_op)
+ << property->getType();
+ }
+ }
+ }
PIDecl->setSetterCXXAssignment(Res.takeAs<Expr>());
}
}