Module: Improve diagnostic message when cxx modules are disabled and @import is used in Objective CXX.

rdar://problem/19399671

llvm-svn: 292508
This commit is contained in:
Manman Ren 2017-01-19 19:05:55 +00:00
parent 6c8f511f82
commit 4798302d87
3 changed files with 13 additions and 2 deletions

View File

@ -243,7 +243,10 @@ 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">;
"use of '@import' when modules are disabled">;
def err_atimport_cxx : Error<
"use of '@import' when C++ modules are disabled, consider using fmodules "
"and fcxx-modules">;
def err_invalid_reference_qualifier_application : Error<
"'%0' qualifier may not be applied to a reference">;

View File

@ -83,7 +83,10 @@ Parser::DeclGroupPtrTy Parser::ParseObjCAtDirectives() {
case tok::objc_import:
if (getLangOpts().Modules || getLangOpts().DebuggerSupport)
return ParseModuleImport(AtLoc);
Diag(AtLoc, diag::err_atimport);
if (getLangOpts().CPlusPlus)
Diag(AtLoc, diag::err_atimport_cxx);
else
Diag(AtLoc, diag::err_atimport);
SkipUntil(tok::semi);
return Actions.ConvertDeclToDeclGroup(nullptr);
default:

View File

@ -0,0 +1,5 @@
// RUN: not %clang -fmodules -fno-cxx-modules -fsyntax-only %s 2>&1 | FileCheck %s
// rdar://19399671
// CHECK: use of '@import' when C++ modules are disabled
@import Foundation;