diff options
57 files changed, 120 insertions, 117 deletions
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 68fa374913..25b6d79804 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -3168,7 +3168,7 @@ public: /// /// An import declaration imports the named module (or submodule). For example: /// \code -/// @import std.vector; +/// @__experimental_modules_import std.vector; /// \endcode /// /// Import declarations can also be implicitly generated from #include/#import diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h index b701effc83..fce79aa652 100644 --- a/include/clang/Basic/IdentifierTable.h +++ b/include/clang/Basic/IdentifierTable.h @@ -67,7 +67,7 @@ class IdentifierInfo { bool OutOfDate : 1; // True if there may be additional // information about this identifier // stored externally. - bool IsImport : 1; // True if this is the 'import' contextual + bool IsModulesImport : 1; // True if this is the 'import' contextual // keyword. // 1 bit left in 32-bit word. @@ -283,12 +283,14 @@ public: RecomputeNeedsHandleIdentifier(); } - /// \brief Determine whether this is the contextual keyword 'import'. - bool isImport() const { return IsImport; } + /// \brief Determine whether this is the contextual keyword + /// '__experimental_modules_import'. + bool isModulesImport() const { return IsModulesImport; } - /// \brief Set whether this identifier is the contextual keyword 'import'. - void setImport(bool I) { - IsImport = I; + /// \brief Set whether this identifier is the contextual keyword + /// '__experimental_modules_import'. + void setModulesImport(bool I) { + IsModulesImport = I; if (I) NeedsHandleIdentifier = true; else @@ -307,7 +309,7 @@ private: NeedsHandleIdentifier = (isPoisoned() | hasMacroDefinition() | isCPlusPlusOperatorKeyword() | isExtensionToken() | isCXX11CompatKeyword() || isOutOfDate() || - isImport()); + isModulesImport()); } }; @@ -458,9 +460,10 @@ public: // contents. II->Entry = &Entry; - // If this is the 'import' contextual keyword, mark it as such. - if (Name.equals("import")) - II->setImport(true); + // If this is the '__experimental_modules_import' contextual keyword, + // mark it as such. + if (Name.equals("__experimental_modules_import")) + II->setModulesImport(true); return *II; } @@ -496,7 +499,7 @@ public: // If this is the 'import' contextual keyword, mark it as such. if (Name.equals("import")) - II->setImport(true); + II->setModulesImport(true); } return *II; diff --git a/include/clang/Basic/TokenKinds.def b/include/clang/Basic/TokenKinds.def index 74072ba16a..bdceab48a0 100644 --- a/include/clang/Basic/TokenKinds.def +++ b/include/clang/Basic/TokenKinds.def @@ -549,7 +549,7 @@ OBJC2_AT_KEYWORD(required) OBJC2_AT_KEYWORD(optional) OBJC2_AT_KEYWORD(synthesize) OBJC2_AT_KEYWORD(dynamic) -OBJC2_AT_KEYWORD(import) +OBJC2_AT_KEYWORD(__experimental_modules_import) // TODO: What to do about context-sensitive keywords like: // bycopy/byref/in/inout/oneway/out? diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp index 32bdba1a0b..74e1c1bb9d 100644 --- a/lib/AST/DeclPrinter.cpp +++ b/lib/AST/DeclPrinter.cpp @@ -650,7 +650,7 @@ void DeclPrinter::VisitFileScopeAsmDecl(FileScopeAsmDecl *D) { } void DeclPrinter::VisitImportDecl(ImportDecl *D) { - Out << "@import " << D->getImportedModule()->getFullModuleName() + Out << "@__experimental_modules_import " << D->getImportedModule()->getFullModuleName() << ";\n"; } diff --git a/lib/Basic/IdentifierTable.cpp b/lib/Basic/IdentifierTable.cpp index 8bd76252b3..8945c2f47c 100644 --- a/lib/Basic/IdentifierTable.cpp +++ b/lib/Basic/IdentifierTable.cpp @@ -41,7 +41,7 @@ IdentifierInfo::IdentifierInfo() { ChangedAfterLoad = false; RevertedTokenID = false; OutOfDate = false; - IsImport = false; + IsModulesImport = false; FETokenInfo = 0; Entry = 0; } diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp index 0364e4279a..b08bcffd20 100644 --- a/lib/Lex/PPDirectives.cpp +++ b/lib/Lex/PPDirectives.cpp @@ -1401,7 +1401,7 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, Diag(HashLoc, diag::warn_auto_module_import) << IncludeKind << PathString << FixItHint::CreateReplacement(ReplaceRange, - "@import " + PathString.str().str() + ";"); + "@__experimental_modules_import " + PathString.str().str() + ";"); } // Load the module. diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index 96dfe36006..b6ea65de49 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -565,13 +565,13 @@ void Preprocessor::HandleIdentifier(Token &Identifier) { if (II.isExtensionToken() && !DisableMacroExpansion) Diag(Identifier, diag::ext_token_used); - // If this is the 'import' contextual keyword, note that the next token - // indicates a module name. + // If this is the '__experimental_modules_import' contextual keyword, note + // that the next token indicates a module name. // - // Note that we do not treat 'import' as a contextual keyword when we're - // in a caching lexer, because caching lexers only get used in contexts where - // import declarations are disallowed. - if (II.isImport() && !InMacroArgs && !DisableMacroExpansion && + // Note that we do not treat '__experimental_modules_import' as a contextual + // keyword when we're in a caching lexer, because caching lexers only get + // used in contexts where import declarations are disallowed. + if (II.isModulesImport() && !InMacroArgs && !DisableMacroExpansion && getLangOptions().Modules && CurLexerKind != CLK_CachingLexer) { ModuleImportLoc = Identifier.getLocation(); ModuleImportPath.clear(); diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index b135bba488..eea9a7e981 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -64,7 +64,7 @@ Parser::DeclGroupPtrTy Parser::ParseObjCAtDirectives() { case tok::objc_dynamic: SingleDecl = ParseObjCPropertyDynamic(AtLoc); break; - case tok::objc_import: + case tok::objc___experimental_modules_import: if (getLang().Modules) return ParseModuleImport(AtLoc); diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index 6927c50b8f..6a479bc60c 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -1609,7 +1609,7 @@ void Parser::ParseMicrosoftIfExistsExternalDeclaration() { } Parser::DeclGroupPtrTy Parser::ParseModuleImport(SourceLocation AtLoc) { - assert(Tok.isObjCAtKeyword(tok::objc_import) && + assert(Tok.isObjCAtKeyword(tok::objc___experimental_modules_import) && "Improper start to module import"); SourceLocation ImportLoc = ConsumeToken(); diff --git a/test/Index/complete-modules.m b/test/Index/complete-modules.m index a8737216e2..b82430db9d 100644 --- a/test/Index/complete-modules.m +++ b/test/Index/complete-modules.m @@ -1,14 +1,14 @@ // Note: the run lines follow their respective tests, since line/column // matter in this test. -@import LibA.Extensions; +@__experimental_modules_import LibA.Extensions; // RUN: rm -rf %t -// RUN: c-index-test -code-completion-at=%s:4:9 -fmodule-cache-path %t -fmodules -F %S/Inputs/Frameworks -I %S/Inputs/Headers %s | FileCheck -check-prefix=CHECK-TOP-LEVEL %s +// RUN: c-index-test -code-completion-at=%s:4:32 -fmodule-cache-path %t -fmodules -F %S/Inputs/Frameworks -I %S/Inputs/Headers %s | FileCheck -check-prefix=CHECK-TOP-LEVEL %s // CHECK-TOP-LEVEL: NotImplemented:{TypedText Framework} (50) // CHECK-TOP-LEVEL: NotImplemented:{TypedText LibA} (50) // CHECK-TOP-LEVEL: NotImplemented:{TypedText nested} (50) -// RUN: c-index-test -code-completion-at=%s:4:14 -fmodule-cache-path %t -fmodules -F %S/Inputs/Frameworks -I %S/Inputs/Headers %s | FileCheck -check-prefix=CHECK-LIBA %s +// RUN: c-index-test -code-completion-at=%s:4:37 -fmodule-cache-path %t -fmodules -F %S/Inputs/Frameworks -I %S/Inputs/Headers %s | FileCheck -check-prefix=CHECK-LIBA %s // CHECK-LIBA: NotImplemented:{TypedText Extensions} (50) diff --git a/test/Index/crash-recovery-modules.m b/test/Index/crash-recovery-modules.m index 8d93c1ae06..212923f94b 100644 --- a/test/Index/crash-recovery-modules.m +++ b/test/Index/crash-recovery-modules.m @@ -4,7 +4,7 @@ // Parse the file, such that building the module will cause Clang to crash. // RUN: not env CINDEXTEST_FAILONERROR=1 c-index-test -test-load-source all -fmodules -fmodule-cache-path %t -Xclang -fdisable-module-hash -I %S/Inputs/Headers -DCRASH %s 2> %t.err // RUN: FileCheck < %t.err -check-prefix=CHECK-CRASH %s -// CHECK-CRASH: crash-recovery-modules.m:16:9:{16:2-16:14}: fatal error: could not build module 'Crash' +// CHECK-CRASH: crash-recovery-modules.m:16:32:{16:2-16:37}: fatal error: could not build module 'Crash' // Parse the file again, without crashing, to make sure that // subsequent parses do the right thing. @@ -13,7 +13,7 @@ // REQUIRES: crash-recovery // REQUIRES: shell -@import Crash; +@__experimental_modules_import Crash; void test() { const char* error = getCrashString(); diff --git a/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h b/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h index 156c22604f..5142f56e60 100644 --- a/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h +++ b/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h @@ -1,3 +1,3 @@ -@import MutuallyRecursive2; +@__experimental_modules_import MutuallyRecursive2; diff --git a/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h b/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h index be3facd70e..8a3cc338c2 100644 --- a/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h +++ b/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h @@ -1,6 +1,6 @@ -@import MutuallyRecursive1; +@__experimental_modules_import MutuallyRecursive1; diff --git a/test/Modules/Inputs/category_bottom.h b/test/Modules/Inputs/category_bottom.h index ab4c01c314..b53d9c30d6 100644 --- a/test/Modules/Inputs/category_bottom.h +++ b/test/Modules/Inputs/category_bottom.h @@ -1,10 +1,10 @@ -@import category_left; +@__experimental_modules_import category_left; @interface Foo(Bottom) -(void)bottom; @end -@import category_right; +@__experimental_modules_import category_right; @interface LeftFoo(Bottom) -(void)bottom; diff --git a/test/Modules/Inputs/category_left.h b/test/Modules/Inputs/category_left.h index 05e2a1b96c..736fa43269 100644 --- a/test/Modules/Inputs/category_left.h +++ b/test/Modules/Inputs/category_left.h @@ -1,4 +1,4 @@ -@import category_top; +@__experimental_modules_import category_top; @interface Foo(Left) -(void)left; diff --git a/test/Modules/Inputs/category_other.h b/test/Modules/Inputs/category_other.h index 2c3f4794c2..1bb5a91cbd 100644 --- a/test/Modules/Inputs/category_other.h +++ b/test/Modules/Inputs/category_other.h @@ -1,4 +1,4 @@ -@import category_top; +@__experimental_modules_import category_top; @interface Foo(Other) -(void)other; diff --git a/test/Modules/Inputs/category_right.h b/test/Modules/Inputs/category_right.h index 48d4f6cd0a..d993b50db4 100644 --- a/test/Modules/Inputs/category_right.h +++ b/test/Modules/Inputs/category_right.h @@ -1,4 +1,4 @@ -@import category_top; +@__experimental_modules_import category_top; @interface Foo(Right1) -(void)right1; diff --git a/test/Modules/Inputs/diamond.h b/test/Modules/Inputs/diamond.h index 1990b45b5f..15b5290061 100644 --- a/test/Modules/Inputs/diamond.h +++ b/test/Modules/Inputs/diamond.h @@ -1 +1 @@ -@import diamond_bottom; +@__experimental_modules_import diamond_bottom; diff --git a/test/Modules/Inputs/diamond_bottom.h b/test/Modules/Inputs/diamond_bottom.h index 2a0a84e3d7..b45fa936d1 100644 --- a/test/Modules/Inputs/diamond_bottom.h +++ b/test/Modules/Inputs/diamond_bottom.h @@ -1,4 +1,4 @@ -@import diamond_left; -@import diamond_right; +@__experimental_modules_import diamond_left; +@__experimental_modules_import diamond_right; char bottom(char *x); diff --git a/test/Modules/Inputs/diamond_left.h b/test/Modules/Inputs/diamond_left.h index fce2e48882..cc406ab389 100644 --- a/test/Modules/Inputs/diamond_left.h +++ b/test/Modules/Inputs/diamond_left.h @@ -1,4 +1,4 @@ -@import diamond_top; +@__experimental_modules_import diamond_top; float left(float *); diff --git a/test/Modules/Inputs/diamond_right.h b/test/Modules/Inputs/diamond_right.h index fa408ea5ba..2ba1d77441 100644 --- a/test/Modules/Inputs/diamond_right.h +++ b/test/Modules/Inputs/diamond_right.h @@ -1,4 +1,4 @@ -@import diamond_top; +@__experimental_modules_import diamond_top; double right(double *); diff --git a/test/Modules/Inputs/namespaces-left.h b/test/Modules/Inputs/namespaces-left.h index 7e9002aea8..d253fed7c1 100644 --- a/test/Modules/Inputs/namespaces-left.h +++ b/test/Modules/Inputs/namespaces-left.h @@ -1,4 +1,4 @@ -@import namespaces_top; +@__experimental_modules_import namespaces_top; namespace N1 { } diff --git a/test/Modules/Inputs/namespaces-right.h b/test/Modules/Inputs/namespaces-right.h index b18aeb4478..7e7286e10b 100644 --- a/test/Modules/Inputs/namespaces-right.h +++ b/test/Modules/Inputs/namespaces-right.h @@ -1,4 +1,4 @@ -@import namespaces_top; +@__experimental_modules_import namespaces_top; namespace N2 { } diff --git a/test/Modules/Inputs/redecl-merge-bottom.h b/test/Modules/Inputs/redecl-merge-bottom.h index 4e52a67247..40a9404abf 100644 --- a/test/Modules/Inputs/redecl-merge-bottom.h +++ b/test/Modules/Inputs/redecl-merge-bottom.h @@ -1,11 +1,11 @@ -@import redecl_merge_left; +@__experimental_modules_import redecl_merge_left; @class C4; @class C4; @protocol P4; @protocol P4; @protocol P4; -@import redecl_merge_right; +@__experimental_modules_import redecl_merge_right; @class B; diff --git a/test/Modules/Inputs/redecl-merge-left-left.h b/test/Modules/Inputs/redecl-merge-left-left.h index 79c4d620be..5f48883bf1 100644 --- a/test/Modules/Inputs/redecl-merge-left-left.h +++ b/test/Modules/Inputs/redecl-merge-left-left.h @@ -1,4 +1,4 @@ -@import redecl_merge_left; +@__experimental_modules_import redecl_merge_left; @class C4; void accept_a_C4(C4*); diff --git a/test/Modules/Inputs/redecl-merge-left.h b/test/Modules/Inputs/redecl-merge-left.h index 798aa83b50..b3a7ba83c1 100644 --- a/test/Modules/Inputs/redecl-merge-left.h +++ b/test/Modules/Inputs/redecl-merge-left.h @@ -1,4 +1,4 @@ -@import redecl_merge_top; +@__experimental_modules_import redecl_merge_top; @class A; diff --git a/test/Modules/Inputs/redecl-merge-right.h b/test/Modules/Inputs/redecl-merge-right.h index 113ff22174..de7aa08cfb 100644 --- a/test/Modules/Inputs/redecl-merge-right.h +++ b/test/Modules/Inputs/redecl-merge-right.h @@ -1,4 +1,4 @@ -@import redecl_merge_top; +@__experimental_modules_import redecl_merge_top; @interface Super @end @@ -86,7 +86,7 @@ public: #endif int ONE; -@import redecl_merge_top.Explicit; +@__experimental_modules_import redecl_merge_top.Explicit; const int one = ONE; @interface ClassWithDef diff --git a/test/Modules/Inputs/wildcard-submodule-exports/C_one.h b/test/Modules/Inputs/wildcard-submodule-exports/C_one.h index e3b7593b80..fb1c7de845 100644 --- a/test/Modules/Inputs/wildcard-submodule-exports/C_one.h +++ b/test/Modules/Inputs/wildcard-submodule-exports/C_one.h @@ -1,4 +1,4 @@ -@import A.One; -@import B.One; +@__experimental_modules_import A.One; +@__experimental_modules_import B.One; long *C1; |