diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2015-08-07 23:02:44 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2015-08-07 23:02:44 +0000 |
| commit | 51ece4aae5857052d224ce52277924c74685714e (patch) | |
| tree | ca13cf9e2e8c2499f61f1246e455efd2804abd36 /test/Modules | |
| parent | c192b3dcffd5e672a2b2e1730e2440febb4fb192 (diff) | |
Notes
Diffstat (limited to 'test/Modules')
33 files changed, 105 insertions, 10 deletions
diff --git a/test/Modules/Inputs/diagnostics-aux-2.modulemap b/test/Modules/Inputs/diagnostics-aux-2.modulemap new file mode 100644 index 0000000000000..8ceeb8ebdfc9f --- /dev/null +++ b/test/Modules/Inputs/diagnostics-aux-2.modulemap @@ -0,0 +1,3 @@ +module external { + blahblah +} diff --git a/test/Modules/Inputs/diagnostics-aux.modulemap b/test/Modules/Inputs/diagnostics-aux.modulemap index d067d04d3d6a4..2c6ecb93aa96e 100644 --- a/test/Modules/Inputs/diagnostics-aux.modulemap +++ b/test/Modules/Inputs/diagnostics-aux.modulemap @@ -1 +1,3 @@ module foo {} + +extern module external "diagnostics-aux-2.modulemap" diff --git a/test/Modules/Inputs/explicit-build-prefer-self/map b/test/Modules/Inputs/explicit-build-prefer-self/map index 26be8e690736e..042b2ae5b507d 100644 --- a/test/Modules/Inputs/explicit-build-prefer-self/map +++ b/test/Modules/Inputs/explicit-build-prefer-self/map @@ -1,2 +1,2 @@ -module a { header "a.h" header "x.h" } -module b { header "b.h" header "x.h" } +module a { module h { header "a.h" } module x { header "x.h" } } +module b { module h { header "b.h" } module x { header "x.h" } } diff --git a/test/Modules/Inputs/merge-template-pattern-visibility/a.h b/test/Modules/Inputs/merge-template-pattern-visibility/a.h new file mode 100644 index 0000000000000..7f9b6497e7250 --- /dev/null +++ b/test/Modules/Inputs/merge-template-pattern-visibility/a.h @@ -0,0 +1,5 @@ +template<typename, typename = int> struct A; +template<typename T> struct B; + +template<typename, typename> struct A {}; +template<typename T> struct B : A<T> {}; diff --git a/test/Modules/Inputs/merge-template-pattern-visibility/b.h b/test/Modules/Inputs/merge-template-pattern-visibility/b.h new file mode 100644 index 0000000000000..5ed18e7e7c5d9 --- /dev/null +++ b/test/Modules/Inputs/merge-template-pattern-visibility/b.h @@ -0,0 +1,9 @@ +template<typename, typename = int> struct A; +template<typename T> struct B; + +template<typename, typename> struct A {}; +template<typename T> struct B : A<T> {}; + +inline void f() { + B<int> bi; +} diff --git a/test/Modules/Inputs/merge-template-pattern-visibility/module.modulemap b/test/Modules/Inputs/merge-template-pattern-visibility/module.modulemap new file mode 100644 index 0000000000000..ba97abbaa8ecd --- /dev/null +++ b/test/Modules/Inputs/merge-template-pattern-visibility/module.modulemap @@ -0,0 +1,4 @@ +module X { + module A { header "a.h" } + module B { header "b.h" } +} diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map index ffaa53e18e288..904c65c2dbf43 100644 --- a/test/Modules/Inputs/module.map +++ b/test/Modules/Inputs/module.map @@ -336,3 +336,14 @@ module ImportNameInDir { header "ImportNameInDir.h" export * } + +module RequiresWithMissingHeader { + module HeaderBefore { + header "RequiresWithMissingHeader-Missing1.h" + requires missing + } + module HeaderAfter { + requires missing + header "RequiresWithMissingHeader-Missing2.h" + } +} diff --git a/test/Modules/Inputs/multiple-include/a.h b/test/Modules/Inputs/multiple-include/a.h new file mode 100644 index 0000000000000..8266190858888 --- /dev/null +++ b/test/Modules/Inputs/multiple-include/a.h @@ -0,0 +1 @@ +#include "x.h" diff --git a/test/Modules/Inputs/multiple-include/b.h b/test/Modules/Inputs/multiple-include/b.h new file mode 100644 index 0000000000000..f56ab64da6b1c --- /dev/null +++ b/test/Modules/Inputs/multiple-include/b.h @@ -0,0 +1,3 @@ +#pragma clang __debug macro C_H +#include "c.h" +inline int get() { return c; } diff --git a/test/Modules/Inputs/multiple-include/c.h b/test/Modules/Inputs/multiple-include/c.h new file mode 100644 index 0000000000000..4e7d4b742dc3a --- /dev/null +++ b/test/Modules/Inputs/multiple-include/c.h @@ -0,0 +1,4 @@ +#ifndef C_H +#define C_H +extern int c; +#endif diff --git a/test/Modules/Inputs/multiple-include/module.modulemap b/test/Modules/Inputs/multiple-include/module.modulemap new file mode 100644 index 0000000000000..1228ae6cbb732 --- /dev/null +++ b/test/Modules/Inputs/multiple-include/module.modulemap @@ -0,0 +1,2 @@ +module A { module a { header "a.h" } module b { header "b.h" } module c { header "c.h" } } +module X { module x { header "x.h" } module c { header "c.h" } } diff --git a/test/Modules/Inputs/multiple-include/x.h b/test/Modules/Inputs/multiple-include/x.h new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Modules/Inputs/multiple-include/x.h diff --git a/test/Modules/Inputs/namespaces-left.h b/test/Modules/Inputs/namespaces-left.h index 787fe753fba97..5badf62764b6b 100644 --- a/test/Modules/Inputs/namespaces-left.h +++ b/test/Modules/Inputs/namespaces-left.h @@ -71,3 +71,5 @@ namespace N12 { } Foo *getFoo(); } + +namespace Empty {} diff --git a/test/Modules/Inputs/namespaces-right.h b/test/Modules/Inputs/namespaces-right.h index 77f54ead65ab3..dd2ac33f9108e 100644 --- a/test/Modules/Inputs/namespaces-right.h +++ b/test/Modules/Inputs/namespaces-right.h @@ -66,3 +66,5 @@ namespace N12 { } void consumeFoo(Foo*); } + +namespace Empty {} diff --git a/test/Modules/Inputs/namespaces-top.h b/test/Modules/Inputs/namespaces-top.h index 7bf5394f55bee..006b53c8fd289 100644 --- a/test/Modules/Inputs/namespaces-top.h +++ b/test/Modules/Inputs/namespaces-top.h @@ -21,3 +21,5 @@ namespace N13 { namespace AddAndReexportBeforeImport { int S; } + +namespace Empty {} diff --git a/test/Modules/Inputs/submodules-merge-defs/defs.h b/test/Modules/Inputs/submodules-merge-defs/defs.h index bda0567c93a38..07dfac7ee657f 100644 --- a/test/Modules/Inputs/submodules-merge-defs/defs.h +++ b/test/Modules/Inputs/submodules-merge-defs/defs.h @@ -94,3 +94,6 @@ namespace MergeFunctionTemplateSpecializations { }; using xiq = X<int>::Q<int>; } + +enum ScopedEnum : int; +enum ScopedEnum : int { a, b, c }; diff --git a/test/Modules/compiler_builtins_arm.m b/test/Modules/compiler_builtins_arm.m index ccfceaa93f88e..23efa4608aa02 100644 --- a/test/Modules/compiler_builtins_arm.m +++ b/test/Modules/compiler_builtins_arm.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -fsyntax-only -triple thumbv7-none-linux-gnueabihf -target-abi aapcs -target-cpu cortex-a8 -mfloat-abi hard -std=c99 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -D__need_wint_t %s -verify // expected-no-diagnostics - +// REQUIRES: arm-registered-target @import _Builtin_intrinsics.arm.neon; diff --git a/test/Modules/dependency-gen-inferred-map.m b/test/Modules/dependency-gen-inferred-map.m index cebfeea4f40b5..053a653d1748d 100644 --- a/test/Modules/dependency-gen-inferred-map.m +++ b/test/Modules/dependency-gen-inferred-map.m @@ -1,5 +1,6 @@ // Test that the virtual file "__inferred_module.map" doesn't show up as dependency. +// REQUIRES: x86-registered-target // RUN: rm -rf %t-mcp // RUN: %clang_cc1 -isysroot %S/Inputs/System -triple x86_64-apple-darwin10 -dependency-file %t.d -MT %s.o -F %S/Inputs -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-mcp %s // RUN: FileCheck %s < %t.d diff --git a/test/Modules/dependency-gen-pch.m b/test/Modules/dependency-gen-pch.m index 697b42947afa8..4da054ff7dc83 100644 --- a/test/Modules/dependency-gen-pch.m +++ b/test/Modules/dependency-gen-pch.m @@ -1,5 +1,6 @@ // RUN: rm -rf %t-mcp // RUN: mkdir -p %t-mcp +// REQUIRES: x86-registered-target // RUN: %clang_cc1 -isysroot %S/Inputs/System -triple x86_64-apple-darwin10 -module-file-deps -dependency-file %t.d -MT %s.o -I %S/Inputs -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t-mcp -emit-pch -o %t.pch %s // RUN: FileCheck %s < %t.d diff --git a/test/Modules/diagnostics.modulemap b/test/Modules/diagnostics.modulemap index aef094d3bf646..3b5b6a5c0396c 100644 --- a/test/Modules/diagnostics.modulemap +++ b/test/Modules/diagnostics.modulemap @@ -1,5 +1,8 @@ // RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodule-map-file=%S/Inputs/diagnostics-aux.modulemap -fmodule-map-file=%s -fsyntax-only -x c++ /dev/null 2>&1 | FileCheck %s +// CHECK: In file included from {{.*}}diagnostics-aux.modulemap:3: +// CHECK: diagnostics-aux-2.modulemap:2:3: error: expected + // PR22299: Ensure we can produce diagnostics for duplicate modules from -fmodule-map-file=. // // CHECK: diagnostics.modulemap:[[@LINE+2]]:8: error: redefinition of module 'foo' diff --git a/test/Modules/irgen.c b/test/Modules/irgen.c index f09cc7b5388fe..b2eb8b5ce09a3 100644 --- a/test/Modules/irgen.c +++ b/test/Modules/irgen.c @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target // RUN: rm -rf %t // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=irgen -triple x86_64-apple-darwin10 %S/Inputs/module.map // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -I %S/Inputs -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s diff --git a/test/Modules/linkage-merge.m b/test/Modules/linkage-merge.m index 955eb1aa95eac..e7b9e5cec1367 100644 --- a/test/Modules/linkage-merge.m +++ b/test/Modules/linkage-merge.m @@ -16,8 +16,8 @@ static int f2(float); // okay: considered distinct extern int f3(float); // okay: considered distinct extern float v0; -// expected-error@-1{{redefinition of 'v0' with a different type: 'float' vs 'int'}} -// expected-note@Inputs/linkage-merge-sub.h:6{{previous definition is here}} +// expected-error@-1{{redeclaration of 'v0' with a different type: 'float' vs 'int'}} +// expected-note@Inputs/linkage-merge-sub.h:6{{previous declaration is here}} static float v1; static float v2; diff --git a/test/Modules/merge-target-features.cpp b/test/Modules/merge-target-features.cpp index 8b82c8a9789b4..938715dd6b11a 100644 --- a/test/Modules/merge-target-features.cpp +++ b/test/Modules/merge-target-features.cpp @@ -1,6 +1,6 @@ // RUN: rm -rf %t // RUN: cd %S -// +// REQUIRES: x86-registered-target // RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \ // RUN: -iquote Inputs/merge-target-features \ // RUN: -fno-implicit-modules \ diff --git a/test/Modules/merge-template-pattern-visibility.cpp b/test/Modules/merge-template-pattern-visibility.cpp new file mode 100644 index 0000000000000..db759b5a46a12 --- /dev/null +++ b/test/Modules/merge-template-pattern-visibility.cpp @@ -0,0 +1,4 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fno-modules-error-recovery \ +// RUN: -fmodule-name=X -emit-module %S/Inputs/merge-template-pattern-visibility/module.modulemap -x c++ \ +// RUN: -fmodules-local-submodule-visibility diff --git a/test/Modules/multiple-include.cpp b/test/Modules/multiple-include.cpp new file mode 100644 index 0000000000000..7cbeefc81782e --- /dev/null +++ b/test/Modules/multiple-include.cpp @@ -0,0 +1,5 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -I%S/Inputs/multiple-include -fmodules-cache-path=%t -fimplicit-module-maps -verify %s -fmodules-local-submodule-visibility +// expected-no-diagnostics +#include "b.h" +int c = get(); diff --git a/test/Modules/pch_container.m b/test/Modules/pch_container.m new file mode 100644 index 0000000000000..095245bdc3a4b --- /dev/null +++ b/test/Modules/pch_container.m @@ -0,0 +1,17 @@ +@import DependsOnModule; +// REQUIRES: x86-registered-target +// RUN: rm -rf %t-MachO %t-ELF %t-ELF_SPLIT %t-COFF +// RUN: %clang_cc1 -triple=x86_64-apple-darwin -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t-MachO -F %S/Inputs %s +// RUN: %clang_cc1 -triple=x86_64-linux-elf -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t-ELF -F %S/Inputs %s +// RUN: %clang_cc1 -triple=x86_64-windows-coff -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t-COFF -F %S/Inputs %s + +// RUN: llvm-objdump -section-headers %t-MachO/DependsOnModule.pcm %t-ELF/DependsOnModule.pcm %t-COFF/DependsOnModule.pcm | FileCheck %s +// CHECK: file format Mach-O 64-bit x86-64 +// CHECK: __clangast {{[0-9a-f]+}} {{[0-9a-f]+}} DATA +// CHECK: file format ELF64-x86-64 +// CHECK: __clangast {{[0-9a-f]+}} {{[0-9a-f]+}} DATA +// CHECK: file format COFF-x86-64 +// CHECK: clangast {{[0-9a-f]+}} {{[0-9a-f]+}} + + +// RUN: %clang_cc1 -split-dwarf-file t-split.dwo -triple=x86_64-linux-elf -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t-ELF_SPLIT -F %S/Inputs %s -o %t-split.o diff --git a/test/Modules/requires.m b/test/Modules/requires.m index 155c6aec5dc4f..1a013727108b7 100644 --- a/test/Modules/requires.m +++ b/test/Modules/requires.m @@ -6,3 +6,7 @@ @import DependsOnModule.NotObjC; // expected-error{{module 'DependsOnModule.NotObjC' is incompatible with feature 'objc'}} @import DependsOnModule.CustomReq1; // OK @import DependsOnModule.CustomReq2; // expected-error{{module 'DependsOnModule.CustomReq2' requires feature 'custom_req2'}} + +@import RequiresWithMissingHeader; // OK +@import RequiresWithMissingHeader.HeaderBefore; // expected-error{{module 'RequiresWithMissingHeader.HeaderBefore' requires feature 'missing'}} +@import RequiresWithMissingHeader.HeaderAfter; // expected-error{{module 'RequiresWithMissingHeader.HeaderAfter' requires feature 'missing'}} diff --git a/test/Modules/self-import-header.m b/test/Modules/self-import-header.m index 9b4bd5dee5201..83e5c0104d25a 100644 --- a/test/Modules/self-import-header.m +++ b/test/Modules/self-import-header.m @@ -1,5 +1,5 @@ // rdar://13840148 - +// REQUIRES: x86-registered-target // RUN: rm -rf %t // RUN: %clang -fsyntax-only -isysroot %S/Inputs/System/usr/include -fmodules -fmodules-cache-path=%t \ // RUN: -target x86_64-darwin \ diff --git a/test/Modules/signal.m b/test/Modules/signal.m index 30059e9351138..37a35506447d6 100644 --- a/test/Modules/signal.m +++ b/test/Modules/signal.m @@ -1,4 +1,4 @@ -// REQUIRES: shell +// REQUIRES: crash-recovery,shell // RUN: rm -rf %t // Crash building module. diff --git a/test/Modules/submodules-merge-defs.cpp b/test/Modules/submodules-merge-defs.cpp index 92c784440b9e4..016b8a8f47a71 100644 --- a/test/Modules/submodules-merge-defs.cpp +++ b/test/Modules/submodules-merge-defs.cpp @@ -69,6 +69,11 @@ J<> pre_j; // expected-error {{declaration of 'J' must be imported}} #endif // expected-note@defs.h:51 +{{here}} +ScopedEnum pre_scopedenum; // expected-error {{must be imported}} expected-error {{must use 'enum'}} +// expected-note@defs.h:99 {{here}} +enum ScopedEnum : int; +ScopedEnum pre_scopedenum_declared; // ok + // Make definitions from second module visible. #ifdef TEXTUAL #include "import-and-redefine.h" diff --git a/test/Modules/templates-2.mm b/test/Modules/templates-2.mm index 78d203ab42b49..9385119679cf0 100644 --- a/test/Modules/templates-2.mm +++ b/test/Modules/templates-2.mm @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++11 -x objective-c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -verify %s -Wno-objc-root-class // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++11 -x objective-c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -emit-llvm %s -o - -Wno-objc-root-class | FileCheck %s // expected-no-diagnostics - +// REQUIRES: x86-registered-target @import templates_top; struct TestEmitDefaultedSpecialMembers { diff --git a/test/Modules/templates.mm b/test/Modules/templates.mm index 503f4bb459e03..4c6e4723a3bb3 100644 --- a/test/Modules/templates.mm +++ b/test/Modules/templates.mm @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++11 -x objective-c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -verify %s -Wno-objc-root-class // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++11 -x objective-c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -emit-llvm %s -o - -Wno-objc-root-class | FileCheck %s // expected-no-diagnostics - +// REQUIRES: x86-registered-target @import templates_left; void testInlineRedeclEarly() { diff --git a/test/Modules/va_list.m b/test/Modules/va_list.m index d13b39b48f4af..aa140fb45cd48 100644 --- a/test/Modules/va_list.m +++ b/test/Modules/va_list.m @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target // RUN: rm -rf %t // RUN: %clang_cc1 -triple x86_64-apple-macosx10 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ // RUN: -fmodules-ignore-macro=PREFIX -DPREFIX -I %S/Inputs/va_list \ |
