forked from OSchip/llvm-project
Do not invoke objc parser actions when a top level +/- is seen, unless objc
is enabled. llvm-svn: 39430
This commit is contained in:
parent
9eb2465aeb
commit
c24278d9a0
|
@ -318,13 +318,24 @@ Parser::DeclTy *Parser::ParseExternalDeclaration() {
|
||||||
// TODO: Invoke action for top-level asm.
|
// TODO: Invoke action for top-level asm.
|
||||||
return 0;
|
return 0;
|
||||||
case tok::at:
|
case tok::at:
|
||||||
|
// @ is not a legal token unless objc is enabled, no need to check.
|
||||||
ParseObjCAtDirectives();
|
ParseObjCAtDirectives();
|
||||||
return 0;
|
return 0;
|
||||||
case tok::minus:
|
case tok::minus:
|
||||||
ParseObjCInstanceMethodDeclaration();
|
if (getLang().ObjC1) {
|
||||||
|
ParseObjCInstanceMethodDeclaration();
|
||||||
|
} else {
|
||||||
|
Diag(Tok, diag::err_expected_external_declaration);
|
||||||
|
ConsumeToken();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
case tok::plus:
|
case tok::plus:
|
||||||
ParseObjCClassMethodDeclaration();
|
if (getLang().ObjC1) {
|
||||||
|
ParseObjCClassMethodDeclaration();
|
||||||
|
} else {
|
||||||
|
Diag(Tok, diag::err_expected_external_declaration);
|
||||||
|
ConsumeToken();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
case tok::kw_typedef:
|
case tok::kw_typedef:
|
||||||
// A function definition cannot start with a 'typedef' keyword.
|
// A function definition cannot start with a 'typedef' keyword.
|
||||||
|
|
|
@ -312,6 +312,8 @@ DIAG(err_parse_error, ERROR,
|
||||||
"parse error")
|
"parse error")
|
||||||
DIAG(err_expected_expression, ERROR,
|
DIAG(err_expected_expression, ERROR,
|
||||||
"expected expression")
|
"expected expression")
|
||||||
|
DIAG(err_expected_external_declaration, ERROR,
|
||||||
|
"expected external declaration")
|
||||||
DIAG(err_expected_ident, ERROR,
|
DIAG(err_expected_ident, ERROR,
|
||||||
"expected identifier")
|
"expected identifier")
|
||||||
DIAG(err_expected_ident_lparen, ERROR,
|
DIAG(err_expected_ident_lparen, ERROR,
|
||||||
|
|
Loading…
Reference in New Issue