diff options
| -rw-r--r-- | clang/include/clang/Basic/DiagnosticKinds.def | 2 | ||||
| -rw-r--r-- | clang/lib/Parse/ParseObjc.cpp | 5 | ||||
| -rw-r--r-- | clang/test/Parser/objc-property-syntax.m | 12 |
3 files changed, 19 insertions, 0 deletions
diff --git a/clang/include/clang/Basic/DiagnosticKinds.def b/clang/include/clang/Basic/DiagnosticKinds.def index fd5215e0cc9..018aa543e3e 100644 --- a/clang/include/clang/Basic/DiagnosticKinds.def +++ b/clang/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/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index f406eabf566..96673f088b3 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/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/clang/test/Parser/objc-property-syntax.m b/clang/test/Parser/objc-property-syntax.m new file mode 100644 index 00000000000..1a8fd119475 --- /dev/null +++ b/clang/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 + |

