[cfe-commits] r91546 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaDeclObjC.cpp test/SemaObjCXX/references.mm
Fariborz Jahanian
fjahanian at apple.com
Wed Dec 16 10:03:30 PST 2009
Author: fjahanian
Date: Wed Dec 16 12:03:30 2009
New Revision: 91546
URL: http://llvm.org/viewvc/llvm-project?rev=91546&view=rev
Log:
Diagnose property of reference type as unsupported
instead of crashing for now.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/test/SemaObjCXX/references.mm
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=91546&r1=91545&r2=91546&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Dec 16 12:03:30 2009
@@ -305,6 +305,8 @@
"property declared here">;
def error_synthesize_category_decl : Error<
"@synthesize not allowed in a category's implementation">;
+def error_reference_property : Error<
+ "property of reference type is not supported">;
def error_missing_property_interface : Error<
"property implementation in a category with no category declaration">;
def error_bad_category_property_decl : Error<
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=91546&r1=91545&r2=91546&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Wed Dec 16 12:03:30 2009
@@ -1950,6 +1950,10 @@
!(Attributes & ObjCDeclSpec::DQ_PR_retain) &&
!(Attributes & ObjCDeclSpec::DQ_PR_copy)));
QualType T = GetTypeForDeclarator(FD.D, S);
+ if (T->isReferenceType()) {
+ Diag(AtLoc, diag::error_reference_property);
+ return DeclPtrTy();
+ }
Decl *ClassDecl = ClassCategory.getAs<Decl>();
ObjCInterfaceDecl *CCPrimary = 0; // continuation class's primary class
// May modify Attributes.
Modified: cfe/trunk/test/SemaObjCXX/references.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/references.mm?rev=91546&r1=91545&r2=91546&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjCXX/references.mm (original)
+++ cfe/trunk/test/SemaObjCXX/references.mm Wed Dec 16 12:03:30 2009
@@ -1,7 +1,4 @@
-// FIXME: This crashes, disable it until fixed.
-// RN: %clang_cc1 -verify -emit-llvm -o - %s
-// RUN: false
-// XFAIL: *
+// RUN: %clang_cc1 -verify -emit-llvm -o - %s
// Test reference binding.
@@ -12,7 +9,7 @@
@interface A
@property (assign) T p0;
- at property (assign) T& p1;
+ at property (assign) T& p1; // expected-error {{property of reference type is not supported}}
@end
int f0(const T& t) {
@@ -24,6 +21,6 @@
}
int f2(A *a) {
- return f0(a.p1);
+ return f0(a.p1); // expected-error {{property 'p1' not found on object of type 'A *'}}
}
More information about the cfe-commits
mailing list