From: Fariborz Jahanian Date: Sat, 17 Jan 2009 23:21:10 +0000 (+0000) Subject: Diagnose that property name cannot be a bitfield X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=573acde1db5cb3e216e3d63fee173230834093d8;p=clang 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 --- 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 +