[cfe-commits] r141415 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaObjCProperty.cpp test/SemaObjCXX/property-reference.mm test/SemaObjCXX/property-synthesis-error.mm
Fariborz Jahanian
fjahanian at apple.com
Fri Oct 7 14:08:14 PDT 2011
Author: fjahanian
Date: Fri Oct 7 16:08:14 2011
New Revision: 141415
URL: http://llvm.org/viewvc/llvm-project?rev=141415&view=rev
Log:
objc++: some minor cleanup and a test case
for atomic setters which requires assignment operator.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
cfe/trunk/test/SemaObjCXX/property-reference.mm
cfe/trunk/test/SemaObjCXX/property-synthesis-error.mm
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=141415&r1=141414&r2=141415&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Oct 7 16:08:14 2011
@@ -505,7 +505,7 @@
"synthesized, or both be user defined,or the property must be nonatomic">;
def warn_atomic_property_nontrivial_assign_op : Warning<
"atomic property of type %0 synthesizing setter using non-trivial assignment"
- "operator">, InGroup<DiagGroup<"objc-property-atomic-setter-synthesis">>;
+ " operator">, InGroup<DiagGroup<"objc-property-atomic-setter-synthesis">>;
def warn_ownin_getter_rule : Warning<
"property's synthesized getter follows Cocoa naming"
" convention for returning 'owned' objects">,
Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=141415&r1=141414&r2=141415&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Fri Oct 7 16:08:14 2011
@@ -805,15 +805,12 @@
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()) {
+ dyn_cast_or_null<CXXOperatorCallExpr>(callExpr))
+ if (const FunctionDecl *FuncDecl = CXXCE->getDirectCallee())
if (!FuncDecl->isTrivial())
Diag(PropertyLoc,
diag::warn_atomic_property_nontrivial_assign_op)
<< property->getType();
- }
- }
}
PIDecl->setSetterCXXAssignment(Res.takeAs<Expr>());
}
Modified: cfe/trunk/test/SemaObjCXX/property-reference.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/property-reference.mm?rev=141415&r1=141414&r2=141415&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjCXX/property-reference.mm (original)
+++ cfe/trunk/test/SemaObjCXX/property-reference.mm Fri Oct 7 16:08:14 2011
@@ -29,7 +29,7 @@
@implementation TNSObject
@synthesize cppObjectNonAtomic;
- at synthesize cppObjectAtomic; // expected-warning{{atomic property of type 'CREF_TCPPObject' (aka 'const TCPPObject &') synthesizing setter using non-trivial assignmentoperator}}
+ at synthesize cppObjectAtomic; // expected-warning{{atomic property of type 'CREF_TCPPObject' (aka 'const TCPPObject &') synthesizing setter using non-trivial assignment operator}}
@dynamic cppObjectDynamic;
- (const TCPPObject&) cppObjectNonAtomic
Modified: cfe/trunk/test/SemaObjCXX/property-synthesis-error.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/property-synthesis-error.mm?rev=141415&r1=141414&r2=141415&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjCXX/property-synthesis-error.mm (original)
+++ cfe/trunk/test/SemaObjCXX/property-synthesis-error.mm Fri Oct 7 16:08:14 2011
@@ -43,19 +43,32 @@
void* fData;
};
+class Trivial
+{
+public:
+ Trivial(const Trivial& inObj);
+ Trivial();
+ ~Trivial();
+private:
+ void* fData;
+};
+
@interface MyDocument
{
@private
TCPPObject _cppObject;
TCPPObject _ncppObject;
+ Trivial _tcppObject;
}
@property (assign, readwrite) const TCPPObject& cppObject;
@property (assign, readwrite, nonatomic) const TCPPObject& ncppObject;
+ at property (assign, readwrite) const Trivial& tcppObject;
@end
@implementation MyDocument
- at synthesize cppObject = _cppObject; // expected-warning {{atomic property of type 'const TCPPObject &' synthesizing setter using non-trivial assignmentoperator}}
+ at synthesize cppObject = _cppObject; // expected-warning {{atomic property of type 'const TCPPObject &' synthesizing setter using non-trivial assignment operator}}
@synthesize ncppObject = _ncppObject;
+ at synthesize tcppObject = _tcppObject;
@end
More information about the cfe-commits
mailing list