зеркало из https://github.com/microsoft/clang-1.git
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
This commit is contained in:
Родитель
bd5da3ca59
Коммит
1b257afbae
|
@ -3218,7 +3218,7 @@ public:
|
|||
///
|
||||
/// An import declaration imports the named module (or submodule). For example:
|
||||
/// \code
|
||||
/// @__experimental_modules_import std.vector;
|
||||
/// @import std.vector;
|
||||
/// \endcode
|
||||
///
|
||||
/// Import declarations can also be implicitly generated from
|
||||
|
|
|
@ -297,11 +297,11 @@ public:
|
|||
}
|
||||
|
||||
/// \brief Determine whether this is the contextual keyword
|
||||
/// '__experimental_modules_import'.
|
||||
/// 'import'.
|
||||
bool isModulesImport() const { return IsModulesImport; }
|
||||
|
||||
/// \brief Set whether this identifier is the contextual keyword
|
||||
/// '__experimental_modules_import'.
|
||||
/// 'import'.
|
||||
void setModulesImport(bool I) {
|
||||
IsModulesImport = I;
|
||||
if (I)
|
||||
|
|
|
@ -566,7 +566,7 @@ OBJC2_AT_KEYWORD(required)
|
|||
OBJC2_AT_KEYWORD(optional)
|
||||
OBJC2_AT_KEYWORD(synthesize)
|
||||
OBJC2_AT_KEYWORD(dynamic)
|
||||
OBJC2_AT_KEYWORD(__experimental_modules_import)
|
||||
OBJC2_AT_KEYWORD(import)
|
||||
|
||||
// TODO: What to do about context-sensitive keywords like:
|
||||
// bycopy/byref/in/inout/oneway/out?
|
||||
|
|
|
@ -686,7 +686,7 @@ void DeclPrinter::VisitFileScopeAsmDecl(FileScopeAsmDecl *D) {
|
|||
}
|
||||
|
||||
void DeclPrinter::VisitImportDecl(ImportDecl *D) {
|
||||
Out << "@__experimental_modules_import " << D->getImportedModule()->getFullModuleName()
|
||||
Out << "@import " << D->getImportedModule()->getFullModuleName()
|
||||
<< ";\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ IdentifierTable::IdentifierTable(const LangOptions &LangOpts,
|
|||
|
||||
|
||||
// Add the '_experimental_modules_import' contextual keyword.
|
||||
get("__experimental_modules_import").setModulesImport(true);
|
||||
get("import").setModulesImport(true);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -1476,7 +1476,7 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc,
|
|||
Diag(HashLoc, diag::warn_auto_module_import)
|
||||
<< IncludeKind << PathString
|
||||
<< FixItHint::CreateReplacement(ReplaceRange,
|
||||
"@__experimental_modules_import " + PathString.str().str() + ";");
|
||||
"@import " + PathString.str().str() + ";");
|
||||
}
|
||||
|
||||
// Load the module.
|
||||
|
|
|
@ -631,10 +631,10 @@ void Preprocessor::HandleIdentifier(Token &Identifier) {
|
|||
if (II.isExtensionToken() && !DisableMacroExpansion)
|
||||
Diag(Identifier, diag::ext_token_used);
|
||||
|
||||
// If this is the '__experimental_modules_import' contextual keyword, note
|
||||
// If this is the 'import' contextual keyword, note
|
||||
// that the next token indicates a module name.
|
||||
//
|
||||
// Note that we do not treat '__experimental_modules_import' as a contextual
|
||||
// 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.isModulesImport() && !InMacroArgs && !DisableMacroExpansion &&
|
||||
|
|
|
@ -65,7 +65,7 @@ Parser::DeclGroupPtrTy Parser::ParseObjCAtDirectives() {
|
|||
case tok::objc_dynamic:
|
||||
SingleDecl = ParseObjCPropertyDynamic(AtLoc);
|
||||
break;
|
||||
case tok::objc___experimental_modules_import:
|
||||
case tok::objc_import:
|
||||
if (getLangOpts().Modules)
|
||||
return ParseModuleImport(AtLoc);
|
||||
|
||||
|
|
|
@ -1845,7 +1845,7 @@ void Parser::ParseMicrosoftIfExistsExternalDeclaration() {
|
|||
}
|
||||
|
||||
Parser::DeclGroupPtrTy Parser::ParseModuleImport(SourceLocation AtLoc) {
|
||||
assert(Tok.isObjCAtKeyword(tok::objc___experimental_modules_import) &&
|
||||
assert(Tok.isObjCAtKeyword(tok::objc_import) &&
|
||||
"Improper start to module import");
|
||||
SourceLocation ImportLoc = ConsumeToken();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
#include <DependsOnModule/DependsOnModule.h>
|
||||
@__experimental_modules_import DependsOnModule;
|
||||
@import DependsOnModule;
|
||||
int glob;
|
||||
|
||||
// RUN: rm -rf %t.cache
|
||||
|
@ -17,9 +17,9 @@ int glob;
|
|||
// CHECK-NEXT: Identifier: "h" [2:43 - 2:44] inclusion directive=[[INC_DIR]]
|
||||
// CHECK-NEXT: Punctuation: ">" [2:44 - 2:45] inclusion directive=[[INC_DIR]]
|
||||
// CHECK-NEXT: Punctuation: "@" [3:1 - 3:2] ModuleImport=DependsOnModule:3:1
|
||||
// CHECK-NEXT: Keyword: "__experimental_modules_import" [3:2 - 3:31] ModuleImport=DependsOnModule:3:1
|
||||
// CHECK-NEXT: Identifier: "DependsOnModule" [3:32 - 3:47] ModuleImport=DependsOnModule:3:1
|
||||
// CHECK-NEXT: Punctuation: ";" [3:47 - 3:48]
|
||||
// CHECK-NEXT: Keyword: "import" [3:2 - 3:8] ModuleImport=DependsOnModule:3:1
|
||||
// CHECK-NEXT: Identifier: "DependsOnModule" [3:9 - 3:24] ModuleImport=DependsOnModule:3:1
|
||||
// CHECK-NEXT: Punctuation: ";" [3:24 - 3:25]
|
||||
// CHECK-NEXT: Keyword: "int" [4:1 - 4:4] VarDecl=glob:4:5
|
||||
// CHECK-NEXT: Identifier: "glob" [4:5 - 4:9] VarDecl=glob:4:5
|
||||
// CHECK-NEXT: Punctuation: ";" [4:9 - 4:10]
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
// Note: the run lines follow their respective tests, since line/column
|
||||
// matter in this test.
|
||||
|
||||
@__experimental_modules_import LibA.Extensions;
|
||||
@import LibA.Extensions;
|
||||
|
||||
// RUN: rm -rf %t
|
||||
// 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
|
||||
// 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
|
||||
// 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:37 -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:14 -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)
|
||||
|
||||
|
|
|
@ -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:32:{16:2-16:37}: fatal error: could not build module 'Crash'
|
||||
// CHECK-CRASH: crash-recovery-modules.m:16:9:{16:2-16:14}: 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
|
||||
|
||||
@__experimental_modules_import Crash;
|
||||
@import Crash;
|
||||
|
||||
void test() {
|
||||
const char* error = getCrashString();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
#include <DependsOnModule/DependsOnModule.h>
|
||||
@__experimental_modules_import DependsOnModule;
|
||||
@import DependsOnModule;
|
||||
int glob;
|
||||
|
||||
// RUN: rm -rf %t.cache
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
|
||||
@__experimental_modules_import MutuallyRecursive2;
|
||||
@import MutuallyRecursive2;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
|
||||
@__experimental_modules_import MutuallyRecursive1;
|
||||
@import MutuallyRecursive1;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
@__experimental_modules_import category_left;
|
||||
@import category_left;
|
||||
|
||||
@interface Foo(Bottom)
|
||||
-(void)bottom;
|
||||
@end
|
||||
|
||||
@__experimental_modules_import category_right;
|
||||
@import category_right;
|
||||
|
||||
@interface LeftFoo(Bottom)
|
||||
-(void)bottom;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@__experimental_modules_import category_top;
|
||||
@import category_top;
|
||||
|
||||
@interface Foo(Left)
|
||||
-(void)left;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@__experimental_modules_import category_top;
|
||||
@import category_top;
|
||||
|
||||
@interface Foo(Other)
|
||||
-(void)other;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@__experimental_modules_import category_top;
|
||||
@import category_top;
|
||||
|
||||
@interface Foo(Right1)
|
||||
-(void)right1;
|
||||
|
|
|
@ -1 +1 @@
|
|||
@__experimental_modules_import diamond_bottom;
|
||||
@import diamond_bottom;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@__experimental_modules_import diamond_left;
|
||||
@__experimental_modules_import diamond_right;
|
||||
@import diamond_left;
|
||||
@import diamond_right;
|
||||
|
||||
char bottom(char *x);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@__experimental_modules_import diamond_top;
|
||||
@import diamond_top;
|
||||
|
||||
float left(float *);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@__experimental_modules_import diamond_top;
|
||||
@import diamond_top;
|
||||
|
||||
double right(double *);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@__experimental_modules_import macros_top;
|
||||
@import macros_top;
|
||||
#define LEFT unsigned long
|
||||
|
||||
#undef TOP_LEFT_UNDEF
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@__experimental_modules_import macros_top;
|
||||
@import macros_top;
|
||||
#define RIGHT unsigned short
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@__experimental_modules_import namespaces_top;
|
||||
@import namespaces_top;
|
||||
|
||||
namespace N1 { }
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@__experimental_modules_import namespaces_top;
|
||||
@import namespaces_top;
|
||||
|
||||
namespace N2 { }
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
@__experimental_modules_import redecl_merge_left;
|
||||
@import redecl_merge_left;
|
||||
|
||||
@class C4;
|
||||
@class C4;
|
||||
@protocol P4;
|
||||
@protocol P4;
|
||||
@protocol P4;
|
||||
@__experimental_modules_import redecl_merge_right;
|
||||
@import redecl_merge_right;
|
||||
|
||||
@class B;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@__experimental_modules_import redecl_merge_left;
|
||||
@import redecl_merge_left;
|
||||
|
||||
@class C4;
|
||||
void accept_a_C4(C4*);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@__experimental_modules_import redecl_merge_top;
|
||||
@import redecl_merge_top;
|
||||
|
||||
@class A;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@__experimental_modules_import redecl_merge_top;
|
||||
@import redecl_merge_top;
|
||||
|
||||
@interface Super
|
||||
@end
|
||||
|
@ -79,7 +79,7 @@ extern int var2;
|
|||
static double var3;
|
||||
|
||||
int ONE;
|
||||
@__experimental_modules_import redecl_merge_top.Explicit;
|
||||
@import redecl_merge_top.Explicit;
|
||||
const int one = ONE;
|
||||
|
||||
@interface ClassWithDef
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@__experimental_modules_import templates_top;
|
||||
@import templates_top;
|
||||
|
||||
template<typename T> class Vector;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@__experimental_modules_import templates_top;
|
||||
@import templates_top;
|
||||
|
||||
template<typename T> class Vector {
|
||||
public:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@__experimental_modules_import A.One;
|
||||
@__experimental_modules_import B.One;
|
||||
@import A.One;
|
||||
@import B.One;
|
||||
|
||||
long *C1;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@__experimental_modules_import A.Two;
|
||||
@__experimental_modules_import B.Two;
|
||||
@import A.Two;
|
||||
@import B.Two;
|
||||
|
||||
unsigned long *C2;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -fmodule-cache-path %t -fmodules -F %S/Inputs -DgetModuleVersion="epic fail" %s 2>&1 | FileCheck %s
|
||||
|
||||
@__experimental_modules_import DependsOnModule;
|
||||
@import DependsOnModule;
|
||||
|
||||
// CHECK: While building module 'DependsOnModule' imported from
|
||||
// CHECK: While building module 'Module' imported from
|
||||
|
@ -22,10 +22,10 @@ extern int Module;
|
|||
// RUN: c-index-test -read-diagnostics %t/tmp.diag 2>&1 | FileCheck -check-prefix=CHECK-SDIAG %s
|
||||
|
||||
// CHECK-SDIAG: Module.h:9:13: error: expected ';' after top level declarator
|
||||
// CHECK-SDIAG: build-fail-notes.m:4:32: note: while building module 'DependsOnModule' imported from
|
||||
// CHECK-SDIAG: build-fail-notes.m:4:9: note: while building module 'DependsOnModule' imported from
|
||||
// CHECK-SDIAG: DependsOnModule.h:1:10: note: while building module 'Module' imported from
|
||||
// CHECK-SDIAG: note: expanded from here
|
||||
// CHECK-SDIAG: warning: umbrella header does not include header 'NotInModule.h' [-Wincomplete-umbrella]
|
||||
// CHECK-SDIAG: DependsOnModule.h:1:10: fatal: could not build module 'Module'
|
||||
// CHECK-SDIAG: build-fail-notes.m:4:32: note: while building module 'DependsOnModule' imported from
|
||||
// CHECK-SDIAG: build-fail-notes.m:4:9: note: while building module 'DependsOnModule' imported from
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
// expected-no-diagnostics
|
||||
|
||||
#ifdef __SSE__
|
||||
@__experimental_modules_import _Builtin_intrinsics.intel.sse;
|
||||
@import _Builtin_intrinsics.intel.sse;
|
||||
#endif
|
||||
|
||||
#ifdef __AVX2__
|
||||
@__experimental_modules_import _Builtin_intrinsics.intel.avx2;
|
||||
@import _Builtin_intrinsics.intel.avx2;
|
||||
#endif
|
||||
|
|
|
@ -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.
|
||||
@__experimental_modules_import cstd.float_constants;
|
||||
@import cstd.float_constants;
|
||||
|
||||
float getFltMax() { return FLT_MAX; }
|
||||
|
||||
// Supplied by the "/usr/include" module map.
|
||||
@__experimental_modules_import cstd.stdio;
|
||||
@import cstd.stdio;
|
||||
|
||||
void test_fprintf(FILE *file) {
|
||||
fprintf(file, "Hello, modules\n");
|
||||
}
|
||||
|
||||
// Supplied by compiler, which forwards to the "/usr/include" version.
|
||||
@__experimental_modules_import cstd.stdint;
|
||||
@import cstd.stdint;
|
||||
|
||||
my_awesome_nonstandard_integer_type value;
|
||||
|
||||
// Supplied by the compiler; that version wins.
|
||||
@__experimental_modules_import cstd.stdbool;
|
||||
@import cstd.stdbool;
|
||||
|
||||
#ifndef bool
|
||||
# error "bool was not defined!"
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
// 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.
|
||||
@__experimental_modules_import MutuallyRecursive1;
|
||||
@import MutuallyRecursive1;
|
||||
|
||||
// CHECK: While building module 'MutuallyRecursive1' imported from
|
||||
// CHECK: While building module 'MutuallyRecursive2' imported from
|
||||
// CHECK: MutuallyRecursive2.h:3:32: fatal error: cyclic dependency in module 'MutuallyRecursive1': MutuallyRecursive1 -> MutuallyRecursive2 -> MutuallyRecursive1
|
||||
// CHECK: MutuallyRecursive2.h:3:9: fatal error: cyclic dependency in module 'MutuallyRecursive1': MutuallyRecursive1 -> MutuallyRecursive2 -> MutuallyRecursive1
|
||||
// CHECK: While building module 'MutuallyRecursive1' imported from
|
||||
// CHECK: MutuallyRecursive1.h:2:32: fatal error: could not build module 'MutuallyRecursive2'
|
||||
// CHECK: cycles.c:4:32: fatal error: could not build module '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-NOT: error:
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
|
||||
// in other file: expected-note{{previous definition is here}}
|
||||
|
||||
@__experimental_modules_import decldef;
|
||||
@import decldef;
|
||||
A *a1; // expected-error{{unknown type name 'A'}}
|
||||
B *b1; // expected-error{{unknown type name 'B'}}
|
||||
@__experimental_modules_import decldef.Decl;
|
||||
@import decldef.Decl;
|
||||
|
||||
A *a2;
|
||||
B *b;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
// in diamond-bottom.h: expected-note{{passing argument to parameter 'x' here}}
|
||||
|
||||
@__experimental_modules_import diamond_bottom;
|
||||
@import diamond_bottom;
|
||||
|
||||
void test_diamond(int i, float f, double d, char c) {
|
||||
top(&i);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -fmodule-cache-path %t -fmodules -F %S/Inputs -DgetModuleVersion="epic fail" %s 2>&1 | FileCheck %s
|
||||
|
||||
@__experimental_modules_import Module;
|
||||
@__experimental_modules_import DependsOnModule;
|
||||
@import Module;
|
||||
@import DependsOnModule;
|
||||
|
||||
// CHECK: While building module 'Module' imported from
|
||||
// CHECK: error: expected ';' after top level declarator
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
// expected-no-diagnostics
|
||||
|
||||
#import "point.h"
|
||||
@__experimental_modules_import Module;
|
||||
@import Module;
|
||||
#import "point.h"
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// RUN: %clang -fmodule-cache-path %t -fmodules -x objective-c -I %S/Inputs -emit-ast -o %t.ast %s
|
||||
// RUN: %clang_cc1 -ast-print -x ast - < %t.ast | FileCheck %s
|
||||
|
||||
@__experimental_modules_import import_decl;
|
||||
@import import_decl;
|
||||
// CHECK: struct T
|
||||
|
||||
int main() {
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
|
||||
#include <NotAModule/NotAModule.h>
|
||||
|
||||
@__experimental_modules_import NotAModule; // expected-error{{module 'NotAModule' not found}}
|
||||
@import NotAModule; // expected-error{{module 'NotAModule' not found}}
|
||||
|
||||
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
// RUN: %clang_cc1 -x objective-c -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs %s -verify
|
||||
// expected-no-diagnostics
|
||||
|
||||
@__experimental_modules_import Module.Sub;
|
||||
@import Module.Sub;
|
||||
|
||||
void test_Module_Sub() {
|
||||
int *ip = Module_Sub;
|
||||
}
|
||||
|
||||
@__experimental_modules_import Module.Buried.Treasure;
|
||||
@import Module.Buried.Treasure;
|
||||
|
||||
void dig() {
|
||||
unsigned *up = Buried_Treasure;
|
||||
|
|
|
@ -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.
|
||||
|
||||
@__experimental_modules_import irgen;
|
||||
@import irgen;
|
||||
|
||||
// CHECK: define void @triple_value
|
||||
void triple_value(int *px) {
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#ifdef NONEXISTENT
|
||||
@__experimental_modules_import load_nonexistent;
|
||||
@import load_nonexistent;
|
||||
#endif
|
||||
|
||||
#ifdef FAILURE
|
||||
@__experimental_modules_import load_failure;
|
||||
@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:32: fatal error: module 'load_nonexistent' not found
|
||||
// CHECK-NONEXISTENT: load_failure.c:2:9: 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
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
#define import @__experimental_modules_import
|
||||
#define import @import
|
||||
import lookup_left_cxx;
|
||||
#undef import
|
||||
#define IMPORT(X) @__experimental_modules_import X
|
||||
#define IMPORT(X) @import X
|
||||
IMPORT(lookup_right_cxx);
|
||||
|
||||
// in lookup_left.hpp: expected-warning@3 {{weak identifier 'weak_identifier' never declared}}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
// lookup_left.h: expected-note{{using}}
|
||||
// lookup_right.h: expected-note{{also found}}
|
||||
@__experimental_modules_import lookup_left_objc;
|
||||
@__experimental_modules_import lookup_right_objc;
|
||||
@import lookup_left_objc;
|
||||
@import lookup_right_objc;
|
||||
|
||||
void test(id x) {
|
||||
[x method]; // expected-warning{{multiple methods named 'method' found}}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
// expected-note{{other definition of 'TOP_RIGHT_REDEF'}}
|
||||
|
||||
@__experimental_modules_import macros;
|
||||
@import macros;
|
||||
|
||||
#ifndef INTEGER
|
||||
# error INTEGER macro should be visible
|
||||
|
@ -65,7 +65,7 @@ void f() {
|
|||
#endif
|
||||
|
||||
// Import left module (which also imports top)
|
||||
@__experimental_modules_import macros_left;
|
||||
@import macros_left;
|
||||
|
||||
#ifndef LEFT
|
||||
# error LEFT should be visible
|
||||
|
@ -91,7 +91,7 @@ void test1() {
|
|||
#define LEFT_RIGHT_DIFFERENT2 double // FIXME: expected-warning{{'LEFT_RIGHT_DIFFERENT2' macro redefined}}
|
||||
|
||||
// Import right module (which also imports top)
|
||||
@__experimental_modules_import macros_right;
|
||||
@import macros_right;
|
||||
|
||||
#undef LEFT_RIGHT_DIFFERENT3
|
||||
|
||||
|
@ -130,7 +130,7 @@ void test3() {
|
|||
# error TOP_RIGHT_UNDEF should still be defined
|
||||
#endif
|
||||
|
||||
@__experimental_modules_import macros_right.undef;
|
||||
@import macros_right.undef;
|
||||
|
||||
#ifdef TOP_RIGHT_UNDEF
|
||||
# error TOP_RIGHT_UNDEF should not be defined
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -fmodule-cache-path %t -fmodules -I %S/Inputs %s -verify
|
||||
|
||||
@__experimental_modules_import MethodPoolA;
|
||||
@import MethodPoolA;
|
||||
|
||||
|
||||
// in other file: // expected-note{{using}}
|
||||
|
@ -19,7 +19,7 @@ void testMethod2(id object) {
|
|||
[object method2:1];
|
||||
}
|
||||
|
||||
@__experimental_modules_import MethodPoolB;
|
||||
@import MethodPoolB;
|
||||
|
||||
void testMethod1Again(id object) {
|
||||
[object method1];
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// RUN: echo 'int getA(); int getA2();' > %t/include/A.h
|
||||
// RUN: %clang_cc1 -fmodule-cache-path %t/cache -fmodules -I %t/include %s -verify
|
||||
|
||||
@__experimental_modules_import B;
|
||||
@import B;
|
||||
|
||||
int getValue() { return getA() + getB(); }
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
@__experimental_modules_import module_private_left;
|
||||
@__experimental_modules_import 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
|
||||
|
|
|
@ -11,8 +11,8 @@ namespace N6 {
|
|||
|
||||
namespace N8 { }
|
||||
|
||||
@__experimental_modules_import namespaces_left;
|
||||
@__experimental_modules_import namespaces_right;
|
||||
@import namespaces_left;
|
||||
@import namespaces_right;
|
||||
|
||||
void test() {
|
||||
int &ir1 = N1::f(1);
|
||||
|
|
|
@ -8,7 +8,7 @@ int getUmbrella() {
|
|||
return umbrella + umbrella_sub;
|
||||
}
|
||||
|
||||
@__experimental_modules_import Umbrella2;
|
||||
@import Umbrella2;
|
||||
|
||||
#include "a1.h"
|
||||
#include "b1.h"
|
||||
|
@ -18,7 +18,7 @@ int test() {
|
|||
return a1 + b1 + nested2;
|
||||
}
|
||||
|
||||
@__experimental_modules_import nested_umbrella.a;
|
||||
@import nested_umbrella.a;
|
||||
|
||||
int testNestedUmbrellaA() {
|
||||
return nested_umbrella_a;
|
||||
|
@ -28,17 +28,17 @@ int testNestedUmbrellaBFail() {
|
|||
return nested_umbrella_b; // expected-error{{use of undeclared identifier 'nested_umbrella_b'; did you mean 'nested_umbrella_a'?}}
|
||||
}
|
||||
|
||||
@__experimental_modules_import nested_umbrella.b;
|
||||
@import nested_umbrella.b;
|
||||
|
||||
int testNestedUmbrellaB() {
|
||||
return nested_umbrella_b;
|
||||
}
|
||||
|
||||
@__experimental_modules_import nested_umbrella.a_extras;
|
||||
@import nested_umbrella.a_extras;
|
||||
|
||||
@__experimental_modules_import nested_umbrella._1;
|
||||
@import nested_umbrella._1;
|
||||
|
||||
@__experimental_modules_import nested_umbrella.decltype_;
|
||||
@import nested_umbrella.decltype_;
|
||||
|
||||
int testSanitizedName() {
|
||||
return extra_a + one + decltype_val;
|
||||
|
|
|
@ -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
|
||||
|
||||
@__experimental_modules_import category_bottom;
|
||||
@import category_bottom;
|
||||
|
||||
|
||||
|
||||
|
@ -34,7 +34,7 @@ void test(Foo *foo, LeftFoo *leftFoo) {
|
|||
|
||||
// Load another module that also adds categories to Foo, verify that
|
||||
// we see those categories.
|
||||
@__experimental_modules_import category_other;
|
||||
@import category_other;
|
||||
|
||||
void test_other(Foo *foo) {
|
||||
[foo other];
|
||||
|
|
|
@ -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
|
||||
|
||||
@__experimental_modules_import Module; // expected-warning{{building module 'Module' from source}}
|
||||
@import Module; // expected-warning{{building module 'Module' from source}}
|
||||
|
||||
|
|
|
@ -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
|
||||
@__experimental_modules_import Module;
|
||||
@import Module;
|
||||
@interface OtherClass
|
||||
@end
|
||||
|
||||
|
@ -19,6 +19,6 @@ void test_getModuleVersion() {
|
|||
# error MODULE_SUBFRAMEWORK_H should be hidden
|
||||
#endif
|
||||
|
||||
@__experimental_modules_import subdir;
|
||||
@import subdir;
|
||||
|
||||
const char *getSubdirTest() { return getSubdir(); }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -F %S/Inputs -verify %s
|
||||
// expected-no-diagnostics
|
||||
|
||||
@__experimental_modules_import CmdLine;
|
||||
@import CmdLine;
|
||||
|
||||
void test() {
|
||||
#ifdef FOO_RETURNS_INT_PTR
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
@class C2;
|
||||
@class C3;
|
||||
@class C3;
|
||||
@__experimental_modules_import redecl_merge_left;
|
||||
@import redecl_merge_left;
|
||||
typedef struct my_struct_type *my_struct_ref;
|
||||
@protocol P4;
|
||||
@class C3;
|
||||
@class C3;
|
||||
@__experimental_modules_import redecl_merge_right;
|
||||
@import redecl_merge_right;
|
||||
|
||||
@implementation A
|
||||
- (Super*)init { return self; }
|
||||
|
@ -112,7 +112,7 @@ C4 *global_C4;
|
|||
|
||||
ClassWithDef *cwd1;
|
||||
|
||||
@__experimental_modules_import redecl_merge_left_left;
|
||||
@import redecl_merge_left_left;
|
||||
|
||||
void test_C4a(C4 *c4) {
|
||||
global_C4 = c4 = get_a_C4();
|
||||
|
@ -123,7 +123,7 @@ void test_ClassWithDef(ClassWithDef *cwd) {
|
|||
[cwd method];
|
||||
}
|
||||
|
||||
@__experimental_modules_import redecl_merge_bottom;
|
||||
@import redecl_merge_bottom;
|
||||
|
||||
void test_C4b() {
|
||||
if (&refers_to_C4) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
@__experimental_modules_import redecl_namespaces_left;
|
||||
@__experimental_modules_import redecl_namespaces_right;
|
||||
@import redecl_namespaces_left;
|
||||
@import redecl_namespaces_right;
|
||||
|
||||
void test() {
|
||||
A::i;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
@__experimental_modules_import redeclarations_left;
|
||||
@__experimental_modules_import redeclarations_right;
|
||||
@import redeclarations_left;
|
||||
@import redeclarations_right;
|
||||
|
||||
@interface MyObject : NSObject
|
||||
@end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs %s -verify
|
||||
|
||||
@__experimental_modules_import DependsOnModule.CXX; // expected-error{{module 'DependsOnModule.CXX' requires feature 'cplusplus'}}
|
||||
@import DependsOnModule.CXX; // expected-error{{module 'DependsOnModule.CXX' requires feature 'cplusplus'}}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
@__experimental_modules_import DependsOnModule;
|
||||
@import DependsOnModule;
|
||||
|
||||
void testSubFramework() {
|
||||
float *sf1 = sub_framework; // expected-error{{use of undeclared identifier 'sub_framework'}}
|
||||
}
|
||||
|
||||
@__experimental_modules_import DependsOnModule.SubFramework;
|
||||
@import DependsOnModule.SubFramework;
|
||||
|
||||
void testSubFrameworkAgain() {
|
||||
float *sf2 = sub_framework;
|
||||
|
@ -16,7 +16,7 @@ void testSubFrameworkAgain() {
|
|||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
@__experimental_modules_import DependsOnModule.CXX;
|
||||
@import DependsOnModule.CXX;
|
||||
|
||||
CXXOnly cxxonly;
|
||||
#endif
|
||||
|
|
|
@ -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.
|
||||
|
||||
@__experimental_modules_import std.vector;
|
||||
@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
|
||||
|
||||
@__experimental_modules_import 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)
|
||||
|
@ -30,9 +30,9 @@
|
|||
# error HAVE_HASH_MAP macro is available (but shouldn't be)
|
||||
#endif
|
||||
|
||||
@__experimental_modules_import 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'}}
|
||||
|
||||
@__experimental_modules_import std; // import everything in 'std'
|
||||
@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
|
||||
|
||||
@__experimental_modules_import std.hash_map;
|
||||
@import std.hash_map;
|
||||
|
||||
#ifndef HAVE_VECTOR
|
||||
# error HAVE_VECTOR macro is not available (but should be)
|
||||
|
|
|
@ -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.
|
||||
|
||||
@__experimental_modules_import std.vector;
|
||||
@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}}
|
||||
|
||||
@__experimental_modules_import 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;
|
||||
|
||||
@__experimental_modules_import 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'}}
|
||||
|
||||
@__experimental_modules_import 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}}
|
||||
|
||||
@__experimental_modules_import std.hash_map;
|
||||
@import std.hash_map;
|
||||
|
||||
hash_map<int, float> ints_to_floats2;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// expected-no-diagnostics
|
||||
|
||||
// Note: transitively imports Module.Sub2.
|
||||
@__experimental_modules_import Module.Sub;
|
||||
@import Module.Sub;
|
||||
|
||||
int getValue() {
|
||||
return *Module_Sub + *Module_Sub2;
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodule-cache-path %t -I %S/Inputs -emit-llvm %s -o - -Wno-objc-root-class | grep Emit | FileCheck %s
|
||||
// expected-no-diagnostics
|
||||
|
||||
@__experimental_modules_import templates_left;
|
||||
@__experimental_modules_import templates_right;
|
||||
@import templates_left;
|
||||
@import templates_right;
|
||||
|
||||
|
||||
void testTemplateClasses() {
|
||||
|
|
|
@ -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.
|
||||
|
||||
@__experimental_modules_import C.One;
|
||||
@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'}}
|
||||
}
|
||||
|
||||
@__experimental_modules_import C.Two;
|
||||
@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;
|
||||
}
|
||||
|
||||
@__experimental_modules_import B.One;
|
||||
@import B.One;
|
||||
|
||||
void test_B_One() {
|
||||
short *B1_ptr = B1;
|
||||
|
|
Загрузка…
Ссылка в новой задаче