]> granicus.if.org Git - clang/commitdiff
Diagnose that property name cannot be a bitfield
authorFariborz Jahanian <fjahanian@apple.com>
Sat, 17 Jan 2009 23:21:10 +0000 (23:21 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Sat, 17 Jan 2009 23:21:10 +0000 (23:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62432 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticKinds.def
lib/Parse/ParseObjc.cpp
test/Parser/objc-property-syntax.m [new file with mode: 0644]

index fd5215e0cc9815e00e908746d9bfec47896f1343..018aa543e3e0c6c0c22bbdfa196cdc3419500810 100644 (file)
@@ -446,6 +446,8 @@ DIAG(err_objc_expected_equal, ERROR,
      "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,
index f406eabf5669ffbb3b1708b190d5187f52fe7e65..96673f088b399ce5f816c86faff19cfcda49f462 100644 (file)
@@ -325,6 +325,11 @@ void Parser::ParseObjCInterfaceDeclList(DeclTy *interfaceDecl,
             << 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 =
diff --git a/test/Parser/objc-property-syntax.m b/test/Parser/objc-property-syntax.m
new file mode 100644 (file)
index 0000000..1a8fd11
--- /dev/null
@@ -0,0 +1,12 @@
+// RUN: clang -fsyntax-only -verify %s
+
+@interface MyClass {
+
+};
+@property unsigned char bufferedUTF8Bytes[4];  // expected-error {{property cannot have array or function type}}
+@property unsigned char bufferedUTFBytes:1;    // expected-error {{property name cannot be a bitfield}}
+@end
+
+@implementation MyClass
+@end
+