diff options
Diffstat (limited to 'test/Modules')
36 files changed, 218 insertions, 29 deletions
diff --git a/test/Modules/Inputs/DebugModule.h b/test/Modules/Inputs/DebugModule.h new file mode 100644 index 0000000..5612b73 --- /dev/null +++ b/test/Modules/Inputs/DebugModule.h @@ -0,0 +1 @@ +@class F; diff --git a/test/Modules/Inputs/ImportNameInDir.h b/test/Modules/Inputs/ImportNameInDir.h new file mode 100644 index 0000000..ae7b1a0 --- /dev/null +++ b/test/Modules/Inputs/ImportNameInDir.h @@ -0,0 +1,4 @@ +#import <NameInDir/NameInDir.h> + +// Don't crash. +#undef NAME_IN_DIR diff --git a/test/Modules/Inputs/NameInDir.framework/Headers/NameInDir.h b/test/Modules/Inputs/NameInDir.framework/Headers/NameInDir.h new file mode 100644 index 0000000..bea2391 --- /dev/null +++ b/test/Modules/Inputs/NameInDir.framework/Headers/NameInDir.h @@ -0,0 +1,2 @@ +// NameInDir.h +#define NAME_IN_DIR 1 diff --git a/test/Modules/Inputs/NameInDir.framework/Modules/module.modulemap b/test/Modules/Inputs/NameInDir.framework/Modules/module.modulemap new file mode 100644 index 0000000..48e1c56 --- /dev/null +++ b/test/Modules/Inputs/NameInDir.framework/Modules/module.modulemap @@ -0,0 +1,5 @@ +framework module NameInModMap { + umbrella header "NameInDir.h" + export * + module * { export * } +} diff --git a/test/Modules/Inputs/NameInDir2.framework/Headers/NameInDir2.h b/test/Modules/Inputs/NameInDir2.framework/Headers/NameInDir2.h new file mode 100644 index 0000000..6dc3eea --- /dev/null +++ b/test/Modules/Inputs/NameInDir2.framework/Headers/NameInDir2.h @@ -0,0 +1 @@ +// NameInDir2.h diff --git a/test/Modules/Inputs/NameInDir2.framework/Modules/module.modulemap b/test/Modules/Inputs/NameInDir2.framework/Modules/module.modulemap new file mode 100644 index 0000000..24f15f8 --- /dev/null +++ b/test/Modules/Inputs/NameInDir2.framework/Modules/module.modulemap @@ -0,0 +1,5 @@ +framework module NameInDir2 { + umbrella header "NameInDir2.h" + export * + module * { export * } +} diff --git a/test/Modules/Inputs/NameInDirInferred.framework/Headers/NameInDirInferred.h b/test/Modules/Inputs/NameInDirInferred.framework/Headers/NameInDirInferred.h new file mode 100644 index 0000000..c0b12e6 --- /dev/null +++ b/test/Modules/Inputs/NameInDirInferred.framework/Headers/NameInDirInferred.h @@ -0,0 +1 @@ +// NameInDirInferred.h diff --git a/test/Modules/Inputs/crash.h b/test/Modules/Inputs/crash.h new file mode 100644 index 0000000..bc878fb --- /dev/null +++ b/test/Modules/Inputs/crash.h @@ -0,0 +1 @@ +#pragma clang __debug crash diff --git a/test/Modules/Inputs/explicit-build-prefer-self/a.h b/test/Modules/Inputs/explicit-build-prefer-self/a.h new file mode 100644 index 0000000..d457612 --- /dev/null +++ b/test/Modules/Inputs/explicit-build-prefer-self/a.h @@ -0,0 +1,2 @@ +// a +#include "x.h" diff --git a/test/Modules/Inputs/explicit-build-prefer-self/b.h b/test/Modules/Inputs/explicit-build-prefer-self/b.h new file mode 100644 index 0000000..76e2042 --- /dev/null +++ b/test/Modules/Inputs/explicit-build-prefer-self/b.h @@ -0,0 +1,2 @@ +// b +#include "x.h" diff --git a/test/Modules/Inputs/explicit-build-prefer-self/map b/test/Modules/Inputs/explicit-build-prefer-self/map new file mode 100644 index 0000000..26be8e6 --- /dev/null +++ b/test/Modules/Inputs/explicit-build-prefer-self/map @@ -0,0 +1,2 @@ +module a { header "a.h" header "x.h" } +module b { header "b.h" header "x.h" } diff --git a/test/Modules/Inputs/explicit-build-prefer-self/x.h b/test/Modules/Inputs/explicit-build-prefer-self/x.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Modules/Inputs/explicit-build-prefer-self/x.h diff --git a/test/Modules/Inputs/merge-class-definition-visibility/b.h b/test/Modules/Inputs/merge-class-definition-visibility/b.h index 2b8f5f8..03c0ad9 100644 --- a/test/Modules/Inputs/merge-class-definition-visibility/b.h +++ b/test/Modules/Inputs/merge-class-definition-visibility/b.h @@ -1,2 +1,4 @@ // Include definition of A into the same module as c.h #include "a.h" + +struct B {}; diff --git a/test/Modules/Inputs/merge-class-definition-visibility/d.h b/test/Modules/Inputs/merge-class-definition-visibility/d.h index 2243de1..c51edab 100644 --- a/test/Modules/Inputs/merge-class-definition-visibility/d.h +++ b/test/Modules/Inputs/merge-class-definition-visibility/d.h @@ -1 +1 @@ -#include "a.h" +struct B {}; diff --git a/test/Modules/Inputs/merge-class-definition-visibility/e.h b/test/Modules/Inputs/merge-class-definition-visibility/e.h new file mode 100644 index 0000000..f126b50 --- /dev/null +++ b/test/Modules/Inputs/merge-class-definition-visibility/e.h @@ -0,0 +1,3 @@ +#include "a.h" + +struct B {}; diff --git a/test/Modules/Inputs/merge-class-definition-visibility/modmap b/test/Modules/Inputs/merge-class-definition-visibility/modmap index 7d988fb..dcb6587 100644 --- a/test/Modules/Inputs/merge-class-definition-visibility/modmap +++ b/test/Modules/Inputs/merge-class-definition-visibility/modmap @@ -3,5 +3,6 @@ module Def1 { module C { header "c.h" } } module Def2 { - header "d.h" + module D { header "d.h" } + module E { header "e.h" } } diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map index 8ec3e21..ffaa53e 100644 --- a/test/Modules/Inputs/module.map +++ b/test/Modules/Inputs/module.map @@ -324,3 +324,15 @@ module recursive1 { module recursive2 { header "recursive2.h" } +module crash { + header "crash.h" +} + +module DebugModule { + header "DebugModule.h" +} + +module ImportNameInDir { + header "ImportNameInDir.h" + export * +} diff --git a/test/Modules/Inputs/submodule-visibility/a.h b/test/Modules/Inputs/submodule-visibility/a.h index d8805c9..e4965d7 100644 --- a/test/Modules/Inputs/submodule-visibility/a.h +++ b/test/Modules/Inputs/submodule-visibility/a.h @@ -1 +1,9 @@ int n; + +#ifdef B +#error B is defined +#endif + +#define A + +#include "c.h" diff --git a/test/Modules/Inputs/submodule-visibility/b.h b/test/Modules/Inputs/submodule-visibility/b.h index fa419c0..67ef652 100644 --- a/test/Modules/Inputs/submodule-visibility/b.h +++ b/test/Modules/Inputs/submodule-visibility/b.h @@ -1 +1,10 @@ int m = n; + +#include "other.h" +#include "c.h" + +#if defined(A) && !defined(ALLOW_NAME_LEAKAGE) +#error A is defined +#endif + +#define B diff --git a/test/Modules/Inputs/submodule-visibility/c.h b/test/Modules/Inputs/submodule-visibility/c.h new file mode 100644 index 0000000..259b8c7 --- /dev/null +++ b/test/Modules/Inputs/submodule-visibility/c.h @@ -0,0 +1,6 @@ +#ifndef C_H_INCLUDED +#define C_H_INCLUDED + +struct C {}; + +#endif diff --git a/test/Modules/Inputs/submodule-visibility/module.modulemap b/test/Modules/Inputs/submodule-visibility/module.modulemap index 2e13344..d2f0c77 100644 --- a/test/Modules/Inputs/submodule-visibility/module.modulemap +++ b/test/Modules/Inputs/submodule-visibility/module.modulemap @@ -1,4 +1,5 @@ module x { module a { header "a.h" } module b { header "b.h" } } +module other { header "other.h" } module cycles { module cycle1 { header "cycle1.h" } diff --git a/test/Modules/Inputs/submodule-visibility/other.h b/test/Modules/Inputs/submodule-visibility/other.h new file mode 100644 index 0000000..f40c757 --- /dev/null +++ b/test/Modules/Inputs/submodule-visibility/other.h @@ -0,0 +1 @@ +#include "c.h" diff --git a/test/Modules/Inputs/submodules-merge-defs/defs.h b/test/Modules/Inputs/submodules-merge-defs/defs.h index 247b05c..bda0567 100644 --- a/test/Modules/Inputs/submodules-merge-defs/defs.h +++ b/test/Modules/Inputs/submodules-merge-defs/defs.h @@ -10,6 +10,7 @@ public: // Check that lookup and access checks are performed in the right context. struct B::Inner2 : Inner1 {}; template<typename T> void B::f() {} +template<> inline void B::f<int>() {} // Check that base-specifiers are correctly disambiguated. template<int N> struct C_Base { struct D { constexpr operator int() const { return 0; } }; }; @@ -31,7 +32,8 @@ template<typename T> struct F { template<typename T> int F<T>::f() { return 0; } template<typename T> template<typename U> int F<T>::g() { return 0; } template<typename T> int F<T>::n = 0; -//template<> template<typename U> int F<char>::g() { return 0; } // FIXME: Re-enable this once we support merging member specializations. +template<> inline int F<char>::f() { return 0; } +template<> template<typename U> int F<char>::g() { return 0; } template<> struct F<void> { int h(); }; inline int F<void>::h() { return 0; } template<typename T> struct F<T *> { int i(); }; @@ -74,3 +76,21 @@ namespace FriendDefArg { template<typename, int, template<typename> class> friend struct D; }; } + +namespace SeparateInline { + inline void f(); + void f() {} + constexpr int g() { return 0; } +} + +namespace TrailingAttributes { + template<typename T> struct X {} __attribute__((aligned(8))); +} + +namespace MergeFunctionTemplateSpecializations { + template<typename T> T f(); + template<typename T> struct X { + template<typename U> using Q = decltype(f<T>() + U()); + }; + using xiq = X<int>::Q<int>; +} diff --git a/test/Modules/cxx-irgen.cpp b/test/Modules/cxx-irgen.cpp index 37de23f..7cdb0d6 100644 --- a/test/Modules/cxx-irgen.cpp +++ b/test/Modules/cxx-irgen.cpp @@ -12,7 +12,7 @@ CtorInit<int> x; // Keep these two namespace definitions separate; merging them hides the bug. namespace EmitInlineMethods { - // CHECK-DAG: define linkonce_odr [[CC:(x86_thiscallcc[ ]+)?]]void @_ZN17EmitInlineMethods1C1fEPNS_1AE( + // CHECK-DAG: define linkonce_odr [[CC:([0-9_a-z]*cc[ ]+)?]]void @_ZN17EmitInlineMethods1C1fEPNS_1AE( // CHECK-DAG: declare [[CC]]void @_ZN17EmitInlineMethods1A1gEv( struct C { __attribute__((used)) void f(A *p) { p->g(); } @@ -26,14 +26,14 @@ namespace EmitInlineMethods { }; } -// CHECK-DAG: define available_externally hidden {{signext i32|i32}} @_ZN1SIiE1gEv({{.*}} #[[ALWAYS_INLINE:.*]] align +// CHECK-DAG: define available_externally hidden {{.*}}{{signext i32|i32}} @_ZN1SIiE1gEv({{.*}} #[[ALWAYS_INLINE:.*]] align int a = S<int>::g(); int b = h(); -// CHECK-DAG: define linkonce_odr {{signext i32|i32}} @_Z3minIiET_S0_S0_(i32 +// CHECK-DAG: define linkonce_odr {{.*}}{{signext i32|i32}} @_Z3minIiET_S0_S0_(i32 int c = min(1, 2); -// CHECK: define available_externally {{signext i32|i32}} @_ZN1SIiE1fEv({{.*}} #[[ALWAYS_INLINE]] align +// CHECK: define available_externally {{.*}}{{signext i32|i32}} @_ZN1SIiE1fEv({{.*}} #[[ALWAYS_INLINE]] align namespace ImplicitSpecialMembers { // CHECK-LABEL: define {{.*}} @_ZN22ImplicitSpecialMembers1BC2ERKS0_( @@ -49,9 +49,9 @@ namespace ImplicitSpecialMembers { // CHECK-LABEL: define {{.*}} @_ZN22ImplicitSpecialMembers1DC2EOS0_( // CHECK: call {{.*}} @_ZN22ImplicitSpecialMembers1AC1ERKS0_( // CHECK-LABEL: define {{.*}} @_ZN20OperatorDeleteLookup1AD0Ev( - // CHECK: call void @_ZN20OperatorDeleteLookup1AdlEPv( + // CHECK: call {{.*}}void @_ZN20OperatorDeleteLookup1AdlEPv( - // CHECK-DAG: call {{[a-z]*[ ]?i32}} @_ZN8CtorInitIiE1fEv( + // CHECK-DAG: call {{[a-z\_\d]*[ ]?i32}} @_ZN8CtorInitIiE1fEv( extern B b1; B b2(b1); diff --git a/test/Modules/debug-info-moduleimport.m b/test/Modules/debug-info-moduleimport.m new file mode 100644 index 0000000..1f12b02 --- /dev/null +++ b/test/Modules/debug-info-moduleimport.m @@ -0,0 +1,7 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -g -fmodules -DGREETING="Hello World" -UNDEBUG -fimplicit-module-maps -fmodules-cache-path=%t %s -I %S/Inputs -isysroot /tmp/.. -I %t -emit-llvm -o - | FileCheck %s + +// CHECK: ![[CU:.*]] = distinct !DICompileUnit +@import DebugModule; +// CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: ![[CU]], entity: ![[MODULE:.*]], line: 5) +// CHECK: ![[MODULE]] = !DIModule(scope: null, name: "DebugModule", configMacros: "\22-DGREETING=Hello World\22 \22-UNDEBUG\22", includePath: "{{.*}}test{{.*}}Modules{{.*}}Inputs", isysroot: "/tmp/..") diff --git a/test/Modules/direct-module-import.m b/test/Modules/direct-module-import.m index 3216eb9..bf9248e 100644 --- a/test/Modules/direct-module-import.m +++ b/test/Modules/direct-module-import.m @@ -1,7 +1,7 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs -include Module/Module.h %s -emit-llvm -o - | FileCheck %s -// CHECK: call i8* @getModuleVersion +// CHECK: call {{.*}}i8* @getModuleVersion const char* getVer(void) { return getModuleVersion(); } diff --git a/test/Modules/explicit-build-prefer-self.cpp b/test/Modules/explicit-build-prefer-self.cpp new file mode 100644 index 0000000..13fbdbd --- /dev/null +++ b/test/Modules/explicit-build-prefer-self.cpp @@ -0,0 +1,3 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fno-implicit-modules -emit-module -fmodule-name=a %S/Inputs/explicit-build-prefer-self/map -o %t/a.pcm +// RUN: %clang_cc1 -fmodules -fno-implicit-modules -emit-module -fmodule-name=b %S/Inputs/explicit-build-prefer-self/map -o %t/b.pcm diff --git a/test/Modules/framework-name.m b/test/Modules/framework-name.m new file mode 100644 index 0000000..a63e206 --- /dev/null +++ b/test/Modules/framework-name.m @@ -0,0 +1,33 @@ +// REQUIRES: shell +// RUN: rm -rf %t.mcp %t +// RUN: mkdir -p %t +// RUN: ln -s %S/Inputs/NameInDir2.framework %t/NameInImport.framework +// RUN: ln -s %S/Inputs/NameInDirInferred.framework %t/NameInImportInferred.framework +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t.mcp -fimplicit-module-maps -I %S/Inputs -F %S/Inputs -F %t -Wauto-import -verify %s + +// Sanity check that we won't somehow find non-canonical module names or +// modules where we shouldn't search the framework. +// RUN: echo '@import NameInModMap' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s +// RUN: echo '@import NameInDir' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s +// RUN: echo '@import NameInImport' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s +// RUN: echo '@import NameInImportInferred' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s +// CHECK: module '{{.*}}' not found + +// FIXME: We might want to someday lock down framework modules so that these +// name mismatches are disallowed. However, as long as we *don't* prevent them +// it's important that they map correctly to module imports. + +// The module map name doesn't match the directory name. +#import <NameInDir/NameInDir.h> // expected-warning {{import of module 'NameInModMap'}} + +// The name in the import doesn't match the module name. +#import <NameInImport/NameInDir2.h> // expected-warning {{import of module 'NameInDir2'}} +@import NameInDir2; // OK + +// The name in the import doesn't match the module name (inferred framework module). +#import <NameInImportInferred/NameInDirInferred.h> // expected-warning {{import of module 'NameInDirInferred'}} + +@import ImportNameInDir; +#ifdef NAME_IN_DIR +#error NAME_IN_DIR should be undef'd +#endif diff --git a/test/Modules/merge-class-definition-visibility.cpp b/test/Modules/merge-class-definition-visibility.cpp index e8602c0..ac4c951 100644 --- a/test/Modules/merge-class-definition-visibility.cpp +++ b/test/Modules/merge-class-definition-visibility.cpp @@ -1,15 +1,23 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -fmodules -fmodule-map-file=%S/Inputs/merge-class-definition-visibility/modmap \ // RUN: -I%S/Inputs/merge-class-definition-visibility \ -// RUN: -fmodules-cache-path=%t %s -verify +// RUN: -fmodules-cache-path=%t %s -verify \ +// RUN: -fmodules-local-submodule-visibility // expected-no-diagnostics #include "c.h" template<typename T> struct X { T t; }; typedef X<A> XA; +struct B; -#include "d.h" -// Ensure that this triggers the import of the second definition from d.h, +#include "e.h" +// Ensure that this triggers the import of the second definition from e.h, // which is necessary to make the definition of A visible in the template // instantiation. XA xa; + +// Ensure that we make the definition of B visible. We made the parse-merged +// definition from e.h visible, which makes the definition from d.h visible, +// and that definition was merged into the canonical definition from b.h, +// so that becomes visible, and we have a visible definition. +B b; diff --git a/test/Modules/module-feature.m b/test/Modules/module-feature.m new file mode 100644 index 0000000..4926d26 --- /dev/null +++ b/test/Modules/module-feature.m @@ -0,0 +1,14 @@ +// RUN: rm -rf %t %t.nohash + +// Each set of features gets its own cache. +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -fmodule-feature f1 -fmodule-feature f2 -F %S/Inputs %s -verify -Rmodule-build +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -fmodule-feature f2 -F %S/Inputs %s -verify -Rmodule-build +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -fmodule-feature f2 -fmodule-feature f1 -F %S/Inputs %s -Rmodule-build 2>&1 | FileCheck %s -allow-empty -check-prefix=ALREADY_BUILT +// ALREADY_BUILT-NOT: building module + +// Errors if we try to force the load. +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t.nohash -fimplicit-module-maps -fdisable-module-hash -fmodule-feature f1 -fmodule-feature f2 -F %S/Inputs %s -verify -Rmodule-build +// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t.nohash -fimplicit-module-maps -fdisable-module-hash -fmodule-feature f2 -F %S/Inputs %s 2>&1 | FileCheck %s -check-prefix=DIFFERS +// DIFFERS: error: module features differs + +@import Module; // expected-remark {{building module 'Module'}} expected-remark {{finished}} diff --git a/test/Modules/module_file_info.m b/test/Modules/module_file_info.m index 01d5073..8693d2b 100644 --- a/test/Modules/module_file_info.m +++ b/test/Modules/module_file_info.m @@ -2,7 +2,7 @@ @import DependsOnModule; // RUN: rm -rf %t -// RUN: %clang_cc1 -w -Wunused -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t -F %S/Inputs -DBLARG -DWIBBLE=WOBBLE %s +// RUN: %clang_cc1 -w -Wunused -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t -F %S/Inputs -DBLARG -DWIBBLE=WOBBLE -fmodule-feature myfeature %s // RUN: %clang_cc1 -module-file-info %t/DependsOnModule.pcm | FileCheck %s // CHECK: Generated by this Clang: @@ -14,6 +14,8 @@ // CHECK: C99: Yes // CHECK: Objective-C 1: Yes // CHECK: modules extension to C: Yes +// CHECK: Module features: +// CHECK: myfeature // CHECK: Target options: // CHECK: Triple: diff --git a/test/Modules/modules-with-same-name.m b/test/Modules/modules-with-same-name.m index b5cb6fa..b6925df 100644 --- a/test/Modules/modules-with-same-name.m +++ b/test/Modules/modules-with-same-name.m @@ -7,19 +7,19 @@ // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fmodules-ignore-macro=EXPECTED_PATH -fmodules-ignore-macro=DIRECT -fsyntax-only %s -verify -I %S/Inputs/modules-with-same-name/path2/A -DDIRECT -DEXPECTED_PATH=2 // Confirm that we have two pcm files (one for each 'A'). -// RUN: find %t -name "A-*.pcm" | count 2 +// RUN: find %t -name "A-*.pc[m]" | count 2 // DependsOnA, using A from path 1 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fmodules-ignore-macro=EXPECTED_PATH -fmodules-ignore-macro=DIRECT -fsyntax-only %s -verify -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path1/A -DEXPECTED_PATH=1 // Confirm that we have three pcm files (one for each 'A', and one for 'DependsOnA') -// RUN: find %t -name "*.pcm" | count 3 +// RUN: find %t -name "*.pc[m]" | count 3 // DependsOnA, using A from path 2 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fmodules-ignore-macro=EXPECTED_PATH -fmodules-ignore-macro=DIRECT -fsyntax-only %s -verify -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path2/A -DEXPECTED_PATH=2 // Confirm that we still have three pcm files, since DependsOnA will be rebuilt -// RUN: find %t -name "*.pcm" | count 3 +// RUN: find %t -name "*.pc[m]" | count 3 #ifdef DIRECT @import A; diff --git a/test/Modules/pch-used.m b/test/Modules/pch-used.m index cdfadb2..0711d13 100644 --- a/test/Modules/pch-used.m +++ b/test/Modules/pch-used.m @@ -6,4 +6,4 @@ void f() { SPXTrace(); } void g() { double x = DBL_MAX; } -// CHECK: define internal void @SPXTrace +// CHECK: define internal {{.*}}void @SPXTrace diff --git a/test/Modules/signal.m b/test/Modules/signal.m new file mode 100644 index 0000000..30059e9 --- /dev/null +++ b/test/Modules/signal.m @@ -0,0 +1,11 @@ +// REQUIRES: shell +// RUN: rm -rf %t + +// Crash building module. +// RUN: not --crash %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs %s + +// The dead symlink is still around, but the underlying lock file is gone. +// RUN: find %t -name "crash-*.pcm.lock" | count 1 +// RUN: find %t -name "crash-*.pcm.lock-*" | count 0 + +@import crash; diff --git a/test/Modules/submodule-visibility.cpp b/test/Modules/submodule-visibility.cpp index 084f811..b2c5fc7 100644 --- a/test/Modules/submodule-visibility.cpp +++ b/test/Modules/submodule-visibility.cpp @@ -20,3 +20,11 @@ #endif int k = n + m; // OK, a and b are visible here. + +#ifndef A +#error A is not defined +#endif + +#ifndef B +#error B is not defined +#endif diff --git a/test/Modules/submodules-merge-defs.cpp b/test/Modules/submodules-merge-defs.cpp index 94c0fd3..92c7844 100644 --- a/test/Modules/submodules-merge-defs.cpp +++ b/test/Modules/submodules-merge-defs.cpp @@ -3,7 +3,7 @@ // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -fmodules-local-submodule-visibility -DTEXTUAL // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -fmodules-local-submodule-visibility -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -fmodules-local-submodule-visibility -DTEXTUAL -DEARLY_INDIRECT_INCLUDE +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -fmodules-local-submodule-visibility -DTEXTUAL -DEARLY_INDIRECT_INCLUDE -fno-modules-hide-internal-linkage // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -fmodules-local-submodule-visibility -fmodule-feature use_defs_twice -DIMPORT_USE_2 // Trigger import of definitions, but don't make them visible. @@ -27,33 +27,37 @@ int pre_use_a = use_a(pre_a); // expected-error {{'A' must be imported}} expecte B::Inner2 pre_bi; // expected-error +{{must be imported}} // expected-note@defs.h:4 +{{here}} // expected-note@defs.h:11 +{{here}} +void pre_bfi(B b) { // expected-error {{must use 'class'}} expected-error +{{must be imported}} + b.f<int>(); // expected-error +{{must be imported}} expected-error +{{}} + // expected-note@defs.h:12 +{{here}} +} C_Base<1> pre_cb1; // expected-error +{{must be imported}} -// expected-note@defs.h:15 +{{here}} +// expected-note@defs.h:16 +{{here}} C1 pre_c1; // expected-error +{{must be imported}} expected-error {{must use 'struct'}} -// expected-note@defs.h:17 +{{here}} -C2 pre_c2; // expected-error +{{must be imported}} expected-error {{must use 'struct'}} // expected-note@defs.h:18 +{{here}} +C2 pre_c2; // expected-error +{{must be imported}} expected-error {{must use 'struct'}} +// expected-note@defs.h:19 +{{here}} D::X pre_dx; // expected-error +{{must be imported}} -// expected-note@defs.h:20 +{{here}} // expected-note@defs.h:21 +{{here}} +// expected-note@defs.h:22 +{{here}} // FIXME: We should warn that use_dx is being used without being imported. int pre_use_dx = use_dx(pre_dx); int pre_e = E(0); // expected-error {{must be imported}} -// expected-note@defs.h:24 +{{here}} +// expected-note@defs.h:25 +{{here}} int pre_ff = F<int>().f(); // expected-error +{{must be imported}} int pre_fg = F<int>().g<int>(); // expected-error +{{must be imported}} -// expected-note@defs.h:26 +{{here}} +// expected-note@defs.h:27 +{{here}} G::A pre_ga // expected-error +{{must be imported}} = G::a; // expected-error +{{must be imported}} -// expected-note@defs.h:40 +{{here}} -// expected-note@defs.h:41 +{{here}} -decltype(G::h) pre_gh = G::h; // expected-error +{{must be imported}} // expected-note@defs.h:42 +{{here}} +// expected-note@defs.h:43 +{{here}} +decltype(G::h) pre_gh = G::h; // expected-error +{{must be imported}} +// expected-note@defs.h:44 +{{here}} J<> pre_j; // expected-error {{declaration of 'J' must be imported}} #ifdef IMPORT_USE_2 @@ -63,7 +67,7 @@ J<> pre_j; // expected-error {{declaration of 'J' must be imported}} #else // expected-error@-6 {{default argument of 'J' must be imported from module 'stuff.use'}} #endif -// expected-note@defs.h:49 +{{here}} +// expected-note@defs.h:51 +{{here}} // Make definitions from second module visible. #ifdef TEXTUAL @@ -77,6 +81,9 @@ J<> pre_j; // expected-error {{declaration of 'J' must be imported}} A post_a; int post_use_a = use_a(post_a); B::Inner2 post_bi; +void post_bfi(B b) { + b.f<int>(); +} C_Base<1> post_cb1; C1 c1; C2 c2; @@ -92,3 +99,10 @@ template<typename T, int N, template<typename> class K> struct J; J<> post_j2; FriendDefArg::Y<int> friend_def_arg; FriendDefArg::D<> friend_def_arg_d; + +MergeFunctionTemplateSpecializations::X<int>::Q<char> xiqc; + +#ifdef TEXTUAL +#include "use-defs.h" +void use_static_inline() { StaticInline::g({}); } +#endif |