Eliminate the uglified keyword __import_module__ for importing
modules. This leaves us without an explicit syntax for importing
modules in C/C++, because such a syntax needs to be discussed
first. In Objective-C/Objective-C++, the @import syntax is used to
import modules.
Note that, under -fmodules, C/C++ programs can import modules via the
#include mechanism when a module map is in place for that header. This
allows us to work with modules in C/C++ without committing to a syntax.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147467 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h
index a5eea32..c41e6da 100644
--- a/include/clang/Basic/IdentifierTable.h
+++ b/include/clang/Basic/IdentifierTable.h
@@ -69,7 +69,9 @@
bool OutOfDate : 1; // True if there may be additional
// information about this identifier
// stored externally.
- // 2 bits left in 32-bit word.
+ bool IsImport : 1; // True if this is the 'import' contextual
+ // keyword.
+ // 1 bit left in 32-bit word.
void *FETokenInfo; // Managed by the language front-end.
llvm::StringMapEntry<IdentifierInfo*> *Entry;
@@ -283,6 +285,18 @@
RecomputeNeedsHandleIdentifier();
}
+ /// \brief Determine whether this is the contextual keyword 'import'.
+ bool isImport() const { return IsImport; }
+
+ /// \brief Set whether this identifier is the contextual keyword 'import'.
+ void setImport(bool I) {
+ IsImport = I;
+ if (I)
+ NeedsHandleIdentifier = true;
+ else
+ RecomputeNeedsHandleIdentifier();
+ }
+
private:
/// RecomputeNeedsHandleIdentifier - The Preprocessor::HandleIdentifier does
/// several special (but rare) things to identifiers of various sorts. For
@@ -295,8 +309,7 @@
NeedsHandleIdentifier =
(isPoisoned() | hasMacroDefinition() | isCPlusPlusOperatorKeyword() |
isExtensionToken() | isCXX11CompatKeyword() || isOutOfDate() ||
- (getTokenID() == tok::kw___import_module__) ||
- (getObjCKeywordID() == tok::objc_import));
+ isImport());
}
};
@@ -447,6 +460,10 @@
// contents.
II->Entry = &Entry;
+ // If this is the 'import' contextual keyword, mark it as such.
+ if (Name.equals("import"))
+ II->setImport(true);
+
return *II;
}
@@ -478,6 +495,10 @@
// Make sure getName() knows how to find the IdentifierInfo
// contents.
II->Entry = &Entry;
+
+ // If this is the 'import' contextual keyword, mark it as such.
+ if (Name.equals("import"))
+ II->setImport(true);
}
return *II;
diff --git a/include/clang/Basic/TokenKinds.def b/include/clang/Basic/TokenKinds.def
index 277ed84..7841c20 100644
--- a/include/clang/Basic/TokenKinds.def
+++ b/include/clang/Basic/TokenKinds.def
@@ -405,7 +405,6 @@
// Apple Extension.
KEYWORD(__private_extern__ , KEYALL)
-KEYWORD(__import_module__ , KEYALL)
KEYWORD(__module_private__ , KEYALL)
// Microsoft Extension.
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h
index 53d5f40..8c7b0bc 100644
--- a/include/clang/Lex/Preprocessor.h
+++ b/include/clang/Lex/Preprocessor.h
@@ -162,8 +162,8 @@
/// for preprocessing.
SourceLocation CodeCompletionFileLoc;
- /// \brief The source location of the __import_module__ or 'import' keyword we
- /// just lexed, if any.
+ /// \brief The source location of the 'import' contextual keyword we just
+ /// lexed, if any.
SourceLocation ModuleImportLoc;
/// \brief The module import path that we're currently processing.
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index 2b7c6a7..086bf23 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -1120,10 +1120,9 @@
/// \brief The parser has processed a module import declaration.
///
- /// \param AtLoc The location of the '@' symbol, if present.
+ /// \param AtLoc The location of the '@' symbol, if any.
///
- /// \param ImportLoc The location of the '__import_module__' or 'import'
- /// keyword.
+ /// \param ImportLoc The location of the 'import' keyword.
///
/// \param Path The module access path.
DeclResult ActOnModuleImport(SourceLocation AtLoc, SourceLocation ImportLoc,
diff --git a/lib/Basic/IdentifierTable.cpp b/lib/Basic/IdentifierTable.cpp
index 4368ff7..3da15bd 100644
--- a/lib/Basic/IdentifierTable.cpp
+++ b/lib/Basic/IdentifierTable.cpp
@@ -40,6 +40,7 @@
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 04d92b8..138e7d9 100644
--- a/lib/Lex/PPDirectives.cpp
+++ b/lib/Lex/PPDirectives.cpp
@@ -1378,15 +1378,16 @@
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 8722be9..046b0df 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -548,11 +548,9 @@
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 @@
}
}
-/// \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 @@
// 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 b96ff38..d14b9ad 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -666,9 +666,6 @@
case tok::kw___if_not_exists:
ParseMicrosoftIfExistsExternalDeclaration();
return DeclGroupPtrTy();
-
- case tok::kw___import_module__:
- return ParseModuleImport(SourceLocation());
default:
dont_know:
@@ -1570,8 +1567,7 @@
}
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();
diff --git a/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h b/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h
index 2a8282c..156c226 100644
--- a/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h
+++ b/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h
@@ -1,3 +1,3 @@
-__import_module__ MutuallyRecursive2;
+@import MutuallyRecursive2;
diff --git a/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h b/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h
index 9800853..be3facd 100644
--- a/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h
+++ b/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h
@@ -1,6 +1,6 @@
-__import_module__ MutuallyRecursive1;
+@import MutuallyRecursive1;
diff --git a/test/Modules/Inputs/diamond.h b/test/Modules/Inputs/diamond.h
index 0ae3c4f..1990b45 100644
--- a/test/Modules/Inputs/diamond.h
+++ b/test/Modules/Inputs/diamond.h
@@ -1 +1 @@
-__import_module__ diamond_bottom;
+@import diamond_bottom;
diff --git a/test/Modules/Inputs/diamond_bottom.h b/test/Modules/Inputs/diamond_bottom.h
index e0b06d6..2a0a84e 100644
--- a/test/Modules/Inputs/diamond_bottom.h
+++ b/test/Modules/Inputs/diamond_bottom.h
@@ -1,4 +1,4 @@
-__import_module__ diamond_left;
-__import_module__ diamond_right;
+@import diamond_left;
+@import diamond_right;
char bottom(char *x);
diff --git a/test/Modules/Inputs/diamond_left.h b/test/Modules/Inputs/diamond_left.h
index 88cbf60..fce2e48 100644
--- a/test/Modules/Inputs/diamond_left.h
+++ b/test/Modules/Inputs/diamond_left.h
@@ -1,4 +1,4 @@
-__import_module__ diamond_top;
+@import diamond_top;
float left(float *);
diff --git a/test/Modules/Inputs/diamond_right.h b/test/Modules/Inputs/diamond_right.h
index 6f8bb82..fa408ea 100644
--- a/test/Modules/Inputs/diamond_right.h
+++ b/test/Modules/Inputs/diamond_right.h
@@ -1,4 +1,4 @@
-__import_module__ diamond_top;
+@import diamond_top;
double right(double *);
diff --git a/test/Modules/Inputs/wildcard-submodule-exports/C_one.h b/test/Modules/Inputs/wildcard-submodule-exports/C_one.h
index cbdc2be..e3b7593 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_module__ A.One;
-__import_module__ B.One;
+@import A.One;
+@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 6a66ac7..b65dcf6 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_module__ A.Two;
-__import_module__ B.Two;
+@import A.Two;
+@import B.Two;
unsigned long *C2;
diff --git a/test/Modules/cycles.c b/test/Modules/cycles.c
index 8e3e9c6..df2a0a7 100644
--- a/test/Modules/cycles.c
+++ b/test/Modules/cycles.c
@@ -1,12 +1,12 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodule-cache-path %t -F %S/Inputs %s 2>&1 | FileCheck %s
-
-__import_module__ MutuallyRecursive1;
+// 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;
// 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:19: fatal error: cyclic dependency in module 'MutuallyRecursive1': MutuallyRecursive1 -> MutuallyRecursive2 -> MutuallyRecursive1
-// CHECK: MutuallyRecursive1.h:2:19: fatal error: could not build module 'MutuallyRecursive2'
-// CHECK: cycles.c:4:19: fatal error: could not build module 'MutuallyRecursive1'
+// 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'
diff --git a/test/Modules/diamond-pch.c b/test/Modules/diamond-pch.c
index d0f4590..4397c19 100644
--- a/test/Modules/diamond-pch.c
+++ b/test/Modules/diamond-pch.c
@@ -19,9 +19,10 @@
}
// RUN: rm -rf %t
-// RUN: %clang_cc1 -emit-module -fmodule-cache-path %t -fmodule-name=diamond_top %S/Inputs/module.map
-// RUN: %clang_cc1 -emit-module -fmodule-cache-path %t -fmodule-name=diamond_left %S/Inputs/module.map
-// RUN: %clang_cc1 -emit-module -fmodule-cache-path %t -fmodule-name=diamond_right %S/Inputs/module.map
-// RUN: %clang_cc1 -emit-module -fmodule-cache-path %t -fmodule-name=diamond_bottom %S/Inputs/module.map
-// RUN: %clang_cc1 -emit-pch -fmodule-cache-path %t -o %t.pch %S/Inputs/diamond.h
-// RUN: %clang_cc1 -fmodule-cache-path %t -include-pch %t.pch %s -verify
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_top %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_left %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_right %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_bottom %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-pch -fmodule-cache-path %t -o %t.pch %S/Inputs/diamond.h
+// RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -include-pch %t.pch %s -verify
+// FIXME: When we have a syntax for modules in C, use that.
diff --git a/test/Modules/diamond.c b/test/Modules/diamond.c
index 59181c5..1d89021 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_module__ diamond_bottom;
+@import diamond_bottom;
void test_diamond(int i, float f, double d, char c) {
top(&i);
@@ -21,8 +21,9 @@
}
// RUN: rm -rf %t
-// RUN: %clang_cc1 -emit-module -fmodule-cache-path %t -fmodule-name=diamond_top %S/Inputs/module.map
-// RUN: %clang_cc1 -emit-module -fmodule-cache-path %t -fmodule-name=diamond_left %S/Inputs/module.map
-// RUN: %clang_cc1 -emit-module -fmodule-cache-path %t -fmodule-name=diamond_right %S/Inputs/module.map
-// RUN: %clang_cc1 -emit-module -fmodule-cache-path %t -fmodule-name=diamond_bottom %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodule-cache-path %t %s -verify
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_top %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_left %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_right %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_bottom %S/Inputs/module.map
+// 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.
diff --git a/test/Modules/irgen.c b/test/Modules/irgen.c
index a3d5aa0..8f4c299 100644
--- a/test/Modules/irgen.c
+++ b/test/Modules/irgen.c
@@ -1,8 +1,9 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodule-cache-path %t -emit-module -fmodule-name=irgen -triple x86_64-apple-darwin10 %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodule-cache-path %t -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -emit-module -fmodule-name=irgen -triple x86_64-apple-darwin10 %S/Inputs/module.map
+// 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_module__ irgen;
+@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 e278eb5..bc0b426 100644
--- a/test/Modules/load_failure.c
+++ b/test/Modules/load_failure.c
@@ -1,20 +1,21 @@
#ifdef NONEXISTENT
-__import_module__ load_nonexistent;
+@import load_nonexistent;
#endif
#ifdef FAILURE
-__import_module__ load_failure;
+@import load_failure;
#endif
// RUN: rm -rf %t
-// RUN: %clang_cc1 -x c++ -fmodule-cache-path %t -fdisable-module-hash -emit-module -fmodule-name=load_failure %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash %s -DNONEXISTENT 2>&1 | FileCheck -check-prefix=CHECK-NONEXISTENT %s
-// CHECK-NONEXISTENT: load_failure.c:2:19: fatal error: module 'load_nonexistent' not found
+// 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
-// RUN: not %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash %s -DFAILURE 2> %t.out
+// 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
// FIXME: Clean up diagnostic text below and give it a location
// CHECK-FAILURE: error: C99 was disabled in PCH file but is currently enabled
+// FIXME: When we have a syntax for modules in C, use that.
diff --git a/test/Modules/lookup.cpp b/test/Modules/lookup.cpp
index 2bb53da..5e84532 100644
--- a/test/Modules/lookup.cpp
+++ b/test/Modules/lookup.cpp
@@ -1,7 +1,8 @@
-#define import __import_module__
+#define import @import
import lookup_left_cxx;
-#define IMPORT(X) __import_module__ X
+#undef import
+#define IMPORT(X) @import X
IMPORT(lookup_right_cxx);
void test(int i, float f) {
@@ -15,10 +16,11 @@
}
// RUN: rm -rf %t
-// RUN: %clang_cc1 -emit-module -fmodule-cache-path %t -fmodule-name=lookup_left_cxx -x c++ %S/Inputs/module.map -verify
-// RUN: %clang_cc1 -emit-module -fmodule-cache-path %t -fmodule-name=lookup_right_cxx -x c++ %S/Inputs/module.map -verify
-// RUN: %clang_cc1 -x c++ -fmodule-cache-path %t %s -verify
-// RUN: %clang_cc1 -ast-print -x c++ -fmodule-cache-path %t %s | FileCheck -check-prefix=CHECK-PRINT %s
+// RUN: %clang_cc1 -fmodules -x objective-c++ -emit-module -fmodule-cache-path %t -fmodule-name=lookup_left_cxx %S/Inputs/module.map -verify
+// RUN: %clang_cc1 -fmodules -x objective-c++ -emit-module -fmodule-cache-path %t -fmodule-name=lookup_right_cxx %S/Inputs/module.map -verify
+// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t %s -verify
+// RUN: %clang_cc1 -fmodules -ast-print -x objective-c++ -fmodule-cache-path %t %s | FileCheck -check-prefix=CHECK-PRINT %s
+// FIXME: When we have a syntax for modules in C++, use that.
// CHECK-PRINT: int *f0(int *);
// CHECK-PRINT: float *f0(float *);
diff --git a/test/Modules/macros.c b/test/Modules/macros.c
index 460c482..3fddcc7 100644
--- a/test/Modules/macros.c
+++ b/test/Modules/macros.c
@@ -1,9 +1,10 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodules -emit-module -fmodule-cache-path %t -fmodule-name=macros %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -verify -fmodule-cache-path %t %s
-// RUN: %clang_cc1 -E -fmodules -fmodule-cache-path %t %s | FileCheck -check-prefix CHECK-PREPROCESSED %s
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=macros %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -verify -fmodule-cache-path %t %s
+// 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_module__ macros;
+@import macros;
#ifndef INTEGER
# error INTEGER macro should be visible
diff --git a/test/Modules/module-private.cpp b/test/Modules/module-private.cpp
index bdfa268..e972ce2 100644
--- a/test/Modules/module-private.cpp
+++ b/test/Modules/module-private.cpp
@@ -1,10 +1,11 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodule-cache-path %t -fmodule-name=module_private_left -x c++ -emit-module %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodule-cache-path %t -fmodule-name=module_private_right -x c++ -emit-module %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodule-cache-path %t %s -verify
+// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t -fmodule-name=module_private_left -emit-module %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t -fmodule-name=module_private_right -emit-module %S/Inputs/module.map
+// 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__ module_private_left;
-__import_module__ module_private_right;
+@import module_private_left;
+@import module_private_right;
void test() {
int &ir = f0(1.0); // okay: f0() from 'right' is not visible
diff --git a/test/Modules/normal-module-map.cpp b/test/Modules/normal-module-map.cpp
index 4d2f59a..2858dab 100644
--- a/test/Modules/normal-module-map.cpp
+++ b/test/Modules/normal-module-map.cpp
@@ -8,7 +8,7 @@
return umbrella + umbrella_sub;
}
-__import_module__ Umbrella2;
+@import Umbrella2;
#include "a1.h"
#include "b1.h"
@@ -18,7 +18,7 @@
return a1 + b1 + nested2;
}
-__import_module__ nested_umbrella.a;
+@import nested_umbrella.a;
int testNestedUmbrellaA() {
return nested_umbrella_a;
@@ -28,7 +28,7 @@
return nested_umbrella_b; // expected-error{{use of undeclared identifier 'nested_umbrella_b'; did you mean 'nested_umbrella_a'?}}
}
-__import_module__ nested_umbrella.b;
+@import nested_umbrella.b;
int testNestedUmbrellaB() {
return nested_umbrella_b;
diff --git a/test/Modules/submodules-preprocess.cpp b/test/Modules/submodules-preprocess.cpp
index b819d40..7d218b1 100644
--- a/test/Modules/submodules-preprocess.cpp
+++ b/test/Modules/submodules-preprocess.cpp
@@ -1,7 +1,8 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -Eonly -fmodule-cache-path %t -fmodules -I %S/Inputs/submodules %s -verify
+// 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_module__ std.vector;
+@import std.vector;
#ifndef HAVE_VECTOR
# error HAVE_VECTOR macro is not available (but should be)
@@ -15,7 +16,7 @@
# error HAVE_HASH_MAP macro is available (but shouldn't be)
#endif
-__import_module__ std.typetraits; // expected-error{{no submodule named 'typetraits' in module 'std'; did you mean 'type_traits'?}}
+@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)
@@ -29,9 +30,9 @@
# error HAVE_HASH_MAP macro is available (but shouldn't be)
#endif
-__import_module__ std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}}
+@import std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}}
-__import_module__ std; // import everything in 'std'
+@import std; // import everything in 'std'
#ifndef HAVE_VECTOR
# error HAVE_VECTOR macro is not available (but should be)
@@ -45,7 +46,7 @@
# error HAVE_HASH_MAP macro is available (but shouldn't be)
#endif
-__import_module__ std.hash_map;
+@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 b62d487..1417446 100644
--- a/test/Modules/submodules.cpp
+++ b/test/Modules/submodules.cpp
@@ -1,7 +1,8 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodule-cache-path %t -fmodules -I %S/Inputs/submodules %s -verify
+// 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_module__ std.vector;
+@import std.vector;
vector<int> vi;
@@ -9,20 +10,20 @@
remove_reference<int&>::type *int_ptr = 0; // expected-error{{unknown type name 'remove_reference'}} \
// expected-error{{expected unqualified-id}}
-__import_module__ std.typetraits; // expected-error{{no submodule named 'typetraits' in module 'std'; did you mean 'type_traits'?}}
+@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_module__ std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}}
+@import std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}}
-__import_module__ std; // import everything in 'std'
+@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_module__ std.hash_map;
+@import std.hash_map;
hash_map<int, float> ints_to_floats2;
diff --git a/test/Modules/wildcard-submodule-exports.cpp b/test/Modules/wildcard-submodule-exports.cpp
index a8da381..00d9571 100644
--- a/test/Modules/wildcard-submodule-exports.cpp
+++ b/test/Modules/wildcard-submodule-exports.cpp
@@ -1,7 +1,8 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodule-cache-path %t -fmodules -I %S/Inputs/wildcard-submodule-exports %s -verify
+// 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_module__ C.One;
+@import C.One;
void test_C_One() {
int *A1_ptr = A1;
@@ -9,7 +10,7 @@
(void)B1; // expected-error{{use of undeclared identifier 'B1'}}
}
-__import_module__ C.Two;
+@import C.Two;
void test_C_Two() {
unsigned int *A2_ptr = A2;
@@ -17,7 +18,7 @@
unsigned long *C2_ptr = C2;
}
-__import_module__ B.One;
+@import B.One;
void test_B_One() {
short *B1_ptr = B1;