aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Basic/IdentifierTable.cpp1
-rw-r--r--lib/Lex/PPDirectives.cpp5
-rw-r--r--lib/Lex/Preprocessor.cpp18
-rw-r--r--lib/Parse/Parser.cpp6
4 files changed, 11 insertions, 19 deletions
diff --git a/lib/Basic/IdentifierTable.cpp b/lib/Basic/IdentifierTable.cpp
index 4368ff712c..3da15bde0e 100644
--- a/lib/Basic/IdentifierTable.cpp
+++ b/lib/Basic/IdentifierTable.cpp
@@ -40,6 +40,7 @@ IdentifierInfo::IdentifierInfo() {
ChangedAfterLoad = false;
RevertedTokenID = false;
OutOfDate = false;
+ IsImport = false;
FETokenInfo = 0;
Entry = 0;
}
diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp
index 04d92b8a29..138e7d9879 100644
--- a/lib/Lex/PPDirectives.cpp
+++ b/lib/Lex/PPDirectives.cpp
@@ -1378,15 +1378,16 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc,
bool BuildingImportedModule
= Path[0].first->getName() == getLangOptions().CurrentModule;
- if (!BuildingImportedModule) {
+ if (!BuildingImportedModule && getLangOptions().ObjC2) {
// If we're not building the imported module, warn that we're going
// to automatically turn this inclusion directive into a module import.
+ // We only do this in Objective-C, where we have a module-import syntax.
CharSourceRange ReplaceRange(SourceRange(HashLoc, CharEnd),
/*IsTokenRange=*/false);
Diag(HashLoc, diag::warn_auto_module_import)
<< IncludeKind << PathString
<< FixItHint::CreateReplacement(ReplaceRange,
- "__import_module__ " + PathString.str().str() + ";");
+ "@import " + PathString.str().str() + ";");
}
// Load the module.
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index 8722be93d3..046b0dfb01 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -548,11 +548,9 @@ void Preprocessor::HandleIdentifier(Token &Identifier) {
if (II.isExtensionToken() && !DisableMacroExpansion)
Diag(Identifier, diag::ext_token_used);
- // If this is the '__import_module__' or 'import' keyword, note that the next
- // token indicates a module name.
- if ((II.getTokenID() == tok::kw___import_module__ ||
- II.getObjCKeywordID() == tok::objc_import) &&
- !InMacroArgs && !DisableMacroExpansion) {
+ // If this is the 'import' contextual keyword, note that the next token
+ // indicates a module name.
+ if (II.isImport() && !InMacroArgs && !DisableMacroExpansion) {
ModuleImportLoc = Identifier.getLocation();
ModuleImportPath.clear();
ModuleImportExpectsIdentifier = true;
@@ -560,7 +558,7 @@ void Preprocessor::HandleIdentifier(Token &Identifier) {
}
}
-/// \brief Lex a token following the __import_module__ or 'import' keyword.
+/// \brief Lex a token following the 'import' contextual keyword.
///
void Preprocessor::LexAfterModuleImport(Token &Result) {
// Figure out what kind of lexer we actually have.
@@ -578,14 +576,10 @@ void Preprocessor::LexAfterModuleImport(Token &Result) {
// The token sequence
//
- // __import_module__ identifier (. identifier)*
- //
- // or
- //
// import identifier (. identifier)*
//
- // indicates a module import directive. We already saw the __import_module__
- // or 'import' keyword, so now we're looking for the identifiers.
+ // indicates a module import directive. We already saw the 'import'
+ // contextual keyword, so now we're looking for the identifiers.
if (ModuleImportExpectsIdentifier && Result.getKind() == tok::identifier) {
// We expected to see an identifier here, and we did; continue handling
// identifiers.
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index b96ff388db..d14b9adce2 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -666,9 +666,6 @@ Parser::ParseExternalDeclaration(ParsedAttributesWithRange &attrs,
case tok::kw___if_not_exists:
ParseMicrosoftIfExistsExternalDeclaration();
return DeclGroupPtrTy();
-
- case tok::kw___import_module__:
- return ParseModuleImport(SourceLocation());
default:
dont_know:
@@ -1570,8 +1567,7 @@ void Parser::ParseMicrosoftIfExistsExternalDeclaration() {
}
Parser::DeclGroupPtrTy Parser::ParseModuleImport(SourceLocation AtLoc) {
- assert((Tok.is(tok::kw___import_module__) ||
- Tok.isObjCAtKeyword(tok::objc_import)) &&
+ assert(Tok.isObjCAtKeyword(tok::objc_import) &&
"Improper start to module import");
SourceLocation ImportLoc = ConsumeToken();