[cfe-commits] r39430 - in /cfe/cfe/trunk: Parse/Parser.cpp include/clang/Basic/DiagnosticKinds.def
clattner at cs.uiuc.edu
clattner at cs.uiuc.edu
Wed Jul 11 09:44:18 PDT 2007
Author: clattner
Date: Wed Jul 11 11:44:17 2007
New Revision: 39430
URL: http://llvm.org/viewvc/llvm-project?rev=39430&view=rev
Log:
Do not invoke objc parser actions when a top level +/- is seen, unless objc
is enabled.
Modified:
cfe/cfe/trunk/Parse/Parser.cpp
cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def
Modified: cfe/cfe/trunk/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/Parser.cpp?rev=39430&r1=39429&r2=39430&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/Parser.cpp (original)
+++ cfe/cfe/trunk/Parse/Parser.cpp Wed Jul 11 11:44:17 2007
@@ -318,13 +318,24 @@
// TODO: Invoke action for top-level asm.
return 0;
case tok::at:
+ // @ is not a legal token unless objc is enabled, no need to check.
ParseObjCAtDirectives();
return 0;
case tok::minus:
- ParseObjCInstanceMethodDeclaration();
+ if (getLang().ObjC1) {
+ ParseObjCInstanceMethodDeclaration();
+ } else {
+ Diag(Tok, diag::err_expected_external_declaration);
+ ConsumeToken();
+ }
return 0;
case tok::plus:
- ParseObjCClassMethodDeclaration();
+ if (getLang().ObjC1) {
+ ParseObjCClassMethodDeclaration();
+ } else {
+ Diag(Tok, diag::err_expected_external_declaration);
+ ConsumeToken();
+ }
return 0;
case tok::kw_typedef:
// A function definition cannot start with a 'typedef' keyword.
Modified: cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=39430&r1=39429&r2=39430&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def Wed Jul 11 11:44:17 2007
@@ -312,6 +312,8 @@
"parse error")
DIAG(err_expected_expression, ERROR,
"expected expression")
+DIAG(err_expected_external_declaration, ERROR,
+ "expected external declaration")
DIAG(err_expected_ident, ERROR,
"expected identifier")
DIAG(err_expected_ident_lparen, ERROR,
More information about the cfe-commits
mailing list