[cfe-commits] r62432 - in /cfe/trunk: include/clang/Basic/DiagnosticKinds.def lib/Parse/ParseObjc.cpp test/Parser/objc-property-syntax.m
Fariborz Jahanian
fjahanian at apple.com
Sat Jan 17 15:21:10 PST 2009
Author: fjahanian
Date: Sat Jan 17 17:21:10 2009
New Revision: 62432
URL: http://llvm.org/viewvc/llvm-project?rev=62432&view=rev
Log:
Diagnose that property name cannot be a bitfield
Added:
cfe/trunk/test/Parser/objc-property-syntax.m
Modified:
cfe/trunk/include/clang/Basic/DiagnosticKinds.def
cfe/trunk/lib/Parse/ParseObjc.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=62432&r1=62431&r2=62432&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticKinds.def Sat Jan 17 17:21:10 2009
@@ -446,6 +446,8 @@
"setter/getter expects '=' followed by name")
DIAG(err_objc_property_requires_field_name, ERROR,
"property requires fields to be named")
+DIAG(err_objc_property_bitfield, ERROR,
+ "property name cannot be a bitfield")
DIAG(err_objc_expected_property_attr, ERROR,
"unknown property attribute %0")
DIAG(err_objc_propertoes_require_objc2, ERROR,
Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=62432&r1=62431&r2=62432&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Sat Jan 17 17:21:10 2009
@@ -325,6 +325,11 @@
<< FD.D.getSourceRange();
continue;
}
+ if (FD.BitfieldSize) {
+ Diag(AtLoc, diag::err_objc_property_bitfield)
+ << FD.D.getSourceRange();
+ continue;
+ }
// Install the property declarator into interfaceDecl.
IdentifierInfo *SelName =
Added: cfe/trunk/test/Parser/objc-property-syntax.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/objc-property-syntax.m?rev=62432&view=auto
==============================================================================
--- cfe/trunk/test/Parser/objc-property-syntax.m (added)
+++ cfe/trunk/test/Parser/objc-property-syntax.m Sat Jan 17 17:21:10 2009
@@ -0,0 +1,12 @@
+// RUN: clang -fsyntax-only -verify %s
+
+ at interface MyClass {
+
+};
+ at property unsigned char bufferedUTF8Bytes[4]; // expected-error {{property cannot have array or function type}}
+ at property unsigned char bufferedUTFBytes:1; // expected-error {{property name cannot be a bitfield}}
+ at end
+
+ at implementation MyClass
+ at end
+
More information about the cfe-commits
mailing list