diagnosing it as an error rather than looping infinitely. Also,
explicitly disallow @defs in Objective-C++. Fixes <rdar://problem/
9260136>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129521
91177308-0d34-0410-b5e6-
96231b3b80d8
def err_iboutletcollection_builtintype : Error<
"type argument of iboutletcollection attribute cannot be a builtin type">;
+def err_at_defs_cxx : Error<"@defs is not supported in Objective-C++">;
+def err_at_in_class : Error<"unexpected '@' in member specification">;
+
def err_expected_fn_body : Error<
"expected function body after function declarator">;
def err_expected_method_body : Error<"expected method body">;
def err_missing_dependent_template_keyword : Error<
"use 'template' keyword to treat '%0' as a dependent template name">;
-def war_missing_dependent_template_keyword : ExtWarn<\r
- "use 'template' keyword to treat '%0' as a dependent template name">;\r
+def war_missing_dependent_template_keyword : ExtWarn<
+ "use 'template' keyword to treat '%0' as a dependent template name">;
def warn_static_inline_explicit_inst_ignored : Warning<
"ignoring '%select{static|inline}0' keyword on explicit template "
void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
const ParsedTemplateInfo &TemplateInfo,
ParsingDeclRAIIObject *TemplateDiags) {
+ if (Tok.is(tok::at)) {
+ if (getLang().ObjC1 && NextToken().isObjCAtKeyword(tok::objc_defs))
+ Diag(Tok, diag::err_at_defs_cxx);
+ else
+ Diag(Tok, diag::err_at_in_class);
+
+ ConsumeToken();
+ SkipUntil(tok::r_brace);
+ return;
+ }
+
// Access declarations.
if (!TemplateInfo.Kind &&
(Tok.is(tok::identifier) || Tok.is(tok::coloncolon)) &&
--- /dev/null
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+@interface B {
+ int i;
+}
+@end
+
+struct Z {
+ @defs(B); // expected-error{{@defs is not supported in Objective-C++}}
+};
+
+struct Y { // expected-note{{to match this '{'}}
+ struct X { } // expected-error{{expected ';' after struct}}
+ @interface A // expected-error{{unexpected '@' in member specification}}
+} // expected-error{{expected '}'}} expected-error{{expected ';' after struct}}