From 32ad2ee2618745ce3da51c2ae066ed5f21157c07 Mon Sep 17 00:00:00 2001 From: Ted Kremenek <kremenek@apple.com> Date: Thu, 1 Mar 2012 22:07:04 +0000 Subject: [PATCH] Change @import to @__experimental_modules_import. We are not ready to commit to a particular syntax for modules, and don't have time to push it forward in the near future. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151841 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/Decl.h | 2 +- include/clang/Basic/IdentifierTable.h | 25 +++++++++++-------- include/clang/Basic/TokenKinds.def | 2 +- lib/AST/DeclPrinter.cpp | 2 +- lib/Basic/IdentifierTable.cpp | 2 +- lib/Lex/PPDirectives.cpp | 2 +- lib/Lex/Preprocessor.cpp | 12 ++++----- lib/Parse/ParseObjc.cpp | 2 +- lib/Parse/Parser.cpp | 2 +- test/Index/complete-modules.m | 6 ++--- test/Index/crash-recovery-modules.m | 4 +-- .../Headers/MutuallyRecursive1.h | 2 +- .../Headers/MutuallyRecursive2.h | 2 +- test/Modules/Inputs/category_bottom.h | 4 +-- test/Modules/Inputs/category_left.h | 2 +- test/Modules/Inputs/category_other.h | 2 +- test/Modules/Inputs/category_right.h | 2 +- test/Modules/Inputs/diamond.h | 2 +- test/Modules/Inputs/diamond_bottom.h | 4 +-- test/Modules/Inputs/diamond_left.h | 2 +- test/Modules/Inputs/diamond_right.h | 2 +- test/Modules/Inputs/namespaces-left.h | 2 +- test/Modules/Inputs/namespaces-right.h | 2 +- test/Modules/Inputs/redecl-merge-bottom.h | 4 +-- test/Modules/Inputs/redecl-merge-left-left.h | 2 +- test/Modules/Inputs/redecl-merge-left.h | 2 +- test/Modules/Inputs/redecl-merge-right.h | 4 +-- .../Inputs/wildcard-submodule-exports/C_one.h | 4 +-- .../Inputs/wildcard-submodule-exports/C_two.h | 4 +-- test/Modules/compiler_builtins.m | 4 +-- test/Modules/cstd.m | 8 +++--- test/Modules/cycles.c | 8 +++--- test/Modules/decldef.mm | 4 +-- test/Modules/diamond.c | 2 +- test/Modules/header-import.m | 2 +- test/Modules/inferred-submodules.m | 4 +-- test/Modules/irgen.c | 2 +- test/Modules/load_failure.c | 6 ++--- test/Modules/lookup.cpp | 4 +-- test/Modules/lookup.m | 4 +-- test/Modules/macros.c | 2 +- test/Modules/method_pool.m | 4 +-- test/Modules/module-private.cpp | 4 +-- test/Modules/namespaces.cpp | 4 +-- test/Modules/normal-module-map.cpp | 6 ++--- test/Modules/objc-categories.m | 4 +-- test/Modules/on-demand-build-warnings.m | 2 +- test/Modules/on-demand-build.m | 4 +-- test/Modules/on-demand-macros.m | 2 +- test/Modules/redecl-merge.m | 8 +++--- test/Modules/redeclarations.m | 4 +-- test/Modules/requires.m | 2 +- test/Modules/subframeworks.m | 6 ++--- test/Modules/submodules-preprocess.cpp | 10 ++++---- test/Modules/submodules.cpp | 10 ++++---- test/Modules/submodules.m | 2 +- test/Modules/wildcard-submodule-exports.cpp | 6 ++--- 57 files changed, 120 insertions(+), 117 deletions(-) diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 68fa374913d..25b6d798045 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 b701effc83e..fce79aa652c 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 74072ba16a2..bdceab48a07 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 32bdba1a0b2..74e1c1bb9df 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 8bd76252b30..8945c2f47ca 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 0364e4279a5..b08bcffd202 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 96dfe360069..b6ea65de499 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 b135bba488c..eea9a7e981e 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 6927c50b8f7..6a479bc60cb 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 a8737216e21..b82430db9db 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 8d93c1ae06d..212923f94be 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 156c22604f5..5142f56e601 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 be3facd70ec..8a3cc338c22 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 ab4c01c3149..b53d9c30d6f 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 05e2a1b96c5..736fa432690 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 2c3f4794c2a..1bb5a91cbd7 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 48d4f6cd0a8..d993b50db4b 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 1990b45b5f8..15b52900616 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 2a0a84e3d7b..b45fa936d1e 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 fce2e48882f..cc406ab3891 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 fa408ea5ba7..2ba1d774413 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 7e9002aea8c..d253fed7c1b 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 b18aeb44786..7e7286e10b2 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 4e52a672478..40a9404abf2 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 79c4d620bee..5f48883bf15 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 798aa83b503..b3a7ba83c1a 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 113ff221741..de7aa08cfb2 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 e3b7593b80c..fb1c7de845b 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; diff --git a/test/Modules/Inputs/wildcard-submodule-exports/C_two.h b/test/Modules/Inputs/wildcard-submodule-exports/C_two.h index b65dcf612eb..050a8f3e885 100644 --- a/test/Modules/Inputs/wildcard-submodule-exports/C_two.h +++ b/test/Modules/Inputs/wildcard-submodule-exports/C_two.h @@ -1,4 +1,4 @@ -@import A.Two; -@import B.Two; +@__experimental_modules_import A.Two; +@__experimental_modules_import B.Two; unsigned long *C2; diff --git a/test/Modules/compiler_builtins.m b/test/Modules/compiler_builtins.m index a4f1dc21328..de6f57b5f28 100644 --- a/test/Modules/compiler_builtins.m +++ b/test/Modules/compiler_builtins.m @@ -2,9 +2,9 @@ // RUN: %clang -fsyntax-only -fmodules -fmodule-cache-path %t -D__need_wint_t %s -Xclang -verify #ifdef __SSE__ -@import _Builtin_intrinsics.intel.sse; +@__experimental_modules_import _Builtin_intrinsics.intel.sse; #endif #ifdef __AVX2__ -@import _Builtin_intrinsics.intel.avx2; +@__experimental_modules_import _Builtin_intrinsics.intel.avx2; #endif diff --git a/test/Modules/cstd.m b/test/Modules/cstd.m index 85780f49f54..1752cd314bb 100644 --- a/test/Modules/cstd.m +++ b/test/Modules/cstd.m @@ -2,24 +2,24 @@ // RUN: %clang -fsyntax-only -isystem %S/Inputs/System/usr/include -fmodules -fmodule-cache-path %t -D__need_wint_t -Werror=implicit-function-declaration %s // Supplied by compiler, but referenced from the "/usr/include" module map. -@import cstd.float_constants; +@__experimental_modules_import cstd.float_constants; float getFltMax() { return FLT_MAX; } // Supplied by the "/usr/include" module map. -@import cstd.stdio; +@__experimental_modules_import cstd.stdio; void test_fprintf(FILE *file) { fprintf(file, "Hello, modules\n"); } // Supplied by compiler, which forwards to the the "/usr/include" version. -@import cstd.stdint; +@__experimental_modules_import cstd.stdint; my_awesome_nonstandard_integer_type value; // Supplied by the compiler; that version wins. -@import cstd.stdbool; +@__experimental_modules_import cstd.stdbool; #ifndef bool # error "bool was not defined!" diff --git a/test/Modules/cycles.c b/test/Modules/cycles.c index df2a0a785df..256f118cc02 100644 --- a/test/Modules/cycles.c +++ b/test/Modules/cycles.c @@ -1,12 +1,12 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -F %S/Inputs %s 2>&1 | FileCheck %s // FIXME: When we have a syntax for modules in C, use that. -@import MutuallyRecursive1; +@__experimental_modules_import MutuallyRecursive1; // FIXME: Lots of redundant diagnostics here, because the preprocessor // can't currently tell the parser not to try to load the module again. -// CHECK: MutuallyRecursive2.h:3:9: fatal error: cyclic dependency in module 'MutuallyRecursive1': MutuallyRecursive1 -> MutuallyRecursive2 -> MutuallyRecursive1 -// CHECK: MutuallyRecursive1.h:2:9: fatal error: could not build module 'MutuallyRecursive2' -// CHECK: cycles.c:4:9: fatal error: could not build module 'MutuallyRecursive1' +// CHECK: MutuallyRecursive2.h:3:32: fatal error: cyclic dependency in module 'MutuallyRecursive1': MutuallyRecursive1 -> MutuallyRecursive2 -> MutuallyRecursive1 +// CHECK: MutuallyRecursive1.h:2:32: fatal error: could not build module 'MutuallyRecursive2' +// CHECK: cycles.c:4:32: fatal error: could not build module 'MutuallyRecursive1' diff --git a/test/Modules/decldef.mm b/test/Modules/decldef.mm index c99fdea0d84..64a66d59d0e 100644 --- a/test/Modules/decldef.mm +++ b/test/Modules/decldef.mm @@ -10,10 +10,10 @@ // in other file: expected-note{{previous definition is here}} -@import decldef; +@__experimental_modules_import decldef; A *a1; // expected-error{{unknown type name 'A'}} B *b1; // expected-error{{unknown type name 'B'}} -@import decldef.Decl; +@__experimental_modules_import decldef.Decl; A *a2; B *b; diff --git a/test/Modules/diamond.c b/test/Modules/diamond.c index 1d8902101ee..076eec4bf26 100644 --- a/test/Modules/diamond.c +++ b/test/Modules/diamond.c @@ -3,7 +3,7 @@ // in diamond-bottom.h: expected-note{{passing argument to parameter 'x' here}} -@import diamond_bottom; +@__experimental_modules_import diamond_bottom; void test_diamond(int i, float f, double d, char c) { top(&i); diff --git a/test/Modules/header-import.m b/test/Modules/header-import.m index 960eecea221..5444854a62b 100644 --- a/test/Modules/header-import.m +++ b/test/Modules/header-import.m @@ -2,6 +2,6 @@ // RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -F %S/Inputs -I %S/Inputs -verify %s #import "point.h" -@import Module; +@__experimental_modules_import Module; #import "point.h" diff --git a/test/Modules/inferred-submodules.m b/test/Modules/inferred-submodules.m index aeb4aa467c2..bee1cec98e4 100644 --- a/test/Modules/inferred-submodules.m +++ b/test/Modules/inferred-submodules.m @@ -1,13 +1,13 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -x objective-c -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs %s -verify -@import Module.Sub; +@__experimental_modules_import Module.Sub; void test_Module_Sub() { int *ip = Module_Sub; } -@import Module.Buried.Treasure; +@__experimental_modules_import Module.Buried.Treasure; void dig() { unsigned *up = Buried_Treasure; diff --git a/test/Modules/irgen.c b/test/Modules/irgen.c index 8f4c299a7ef..4a080db5b2e 100644 --- a/test/Modules/irgen.c +++ b/test/Modules/irgen.c @@ -3,7 +3,7 @@ // RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s // FIXME: When we have a syntax for modules in C, use that. -@import irgen; +@__experimental_modules_import irgen; // CHECK: define void @triple_value void triple_value(int *px) { diff --git a/test/Modules/load_failure.c b/test/Modules/load_failure.c index bc0b4263159..3a963012b19 100644 --- a/test/Modules/load_failure.c +++ b/test/Modules/load_failure.c @@ -1,15 +1,15 @@ #ifdef NONEXISTENT -@import load_nonexistent; +@__experimental_modules_import load_nonexistent; #endif #ifdef FAILURE -@import load_failure; +@__experimental_modules_import load_failure; #endif // RUN: rm -rf %t // RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t -fdisable-module-hash -emit-module -fmodule-name=load_failure %S/Inputs/module.map // RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -fdisable-module-hash %s -DNONEXISTENT 2>&1 | FileCheck -check-prefix=CHECK-NONEXISTENT %s -// CHECK-NONEXISTENT: load_failure.c:2:9: fatal error: module 'load_nonexistent' not found +// CHECK-NONEXISTENT: load_failure.c:2:32: fatal error: module 'load_nonexistent' not found // RUN: not %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -fdisable-module-hash %s -DFAILURE 2> %t.out // RUN: FileCheck -check-prefix=CHECK-FAILURE %s < %t.out diff --git a/test/Modules/lookup.cpp b/test/Modules/lookup.cpp index fdbdfd7a5cf..98390355339 100644 --- a/test/Modules/lookup.cpp +++ b/test/Modules/lookup.cpp @@ -1,8 +1,8 @@ -#define import @import +#define import @__experimental_modules_import import lookup_left_cxx; #undef import -#define IMPORT(X) @import X +#define IMPORT(X) @__experimental_modules_import X IMPORT(lookup_right_cxx); void test(int i, float f) { diff --git a/test/Modules/lookup.m b/test/Modules/lookup.m index 7ca0c23a465..c82503f7903 100644 --- a/test/Modules/lookup.m +++ b/test/Modules/lookup.m @@ -1,8 +1,8 @@ // lookup_left.h: expected-note{{using}} // lookup_right.h: expected-note{{also found}} -@import lookup_left_objc; -@import lookup_right_objc; +@__experimental_modules_import lookup_left_objc; +@__experimental_modules_import lookup_right_objc; void test(id x) { [x method]; // expected-warning{{multiple methods named 'method' found}} diff --git a/test/Modules/macros.c b/test/Modules/macros.c index 35fde4a9a65..83e1c66a101 100644 --- a/test/Modules/macros.c +++ b/test/Modules/macros.c @@ -4,7 +4,7 @@ // RUN: %clang_cc1 -E -fmodules -x objective-c -fmodule-cache-path %t %s | FileCheck -check-prefix CHECK-PREPROCESSED %s // FIXME: When we have a syntax for modules in C, use that. -@import macros; +@__experimental_modules_import macros; #ifndef INTEGER # error INTEGER macro should be visible diff --git a/test/Modules/method_pool.m b/test/Modules/method_pool.m index 9574caa1528..25582caec3a 100644 --- a/test/Modules/method_pool.m +++ b/test/Modules/method_pool.m @@ -1,7 +1,7 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -fmodule-cache-path %t -fmodules -I %S/Inputs %s -verify -@import MethodPoolA; +@__experimental_modules_import MethodPoolA; // in other file: // expected-note{{using}} @@ -19,7 +19,7 @@ void testMethod2(id object) { [object method2:1]; } -@import MethodPoolB; +@__experimental_modules_import MethodPoolB; void testMethod1Again(id object) { [object method1]; diff --git a/test/Modules/module-private.cpp b/test/Modules/module-private.cpp index e972ce2891c..246dcaf80e2 100644 --- a/test/Modules/module-private.cpp +++ b/test/Modules/module-private.cpp @@ -4,8 +4,8 @@ // RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t %s -verify // FIXME: When we have a syntax for modules in C++, use that. -@import module_private_left; -@import module_private_right; +@__experimental_modules_import module_private_left; +@__experimental_modules_import module_private_right; void test() { int &ir = f0(1.0); // okay: f0() from 'right' is not visible diff --git a/test/Modules/namespaces.cpp b/test/Modules/namespaces.cpp index b60f75cff60..a51c65992eb 100644 --- a/test/Modules/namespaces.cpp +++ b/test/Modules/namespaces.cpp @@ -7,8 +7,8 @@ namespace N6 { namespace N8 { } -@import namespaces_left; -@import namespaces_right; +@__experimental_modules_import namespaces_left; +@__experimental_modules_import namespaces_right; void test() { int &ir1 = N1::f(1); diff --git a/test/Modules/normal-module-map.cpp b/test/Modules/normal-module-map.cpp index 2858dabae15..7cd448235d8 100644 --- a/test/Modules/normal-module-map.cpp +++ b/test/Modules/normal-module-map.cpp @@ -8,7 +8,7 @@ int getUmbrella() { return umbrella + umbrella_sub; } -@import Umbrella2; +@__experimental_modules_import Umbrella2; #include "a1.h" #include "b1.h" @@ -18,7 +18,7 @@ int test() { return a1 + b1 + nested2; } -@import nested_umbrella.a; +@__experimental_modules_import nested_umbrella.a; int testNestedUmbrellaA() { return nested_umbrella_a; @@ -28,7 +28,7 @@ int testNestedUmbrellaBFail() { return nested_umbrella_b; // expected-error{{use of undeclared identifier 'nested_umbrella_b'; did you mean 'nested_umbrella_a'?}} } -@import nested_umbrella.b; +@__experimental_modules_import nested_umbrella.b; int testNestedUmbrellaB() { return nested_umbrella_b; diff --git a/test/Modules/objc-categories.m b/test/Modules/objc-categories.m index a8f8fb3d049..340f279adf3 100644 --- a/test/Modules/objc-categories.m +++ b/test/Modules/objc-categories.m @@ -6,7 +6,7 @@ // RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -x objective-c -fmodule-name=category_other -emit-module %S/Inputs/module.map // RUN: %clang_cc1 -fmodules -fmodule-cache-path %t %s -verify -@import category_bottom; +@__experimental_modules_import category_bottom; @@ -33,7 +33,7 @@ void test(Foo *foo, LeftFoo *leftFoo) { // Load another module that also adds categories to Foo, verify that // we see those categories. -@import category_other; +@__experimental_modules_import category_other; void test_other(Foo *foo) { [foo other]; diff --git a/test/Modules/on-demand-build-warnings.m b/test/Modules/on-demand-build-warnings.m index 7116f01d381..24975c01b78 100644 --- a/test/Modules/on-demand-build-warnings.m +++ b/test/Modules/on-demand-build-warnings.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -fmodules -fno-objc-infer-related-result-type -Wmodule-build -fmodule-cache-path %t -F %S/Inputs -verify %s -@import Module; // expected-warning{{building module 'Module' from source}} +@__experimental_modules_import Module; // expected-warning{{building module 'Module' from source}} diff --git a/test/Modules/on-demand-build.m b/test/Modules/on-demand-build.m index a7521fe78fc..cf1ae99ce0c 100644 --- a/test/Modules/on-demand-build.m +++ b/test/Modules/on-demand-build.m @@ -3,7 +3,7 @@ // RUN: %clang_cc1 -fmodules -fno-objc-infer-related-result-type -Werror -Wno-error=incomplete-umbrella -x objective-c++ -fmodule-cache-path %t -F %S/Inputs -I %S/Inputs -verify %s // RUN: %clang_cc1 -fmodules -fno-objc-infer-related-result-type -Werror -Wno-error=incomplete-umbrella -fmodule-cache-path %t -F %S/Inputs -I %S/Inputs -verify %s #define FOO -@import Module; +@__experimental_modules_import Module; @interface OtherClass @end @@ -22,6 +22,6 @@ void test_getModuleVersion() { # error MODULE_SUBFRAMEWORK_H should be hidden #endif -@import subdir; +@__experimental_modules_import subdir; const char *getSubdirTest() { return getSubdir(); } diff --git a/test/Modules/on-demand-macros.m b/test/Modules/on-demand-macros.m index a48ac88c178..2b8c5456eb6 100644 --- a/test/Modules/on-demand-macros.m +++ b/test/Modules/on-demand-macros.m @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -F %S/Inputs -DFOO_RETURNS_INT_PTR -verify %s // RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -F %S/Inputs -verify %s -@import CmdLine; +@__experimental_modules_import CmdLine; void test() { #ifdef FOO_RETURNS_INT_PTR diff --git a/test/Modules/redecl-merge.m b/test/Modules/redecl-merge.m index 591c4a29a9e..2ddd563b133 100644 --- a/test/Modules/redecl-merge.m +++ b/test/Modules/redecl-merge.m @@ -4,12 +4,12 @@ @class C2; @class C3; @class C3; -@import redecl_merge_left; +@__experimental_modules_import redecl_merge_left; typedef struct my_struct_type *my_struct_ref; @protocol P4; @class C3; @class C3; -@import redecl_merge_right; +@__experimental_modules_import redecl_merge_right; @implementation A - (Super*)init { return self; } @@ -113,7 +113,7 @@ C4 *global_C4; ClassWithDef *cwd1; -@import redecl_merge_left_left; +@__experimental_modules_import redecl_merge_left_left; void test_C4a(C4 *c4) { global_C4 = c4 = get_a_C4(); @@ -124,7 +124,7 @@ void test_ClassWithDef(ClassWithDef *cwd) { [cwd method]; } -@import redecl_merge_bottom; +@__experimental_modules_import redecl_merge_bottom; void test_C4b() { if (&refers_to_C4) { diff --git a/test/Modules/redeclarations.m b/test/Modules/redeclarations.m index d71e9e8600b..3f3e6954cc2 100644 --- a/test/Modules/redeclarations.m +++ b/test/Modules/redeclarations.m @@ -1,5 +1,5 @@ -@import redeclarations_left; -@import redeclarations_right; +@__experimental_modules_import redeclarations_left; +@__experimental_modules_import redeclarations_right; @interface MyObject : NSObject @end diff --git a/test/Modules/requires.m b/test/Modules/requires.m index 70d6160b0f3..ce2537c78b7 100644 --- a/test/Modules/requires.m +++ b/test/Modules/requires.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs %s -verify -@import DependsOnModule.CXX; // expected-error{{module 'DependsOnModule.CXX' requires feature 'cplusplus'}} +@__experimental_modules_import DependsOnModule.CXX; // expected-error{{module 'DependsOnModule.CXX' requires feature 'cplusplus'}} diff --git a/test/Modules/subframeworks.m b/test/Modules/subframeworks.m index e87bc6bac33..09298c49395 100644 --- a/test/Modules/subframeworks.m +++ b/test/Modules/subframeworks.m @@ -2,13 +2,13 @@ // RUN: %clang_cc1 -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs -F %S/Inputs/DependsOnModule.framework/Frameworks %s -verify // RUN: %clang_cc1 -x objective-c++ -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs -F %S/Inputs/DependsOnModule.framework/Frameworks %s -verify -@import DependsOnModule; +@__experimental_modules_import DependsOnModule; void testSubFramework() { float *sf1 = sub_framework; // expected-error{{use of undeclared identifier 'sub_framework'}} } -@import DependsOnModule.SubFramework; +@__experimental_modules_import DependsOnModule.SubFramework; void testSubFrameworkAgain() { float *sf2 = sub_framework; @@ -16,7 +16,7 @@ void testSubFrameworkAgain() { } #ifdef __cplusplus -@import DependsOnModule.CXX; +@__experimental_modules_import DependsOnModule.CXX; CXXOnly cxxonly; #endif diff --git a/test/Modules/submodules-preprocess.cpp b/test/Modules/submodules-preprocess.cpp index 7d218b13593..8d6c2cd70d8 100644 --- a/test/Modules/submodules-preprocess.cpp +++ b/test/Modules/submodules-preprocess.cpp @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -fmodules -x objective-c++ -Eonly -fmodule-cache-path %t -I %S/Inputs/submodules %s -verify // FIXME: When we have a syntax for modules in C++, use that. -@import std.vector; +@__experimental_modules_import std.vector; #ifndef HAVE_VECTOR # error HAVE_VECTOR macro is not available (but should be) @@ -16,7 +16,7 @@ # error HAVE_HASH_MAP macro is available (but shouldn't be) #endif -@import std.typetraits; // expected-error{{no submodule named 'typetraits' in module 'std'; did you mean 'type_traits'?}} +@__experimental_modules_import std.typetraits; // expected-error{{no submodule named 'typetraits' in module 'std'; did you mean 'type_traits'?}} #ifndef HAVE_VECTOR # error HAVE_VECTOR macro is not available (but should be) @@ -30,9 +30,9 @@ # error HAVE_HASH_MAP macro is available (but shouldn't be) #endif -@import std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}} +@__experimental_modules_import std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}} -@import std; // import everything in 'std' +@__experimental_modules_import std; // import everything in 'std' #ifndef HAVE_VECTOR # error HAVE_VECTOR macro is not available (but should be) @@ -46,7 +46,7 @@ # error HAVE_HASH_MAP macro is available (but shouldn't be) #endif -@import std.hash_map; +@__experimental_modules_import std.hash_map; #ifndef HAVE_VECTOR # error HAVE_VECTOR macro is not available (but should be) diff --git a/test/Modules/submodules.cpp b/test/Modules/submodules.cpp index 1417446416c..60d5ae0c22f 100644 --- a/test/Modules/submodules.cpp +++ b/test/Modules/submodules.cpp @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -x objective-c++ -fmodule-cache-path %t -fmodules -I %S/Inputs/submodules %s -verify // FIXME: When we have a syntax for modules in C++, use that. -@import std.vector; +@__experimental_modules_import std.vector; vector<int> vi; @@ -10,20 +10,20 @@ vector<int> vi; remove_reference<int&>::type *int_ptr = 0; // expected-error{{unknown type name 'remove_reference'}} \ // expected-error{{expected unqualified-id}} -@import std.typetraits; // expected-error{{no submodule named 'typetraits' in module 'std'; did you mean 'type_traits'?}} +@__experimental_modules_import std.typetraits; // expected-error{{no submodule named 'typetraits' in module 'std'; did you mean 'type_traits'?}} vector<float> vf; remove_reference<int&>::type *int_ptr2 = 0; -@import std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}} +@__experimental_modules_import std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}} -@import std; // import everything in 'std' +@__experimental_modules_import std; // import everything in 'std' // hash_map still isn't available. hash_map<int, float> ints_to_floats; // expected-error{{unknown type name 'hash_map'}} \ // expected-error{{expected unqualified-id}} -@import std.hash_map; +@__experimental_modules_import std.hash_map; hash_map<int, float> ints_to_floats2; diff --git a/test/Modules/submodules.m b/test/Modules/submodules.m index 908a4785e8e..e014bead73b 100644 --- a/test/Modules/submodules.m +++ b/test/Modules/submodules.m @@ -3,7 +3,7 @@ // RUN: %clang_cc1 -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs %s -verify // Note: transitively imports Module.Sub2. -@import Module.Sub; +@__experimental_modules_import Module.Sub; int getValue() { return *Module_Sub + *Module_Sub2; diff --git a/test/Modules/wildcard-submodule-exports.cpp b/test/Modules/wildcard-submodule-exports.cpp index 00d95716512..6b4f02c6f23 100644 --- a/test/Modules/wildcard-submodule-exports.cpp +++ b/test/Modules/wildcard-submodule-exports.cpp @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -x objective-c++ -fmodule-cache-path %t -fmodules -I %S/Inputs/wildcard-submodule-exports %s -verify // FIXME: When we have a syntax for modules in C++, use that. -@import C.One; +@__experimental_modules_import C.One; void test_C_One() { int *A1_ptr = A1; @@ -10,7 +10,7 @@ void test_C_One() { (void)B1; // expected-error{{use of undeclared identifier 'B1'}} } -@import C.Two; +@__experimental_modules_import C.Two; void test_C_Two() { unsigned int *A2_ptr = A2; @@ -18,7 +18,7 @@ void test_C_Two() { unsigned long *C2_ptr = C2; } -@import B.One; +@__experimental_modules_import B.One; void test_B_One() { short *B1_ptr = B1; -- GitLab