r204862 - Objective-C. Improve diagnostic error for '@import'
Fariborz Jahanian
fjahanian at apple.com
Wed Mar 26 15:02:44 PDT 2014
Author: fjahanian
Date: Wed Mar 26 17:02:43 2014
New Revision: 204862
URL: http://llvm.org/viewvc/llvm-project?rev=204862&view=rev
Log:
Objective-C. Improve diagnostic error for '@import'
when modules are disabled. // rdar://15505492
Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/lib/Parse/ParseObjc.cpp
cfe/trunk/test/Parser/check-objc2-syntax-1.m
Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=204862&r1=204861&r2=204862&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Wed Mar 26 17:02:43 2014
@@ -224,6 +224,8 @@ def err_expected_selector_for_method : E
def err_expected_property_name : Error<"expected property name">;
def err_unexpected_at : Error<"unexpected '@' in program">;
+def err_atimport : Error<
+"use of '@import' when modules are disabled, add -fmodules">;
def err_invalid_reference_qualifier_application : Error<
"'%0' qualifier may not be applied to a reference">;
Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=204862&r1=204861&r2=204862&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Wed Mar 26 17:02:43 2014
@@ -81,9 +81,9 @@ Parser::DeclGroupPtrTy Parser::ParseObjC
case tok::objc_import:
if (getLangOpts().Modules)
return ParseModuleImport(AtLoc);
-
- // Fall through
-
+ Diag(AtLoc, diag::err_atimport);
+ SkipUntil(tok::semi);
+ return Actions.ConvertDeclToDeclGroup(0);
default:
Diag(AtLoc, diag::err_unexpected_at);
SkipUntil(tok::semi);
Modified: cfe/trunk/test/Parser/check-objc2-syntax-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/check-objc2-syntax-1.m?rev=204862&r1=204861&r2=204862&view=diff
==============================================================================
--- cfe/trunk/test/Parser/check-objc2-syntax-1.m (original)
+++ cfe/trunk/test/Parser/check-objc2-syntax-1.m Wed Mar 26 17:02:43 2014
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-// expected-no-diagnostics
+
+// rdar://15505492
+ at import Foundation; // expected-error {{use of '@import' when modules are disabled, add -fmodules}}
@interface Subclass
+ (int)magicNumber;
More information about the cfe-commits
mailing list