Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 1b257af

Browse files
committed
Use @import rather than @__experimental_modules_import, since the
latter is rather a mess to type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169919 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent bd5da3c commit 1b257af

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+131
-131
lines changed

Diff for: include/clang/AST/Decl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3218,7 +3218,7 @@ class BlockDecl : public Decl, public DeclContext {
32183218
///
32193219
/// An import declaration imports the named module (or submodule). For example:
32203220
/// \code
3221-
/// @__experimental_modules_import std.vector;
3221+
/// @import std.vector;
32223222
/// \endcode
32233223
///
32243224
/// Import declarations can also be implicitly generated from

Diff for: include/clang/Basic/IdentifierTable.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,11 @@ class IdentifierInfo {
297297
}
298298

299299
/// \brief Determine whether this is the contextual keyword
300-
/// '__experimental_modules_import'.
300+
/// 'import'.
301301
bool isModulesImport() const { return IsModulesImport; }
302302

303303
/// \brief Set whether this identifier is the contextual keyword
304-
/// '__experimental_modules_import'.
304+
/// 'import'.
305305
void setModulesImport(bool I) {
306306
IsModulesImport = I;
307307
if (I)

Diff for: include/clang/Basic/TokenKinds.def

+1-1
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ OBJC2_AT_KEYWORD(required)
566566
OBJC2_AT_KEYWORD(optional)
567567
OBJC2_AT_KEYWORD(synthesize)
568568
OBJC2_AT_KEYWORD(dynamic)
569-
OBJC2_AT_KEYWORD(__experimental_modules_import)
569+
OBJC2_AT_KEYWORD(import)
570570

571571
// TODO: What to do about context-sensitive keywords like:
572572
// bycopy/byref/in/inout/oneway/out?

Diff for: lib/AST/DeclPrinter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ void DeclPrinter::VisitFileScopeAsmDecl(FileScopeAsmDecl *D) {
686686
}
687687

688688
void DeclPrinter::VisitImportDecl(ImportDecl *D) {
689-
Out << "@__experimental_modules_import " << D->getImportedModule()->getFullModuleName()
689+
Out << "@import " << D->getImportedModule()->getFullModuleName()
690690
<< ";\n";
691691
}
692692

Diff for: lib/Basic/IdentifierTable.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ IdentifierTable::IdentifierTable(const LangOptions &LangOpts,
8282

8383

8484
// Add the '_experimental_modules_import' contextual keyword.
85-
get("__experimental_modules_import").setModulesImport(true);
85+
get("import").setModulesImport(true);
8686
}
8787

8888
//===----------------------------------------------------------------------===//

Diff for: lib/Lex/PPDirectives.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1476,7 +1476,7 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc,
14761476
Diag(HashLoc, diag::warn_auto_module_import)
14771477
<< IncludeKind << PathString
14781478
<< FixItHint::CreateReplacement(ReplaceRange,
1479-
"@__experimental_modules_import " + PathString.str().str() + ";");
1479+
"@import " + PathString.str().str() + ";");
14801480
}
14811481

14821482
// Load the module.

Diff for: lib/Lex/Preprocessor.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -631,10 +631,10 @@ void Preprocessor::HandleIdentifier(Token &Identifier) {
631631
if (II.isExtensionToken() && !DisableMacroExpansion)
632632
Diag(Identifier, diag::ext_token_used);
633633

634-
// If this is the '__experimental_modules_import' contextual keyword, note
634+
// If this is the 'import' contextual keyword, note
635635
// that the next token indicates a module name.
636636
//
637-
// Note that we do not treat '__experimental_modules_import' as a contextual
637+
// Note that we do not treat 'import' as a contextual
638638
// keyword when we're in a caching lexer, because caching lexers only get
639639
// used in contexts where import declarations are disallowed.
640640
if (II.isModulesImport() && !InMacroArgs && !DisableMacroExpansion &&

Diff for: lib/Parse/ParseObjc.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Parser::DeclGroupPtrTy Parser::ParseObjCAtDirectives() {
6565
case tok::objc_dynamic:
6666
SingleDecl = ParseObjCPropertyDynamic(AtLoc);
6767
break;
68-
case tok::objc___experimental_modules_import:
68+
case tok::objc_import:
6969
if (getLangOpts().Modules)
7070
return ParseModuleImport(AtLoc);
7171

Diff for: lib/Parse/Parser.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,7 @@ void Parser::ParseMicrosoftIfExistsExternalDeclaration() {
18451845
}
18461846

18471847
Parser::DeclGroupPtrTy Parser::ParseModuleImport(SourceLocation AtLoc) {
1848-
assert(Tok.isObjCAtKeyword(tok::objc___experimental_modules_import) &&
1848+
assert(Tok.isObjCAtKeyword(tok::objc_import) &&
18491849
"Improper start to module import");
18501850
SourceLocation ImportLoc = ConsumeToken();
18511851

Diff for: test/Index/annotate-module.m

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
#include <DependsOnModule/DependsOnModule.h>
3-
@__experimental_modules_import DependsOnModule;
3+
@import DependsOnModule;
44
int glob;
55

66
// RUN: rm -rf %t.cache
@@ -17,9 +17,9 @@
1717
// CHECK-NEXT: Identifier: "h" [2:43 - 2:44] inclusion directive=[[INC_DIR]]
1818
// CHECK-NEXT: Punctuation: ">" [2:44 - 2:45] inclusion directive=[[INC_DIR]]
1919
// CHECK-NEXT: Punctuation: "@" [3:1 - 3:2] ModuleImport=DependsOnModule:3:1
20-
// CHECK-NEXT: Keyword: "__experimental_modules_import" [3:2 - 3:31] ModuleImport=DependsOnModule:3:1
21-
// CHECK-NEXT: Identifier: "DependsOnModule" [3:32 - 3:47] ModuleImport=DependsOnModule:3:1
22-
// CHECK-NEXT: Punctuation: ";" [3:47 - 3:48]
20+
// CHECK-NEXT: Keyword: "import" [3:2 - 3:8] ModuleImport=DependsOnModule:3:1
21+
// CHECK-NEXT: Identifier: "DependsOnModule" [3:9 - 3:24] ModuleImport=DependsOnModule:3:1
22+
// CHECK-NEXT: Punctuation: ";" [3:24 - 3:25]
2323
// CHECK-NEXT: Keyword: "int" [4:1 - 4:4] VarDecl=glob:4:5
2424
// CHECK-NEXT: Identifier: "glob" [4:5 - 4:9] VarDecl=glob:4:5
2525
// CHECK-NEXT: Punctuation: ";" [4:9 - 4:10]

Diff for: test/Index/complete-modules.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// Note: the run lines follow their respective tests, since line/column
22
// matter in this test.
33

4-
@__experimental_modules_import LibA.Extensions;
4+
@import LibA.Extensions;
55

66
// RUN: rm -rf %t
7-
// 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
7+
// 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
88
// CHECK-TOP-LEVEL: NotImplemented:{TypedText Framework} (50)
99
// CHECK-TOP-LEVEL: NotImplemented:{TypedText LibA} (50)
1010
// CHECK-TOP-LEVEL: NotImplemented:{TypedText nested} (50)
1111

12-
// 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
12+
// 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
1313
// CHECK-LIBA: NotImplemented:{TypedText Extensions} (50)
1414

Diff for: test/Index/crash-recovery-modules.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Parse the file, such that building the module will cause Clang to crash.
55
// 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
66
// RUN: FileCheck < %t.err -check-prefix=CHECK-CRASH %s
7-
// CHECK-CRASH: crash-recovery-modules.m:16:32:{16:2-16:37}: fatal error: could not build module 'Crash'
7+
// CHECK-CRASH: crash-recovery-modules.m:16:9:{16:2-16:14}: fatal error: could not build module 'Crash'
88

99
// Parse the file again, without crashing, to make sure that
1010
// subsequent parses do the right thing.
@@ -13,7 +13,7 @@
1313
// REQUIRES: crash-recovery
1414
// REQUIRES: shell
1515

16-
@__experimental_modules_import Crash;
16+
@import Crash;
1717

1818
void test() {
1919
const char* error = getCrashString();

Diff for: test/Index/index-module.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
#include <DependsOnModule/DependsOnModule.h>
3-
@__experimental_modules_import DependsOnModule;
3+
@import DependsOnModule;
44
int glob;
55

66
// RUN: rm -rf %t.cache
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

2-
@__experimental_modules_import MutuallyRecursive2;
2+
@import MutuallyRecursive2;
33

Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22

3-
@__experimental_modules_import MutuallyRecursive1;
3+
@import MutuallyRecursive1;
44

55

66

Diff for: test/Modules/Inputs/category_bottom.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
@__experimental_modules_import category_left;
1+
@import category_left;
22

33
@interface Foo(Bottom)
44
-(void)bottom;
55
@end
66

7-
@__experimental_modules_import category_right;
7+
@import category_right;
88

99
@interface LeftFoo(Bottom)
1010
-(void)bottom;

Diff for: test/Modules/Inputs/category_left.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@__experimental_modules_import category_top;
1+
@import category_top;
22

33
@interface Foo(Left)
44
-(void)left;

Diff for: test/Modules/Inputs/category_other.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@__experimental_modules_import category_top;
1+
@import category_top;
22

33
@interface Foo(Other)
44
-(void)other;

Diff for: test/Modules/Inputs/category_right.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@__experimental_modules_import category_top;
1+
@import category_top;
22

33
@interface Foo(Right1)
44
-(void)right1;

Diff for: test/Modules/Inputs/diamond.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
@__experimental_modules_import diamond_bottom;
1+
@import diamond_bottom;

Diff for: test/Modules/Inputs/diamond_bottom.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@__experimental_modules_import diamond_left;
2-
@__experimental_modules_import diamond_right;
1+
@import diamond_left;
2+
@import diamond_right;
33

44
char bottom(char *x);

Diff for: test/Modules/Inputs/diamond_left.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@__experimental_modules_import diamond_top;
1+
@import diamond_top;
22

33
float left(float *);
44

Diff for: test/Modules/Inputs/diamond_right.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@__experimental_modules_import diamond_top;
1+
@import diamond_top;
22

33
double right(double *);
44

Diff for: test/Modules/Inputs/macros_left.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@__experimental_modules_import macros_top;
1+
@import macros_top;
22
#define LEFT unsigned long
33

44
#undef TOP_LEFT_UNDEF

Diff for: test/Modules/Inputs/macros_right.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@__experimental_modules_import macros_top;
1+
@import macros_top;
22
#define RIGHT unsigned short
33

44

Diff for: test/Modules/Inputs/namespaces-left.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@__experimental_modules_import namespaces_top;
1+
@import namespaces_top;
22

33
namespace N1 { }
44

Diff for: test/Modules/Inputs/namespaces-right.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@__experimental_modules_import namespaces_top;
1+
@import namespaces_top;
22

33
namespace N2 { }
44

Diff for: test/Modules/Inputs/redecl-merge-bottom.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
@__experimental_modules_import redecl_merge_left;
1+
@import redecl_merge_left;
22

33
@class C4;
44
@class C4;
55
@protocol P4;
66
@protocol P4;
77
@protocol P4;
8-
@__experimental_modules_import redecl_merge_right;
8+
@import redecl_merge_right;
99

1010
@class B;
1111

Diff for: test/Modules/Inputs/redecl-merge-left-left.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@__experimental_modules_import redecl_merge_left;
1+
@import redecl_merge_left;
22

33
@class C4;
44
void accept_a_C4(C4*);

Diff for: test/Modules/Inputs/redecl-merge-left.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@__experimental_modules_import redecl_merge_top;
1+
@import redecl_merge_top;
22

33
@class A;
44

Diff for: test/Modules/Inputs/redecl-merge-right.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@__experimental_modules_import redecl_merge_top;
1+
@import redecl_merge_top;
22

33
@interface Super
44
@end
@@ -79,7 +79,7 @@ extern int var2;
7979
static double var3;
8080

8181
int ONE;
82-
@__experimental_modules_import redecl_merge_top.Explicit;
82+
@import redecl_merge_top.Explicit;
8383
const int one = ONE;
8484

8585
@interface ClassWithDef

Diff for: test/Modules/Inputs/templates-left.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@__experimental_modules_import templates_top;
1+
@import templates_top;
22

33
template<typename T> class Vector;
44

Diff for: test/Modules/Inputs/templates-right.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@__experimental_modules_import templates_top;
1+
@import templates_top;
22

33
template<typename T> class Vector {
44
public:
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@__experimental_modules_import A.One;
2-
@__experimental_modules_import B.One;
1+
@import A.One;
2+
@import B.One;
33

44
long *C1;
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@__experimental_modules_import A.Two;
2-
@__experimental_modules_import B.Two;
1+
@import A.Two;
2+
@import B.Two;
33

44
unsigned long *C2;

Diff for: test/Modules/build-fail-notes.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: rm -rf %t
22
// RUN: %clang_cc1 -fmodule-cache-path %t -fmodules -F %S/Inputs -DgetModuleVersion="epic fail" %s 2>&1 | FileCheck %s
33

4-
@__experimental_modules_import DependsOnModule;
4+
@import DependsOnModule;
55

66
// CHECK: While building module 'DependsOnModule' imported from
77
// CHECK: While building module 'Module' imported from
@@ -22,10 +22,10 @@
2222
// RUN: c-index-test -read-diagnostics %t/tmp.diag 2>&1 | FileCheck -check-prefix=CHECK-SDIAG %s
2323

2424
// CHECK-SDIAG: Module.h:9:13: error: expected ';' after top level declarator
25-
// CHECK-SDIAG: build-fail-notes.m:4:32: note: while building module 'DependsOnModule' imported from
25+
// CHECK-SDIAG: build-fail-notes.m:4:9: note: while building module 'DependsOnModule' imported from
2626
// CHECK-SDIAG: DependsOnModule.h:1:10: note: while building module 'Module' imported from
2727
// CHECK-SDIAG: note: expanded from here
2828
// CHECK-SDIAG: warning: umbrella header does not include header 'NotInModule.h' [-Wincomplete-umbrella]
2929
// CHECK-SDIAG: DependsOnModule.h:1:10: fatal: could not build module 'Module'
30-
// CHECK-SDIAG: build-fail-notes.m:4:32: note: while building module 'DependsOnModule' imported from
30+
// CHECK-SDIAG: build-fail-notes.m:4:9: note: while building module 'DependsOnModule' imported from
3131

Diff for: test/Modules/compiler_builtins.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
// expected-no-diagnostics
55

66
#ifdef __SSE__
7-
@__experimental_modules_import _Builtin_intrinsics.intel.sse;
7+
@import _Builtin_intrinsics.intel.sse;
88
#endif
99

1010
#ifdef __AVX2__
11-
@__experimental_modules_import _Builtin_intrinsics.intel.avx2;
11+
@import _Builtin_intrinsics.intel.avx2;
1212
#endif

Diff for: test/Modules/cstd.m

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@
22
// RUN: %clang -fsyntax-only -isystem %S/Inputs/System/usr/include -fmodules -fmodule-cache-path %t -D__need_wint_t -Werror=implicit-function-declaration %s
33

44
// Supplied by compiler, but referenced from the "/usr/include" module map.
5-
@__experimental_modules_import cstd.float_constants;
5+
@import cstd.float_constants;
66

77
float getFltMax() { return FLT_MAX; }
88

99
// Supplied by the "/usr/include" module map.
10-
@__experimental_modules_import cstd.stdio;
10+
@import cstd.stdio;
1111

1212
void test_fprintf(FILE *file) {
1313
fprintf(file, "Hello, modules\n");
1414
}
1515

1616
// Supplied by compiler, which forwards to the "/usr/include" version.
17-
@__experimental_modules_import cstd.stdint;
17+
@import cstd.stdint;
1818

1919
my_awesome_nonstandard_integer_type value;
2020

2121
// Supplied by the compiler; that version wins.
22-
@__experimental_modules_import cstd.stdbool;
22+
@import cstd.stdbool;
2323

2424
#ifndef bool
2525
# error "bool was not defined!"

Diff for: test/Modules/cycles.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// RUN: rm -rf %t
22
// RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -F %S/Inputs %s 2>&1 | FileCheck %s
33
// FIXME: When we have a syntax for modules in C, use that.
4-
@__experimental_modules_import MutuallyRecursive1;
4+
@import MutuallyRecursive1;
55

66
// CHECK: While building module 'MutuallyRecursive1' imported from
77
// CHECK: While building module 'MutuallyRecursive2' imported from
8-
// CHECK: MutuallyRecursive2.h:3:32: fatal error: cyclic dependency in module 'MutuallyRecursive1': MutuallyRecursive1 -> MutuallyRecursive2 -> MutuallyRecursive1
8+
// CHECK: MutuallyRecursive2.h:3:9: fatal error: cyclic dependency in module 'MutuallyRecursive1': MutuallyRecursive1 -> MutuallyRecursive2 -> MutuallyRecursive1
99
// CHECK: While building module 'MutuallyRecursive1' imported from
10-
// CHECK: MutuallyRecursive1.h:2:32: fatal error: could not build module 'MutuallyRecursive2'
11-
// CHECK: cycles.c:4:32: fatal error: could not build module 'MutuallyRecursive1'
10+
// CHECK: MutuallyRecursive1.h:2:9: fatal error: could not build module 'MutuallyRecursive2'
11+
// CHECK: cycles.c:4:9: fatal error: could not build module 'MutuallyRecursive1'
1212
// CHECK-NOT: error:
1313

0 commit comments

Comments
 (0)