aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-01-17 23:21:10 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-01-17 23:21:10 +0000
commit573acde1db5cb3e216e3d63fee173230834093d8 (patch)
tree6575af9ffa578512d44640c4248b743570dce442
parent9bae5e7af04e44b4d333a2c7ba22608d0594ff9f (diff)
Diagnose that property name cannot be a bitfield
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62432 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Basic/DiagnosticKinds.def2
-rw-r--r--lib/Parse/ParseObjc.cpp5
-rw-r--r--test/Parser/objc-property-syntax.m12
3 files changed, 19 insertions, 0 deletions
diff --git a/include/clang/Basic/DiagnosticKinds.def b/include/clang/Basic/DiagnosticKinds.def
index fd5215e0cc..018aa543e3 100644
--- a/include/clang/Basic/DiagnosticKinds.def
+++ b/include/clang/Basic/DiagnosticKinds.def
@@ -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,
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index f406eabf56..96673f088b 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -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
index 0000000000..1a8fd11947
--- /dev/null
+++ b/test/Parser/objc-property-syntax.m
@@ -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
+