diff options
Diffstat (limited to 'test')
343 files changed, 5777 insertions, 951 deletions
diff --git a/test/ARCMT/migrate-on-pch-and-module.m b/test/ARCMT/migrate-on-pch-and-module.m index c98ce46..51babf6 100644 --- a/test/ARCMT/migrate-on-pch-and-module.m +++ b/test/ARCMT/migrate-on-pch-and-module.m @@ -1,6 +1,6 @@ // RUN: rm -rf %t-mcp -// RUN: %clang_cc1 -objcmt-migrate-subscripting -emit-pch -o %t.pch %s -isysroot %S/Inputs/System -triple x86_64-apple-darwin10 -F %S/Inputs -fmodules -fmodules-cache-path=%t-mcp -w -// RUN: %clang_cc1 -objcmt-migrate-subscripting -include-pch %t.pch %s -migrate -o %t.remap -isysroot %S/Inputs/System -triple x86_64-apple-darwin10 -F %S/Inputs -fmodules -fmodules-cache-path=%t-mcp +// RUN: %clang_cc1 -objcmt-migrate-subscripting -emit-pch -o %t.pch %s -isysroot %S/Inputs/System -triple x86_64-apple-darwin10 -F %S/Inputs -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-mcp -w +// RUN: %clang_cc1 -objcmt-migrate-subscripting -include-pch %t.pch %s -migrate -o %t.remap -isysroot %S/Inputs/System -triple x86_64-apple-darwin10 -F %S/Inputs -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-mcp #ifndef HEADER #define HEADER diff --git a/test/Analysis/CFContainers.mm b/test/Analysis/CFContainers.mm index b019423..f315bc9 100644 --- a/test/Analysis/CFContainers.mm +++ b/test/Analysis/CFContainers.mm @@ -19,6 +19,7 @@ typedef struct { } CFArrayCallBacks; typedef const struct __CFArray * CFArrayRef; CFArrayRef CFArrayCreate(CFAllocatorRef allocator, const void **values, CFIndex numValues, const CFArrayCallBacks *callBacks); +typedef struct __CFArray * CFMutableArrayRef; typedef const struct __CFString * CFStringRef; enum { kCFNumberSInt8Type = 1, @@ -202,3 +203,24 @@ void TestConst(CFArrayRef A, CFIndex sIndex, void* x[]) { void TestNullArray() { CFArrayGetValueAtIndex(0, 0); } + +void ArrayRefMutableEscape(CFMutableArrayRef a); +void ArrayRefEscape(CFArrayRef a); + +void TestCFMutableArrayRefEscapeViaMutableArgument(CFMutableArrayRef a) { + CFIndex aLen = CFArrayGetCount(a); + ArrayRefMutableEscape(a); + + // ArrayRefMutableEscape could mutate a to make it have + // at least aLen + 1 elements, so do not report an error here. + CFArrayGetValueAtIndex(a, aLen); +} + +void TestCFMutableArrayRefEscapeViaImmutableArgument(CFMutableArrayRef a) { + CFIndex aLen = CFArrayGetCount(a); + ArrayRefEscape(a); + + // ArrayRefEscape is declared to take a CFArrayRef (i.e, an immutable array) + // so we assume it does not change the length of a. + CFArrayGetValueAtIndex(a, aLen); // expected-warning {{Index is out of bounds}} +} diff --git a/test/Analysis/designated-initializer.c b/test/Analysis/designated-initializer.c new file mode 100644 index 0000000..b601f87 --- /dev/null +++ b/test/Analysis/designated-initializer.c @@ -0,0 +1,41 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG %s 2>&1 \ +// RUN: | FileCheck %s + +struct Q { int a, b, c; }; +union UQ { struct Q q; }; +union UQ getUQ() { + union UQ u = { { 1, 2, 3 } }; + return u; +} + +void test() { + struct LUQ { union UQ uq; } var = { getUQ(), .uq.q.a = 100 }; + struct Q s[] = { + [0] = (struct Q){1, 2}, + [0].c = 3 + }; +} + +// CHECK: void test() +// CHECK: [B1] +// CHECK: 1: getUQ +// CHECK: 2: [B1.1] (ImplicitCastExpr, FunctionToPointerDecay, union UQ (*)()) +// CHECK: 3: [B1.2]() +// CHECK: 4: 100 +// CHECK: 5: /*no init*/ +// CHECK: 6: /*no init*/ +// CHECK: 7: {[B1.4], [B1.5], [B1.6]} +// CHECK: 8: {[B1.7]} +// CHECK: 9: {/*base*/[B1.3], /*updater*/[B1.8]} +// CHECK: 10: {[B1.3], .uq.q.a = [B1.4]} +// CHECK: 11: struct LUQ var = {getUQ(), .uq.q.a = 100}; +// CHECK: 12: 1 +// CHECK: 13: 2 +// CHECK: 14: /*implicit*/(int)0 +// CHECK: 15: {[B1.12], [B1.13]} +// CHECK: 18: /*no init*/ +// CHECK: 19: /*no init*/ +// CHECK: 20: 3 +// CHECK: 21: {[B1.18], [B1.19], [B1.20]} +// CHECK: 22: {/*base*/[B1.17], /*updater*/[B1.21]} +// CHECK: 24: struct Q s[] = {[0] = (struct Q){1, 2}, [0].c = 3}; diff --git a/test/Analysis/retain-release.m b/test/Analysis/retain-release.m index 6973f9b..1dbcda5 100644 --- a/test/Analysis/retain-release.m +++ b/test/Analysis/retain-release.m @@ -2153,6 +2153,40 @@ id returnNSNull() { return [NSNull null]; // no-warning } +//===----------------------------------------------------------------------===// +// cf_returns_[not_]retained on parameters +//===----------------------------------------------------------------------===// + +void testCFReturnsNotRetained() { + extern void getViaParam(CFTypeRef * CF_RETURNS_NOT_RETAINED outObj); + CFTypeRef obj; + getViaParam(&obj); + CFRelease(obj); // // expected-warning {{Incorrect decrement of the reference count of an object that is not owned at this point by the caller}} +} + +void testCFReturnsNotRetainedAnnotated() { + extern void getViaParam2(CFTypeRef * __nonnull CF_RETURNS_NOT_RETAINED outObj); + CFTypeRef obj; + getViaParam2(&obj); + CFRelease(obj); // // expected-warning {{Incorrect decrement of the reference count of an object that is not owned at this point by the caller}} +} + +void testCFReturnsRetained() { + extern int copyViaParam(CFTypeRef * CF_RETURNS_RETAINED outObj); + CFTypeRef obj; + copyViaParam(&obj); + CFRelease(obj); + CFRelease(obj); // // FIXME-warning {{Incorrect decrement of the reference count of an object that is not owned at this point by the caller}} +} + +void testCFReturnsRetainedError() { + extern int copyViaParam(CFTypeRef * CF_RETURNS_RETAINED outObj); + CFTypeRef obj; + if (copyViaParam(&obj) == -42) + return; // no-warning + CFRelease(obj); +} + // CHECK: <key>diagnostics</key> // CHECK-NEXT: <array> // CHECK-NEXT: <dict> diff --git a/test/CXX/except/except.spec/p9-dynamic.cpp b/test/CXX/except/except.spec/p9-dynamic.cpp index 4559e0d..1e7b294 100644 --- a/test/CXX/except/except.spec/p9-dynamic.cpp +++ b/test/CXX/except/except.spec/p9-dynamic.cpp @@ -7,6 +7,6 @@ void target() throw(int) // CHECK: invoke void @_Z8externalv() external(); } -// CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) +// CHECK: landingpad { i8*, i32 } // CHECK-NEXT: filter [1 x i8*] [i8* bitcast (i8** @_ZTIi to i8*)] // CHECK: call void @__cxa_call_unexpected diff --git a/test/CXX/except/except.spec/p9-noexcept.cpp b/test/CXX/except/except.spec/p9-noexcept.cpp index 3fd45c5..d8cda2f 100644 --- a/test/CXX/except/except.spec/p9-noexcept.cpp +++ b/test/CXX/except/except.spec/p9-noexcept.cpp @@ -7,7 +7,7 @@ void target() noexcept // CHECK: invoke void @_Z8externalv() external(); } -// CHECK: [[T0:%.*]] = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) +// CHECK: [[T0:%.*]] = landingpad { i8*, i32 } // CHECK-NEXT: catch i8* null // CHECK-NEXT: [[T1:%.*]] = extractvalue { i8*, i32 } [[T0]], 0 // CHECK-NEXT: call void @__clang_call_terminate(i8* [[T1]]) [[NR_NUW:#[0-9]+]] diff --git a/test/CodeGen/2004-06-17-UnorderedCompares.c b/test/CodeGen/2004-06-17-UnorderedCompares.c index 2c80180..38eafd0 100644 --- a/test/CodeGen/2004-06-17-UnorderedCompares.c +++ b/test/CodeGen/2004-06-17-UnorderedCompares.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -std=c99 %s -emit-llvm -o - | FileCheck %s // CHECK: @Test -// CHECK-NOT: call +// CHECK-NOT: call{{ }} _Bool A, B, C, D, E, F; void TestF(float X, float Y) { diff --git a/test/CodeGen/address-safety-attr-kasan.cpp b/test/CodeGen/address-safety-attr-kasan.cpp new file mode 100644 index 0000000..c84ba88 --- /dev/null +++ b/test/CodeGen/address-safety-attr-kasan.cpp @@ -0,0 +1,38 @@ +// Make sure the sanitize_address attribute is emitted when using both ASan and KASan. +// Also document that __attribute__((no_sanitize_address)) doesn't disable KASan instrumentation. + +/// RUN: %clang_cc1 -triple i386-unknown-linux -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-NOASAN %s +/// RUN: %clang_cc1 -triple i386-unknown-linux -fsanitize=address -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-ASAN %s +/// RUN: %clang_cc1 -triple i386-unknown-linux -fsanitize=kernel-address -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-KASAN %s + +int HasSanitizeAddress() { + return 1; +} +// CHECK-NOASAN: {{Function Attrs: nounwind$}} +// CHECK-ASAN: Function Attrs: nounwind sanitize_address +// CHECK-KASAN: Function Attrs: nounwind sanitize_address + +__attribute__((no_sanitize("address"))) +int NoSanitizeQuoteAddress() { + return 0; +} +// CHECK-NOASAN: {{Function Attrs: nounwind$}} +// CHECK-ASAN: {{Function Attrs: nounwind$}} +// CHECK-KASAN: {{Function Attrs: nounwind sanitize_address$}} + +__attribute__((no_sanitize_address)) +int NoSanitizeAddress() { + return 0; +} +// CHECK-NOASAN: {{Function Attrs: nounwind$}} +// CHECK-ASAN: {{Function Attrs: nounwind$}} +// CHECK-KASAN: {{Function Attrs: nounwind sanitize_address$}} + +__attribute__((no_sanitize("kernel-address"))) +int NoSanitizeKernelAddress() { + return 0; +} + +// CHECK-NOASAN: {{Function Attrs: nounwind$}} +// CHECK-ASAN: {{Function Attrs: nounwind sanitize_address$}} +// CHECK-KASAN: {{Function Attrs: nounwind$}} diff --git a/test/CodeGen/arm-interrupt-attr.c b/test/CodeGen/arm-interrupt-attr.c index 73f1cfe..fcbf1c7 100644 --- a/test/CodeGen/arm-interrupt-attr.c +++ b/test/CodeGen/arm-interrupt-attr.c @@ -28,11 +28,11 @@ __attribute__((interrupt("UNDEF"))) void test_undef_interrupt() { // CHECK: define arm_aapcscc void @test_undef_interrupt() [[UNDEF_ATTR:#[0-9]+]] } -// CHECK: attributes [[GENERIC_ATTR]] = { nounwind alignstack=8 {{"interrupt"[^=]}} -// CHECK: attributes [[IRQ_ATTR]] = { nounwind alignstack=8 "interrupt"="IRQ" -// CHECK: attributes [[FIQ_ATTR]] = { nounwind alignstack=8 "interrupt"="FIQ" -// CHECK: attributes [[SWI_ATTR]] = { nounwind alignstack=8 "interrupt"="SWI" -// CHECK: attributes [[ABORT_ATTR]] = { nounwind alignstack=8 "interrupt"="ABORT" -// CHECK: attributes [[UNDEF_ATTR]] = { nounwind alignstack=8 "interrupt"="UNDEF" - -// CHECK-APCS: attributes [[GENERIC_ATTR]] = { nounwind "interrupt" +// CHECK: attributes [[GENERIC_ATTR]] = { {{.*}} {{"interrupt"[^=]}} +// CHECK: attributes [[IRQ_ATTR]] = { {{.*}} "interrupt"="IRQ" +// CHECK: attributes [[FIQ_ATTR]] = { {{.*}} "interrupt"="FIQ" +// CHECK: attributes [[SWI_ATTR]] = { {{.*}} "interrupt"="SWI" +// CHECK: attributes [[ABORT_ATTR]] = { {{.*}} "interrupt"="ABORT" +// CHECK: attributes [[UNDEF_ATTR]] = { {{.*}} "interrupt"="UNDEF" + +// CHECK-APCS: attributes [[GENERIC_ATTR]] = { {{.*}} "interrupt" diff --git a/test/CodeGen/arm_acle.c b/test/CodeGen/arm_acle.c index 5b02450..a2eb900 100644 --- a/test/CodeGen/arm_acle.c +++ b/test/CodeGen/arm_acle.c @@ -336,3 +336,69 @@ uint32_t test_crc32cw(uint32_t a, uint32_t b) { uint32_t test_crc32cd(uint32_t a, uint64_t b) { return __crc32cd(a, b); } + +/* 10.1 Special register intrinsics */ +// ARM-LABEL: test_rsr +// AArch64: call i64 @llvm.read_register.i64(metadata ![[M0:[0-9]]]) +// AArch32: call i32 @llvm.read_register.i32(metadata ![[M2:[0-9]]]) +uint32_t test_rsr() { +#ifdef __ARM_32BIT_STATE + return __arm_rsr("cp1:2:c3:c4:5"); +#else + return __arm_rsr("1:2:3:4:5"); +#endif +} + +// ARM-LABEL: test_rsr64 +// AArch64: call i64 @llvm.read_register.i64(metadata ![[M0:[0-9]]]) +// AArch32: call i64 @llvm.read_register.i64(metadata ![[M3:[0-9]]]) +uint64_t test_rsr64() { +#ifdef __ARM_32BIT_STATE + return __arm_rsr64("cp1:2:c3"); +#else + return __arm_rsr64("1:2:3:4:5"); +#endif +} + +// ARM-LABEL: test_rsrp +// AArch64: call i64 @llvm.read_register.i64(metadata ![[M1:[0-9]]]) +// AArch32: call i32 @llvm.read_register.i32(metadata ![[M4:[0-9]]]) +void *test_rsrp() { + return __arm_rsrp("sysreg"); +} + +// ARM-LABEL: test_wsr +// AArch64: call void @llvm.write_register.i64(metadata ![[M0:[0-9]]], i64 %{{.*}}) +// AArch32: call void @llvm.write_register.i32(metadata ![[M2:[0-9]]], i32 %{{.*}}) +void test_wsr(uint32_t v) { +#ifdef __ARM_32BIT_STATE + __arm_wsr("cp1:2:c3:c4:5", v); +#else + __arm_wsr("1:2:3:4:5", v); +#endif +} + +// ARM-LABEL: test_wsr64 +// AArch64: call void @llvm.write_register.i64(metadata ![[M0:[0-9]]], i64 %{{.*}}) +// AArch32: call void @llvm.write_register.i64(metadata ![[M3:[0-9]]], i64 %{{.*}}) +void test_wsr64(uint64_t v) { +#ifdef __ARM_32BIT_STATE + __arm_wsr64("cp1:2:c3", v); +#else + __arm_wsr64("1:2:3:4:5", v); +#endif +} + +// ARM-LABEL: test_wsrp +// AArch64: call void @llvm.write_register.i64(metadata ![[M1:[0-9]]], i64 %{{.*}}) +// AArch32: call void @llvm.write_register.i32(metadata ![[M4:[0-9]]], i32 %{{.*}}) +void test_wsrp(void *v) { + __arm_wsrp("sysreg", v); +} + +// AArch32: ![[M2]] = !{!"cp1:2:c3:c4:5"} +// AArch32: ![[M3]] = !{!"cp1:2:c3"} +// AArch32: ![[M4]] = !{!"sysreg"} + +// AArch64: ![[M0]] = !{!"1:2:3:4:5"} +// AArch64: ![[M1]] = !{!"sysreg"} diff --git a/test/CodeGen/arm_neon_intrinsics.c b/test/CodeGen/arm_neon_intrinsics.c index 756e3b4..d92c32c 100644 --- a/test/CodeGen/arm_neon_intrinsics.c +++ b/test/CodeGen/arm_neon_intrinsics.c @@ -2399,6 +2399,12 @@ float32_t test_vget_lane_f32(float32x2_t a) { return vget_lane_f32(a, 1); } +// CHECK-LABEL: test_vget_lane_f16 +// CHECK: vmov +float32_t test_vget_lane_f16(float16x4_t a) { + return vget_lane_f16(a, 1); +} + // CHECK-LABEL: test_vgetq_lane_u8 // CHECK: vmov uint8_t test_vgetq_lane_u8(uint8x16_t a) { @@ -2453,6 +2459,12 @@ float32_t test_vgetq_lane_f32(float32x4_t a) { return vgetq_lane_f32(a, 3); } +// CHECK-LABEL: test_vgetq_lane_f16 +// CHECK: vmov +float32_t test_vgetq_lane_f16(float16x8_t a) { + return vgetq_lane_f16(a, 3); +} + // CHECK-LABEL: test_vget_lane_s64 // The optimizer is able to remove all moves now. int64_t test_vget_lane_s64(int64x1_t a) { @@ -9157,6 +9169,12 @@ float32x2_t test_vset_lane_f32(float32_t a, float32x2_t b) { return vset_lane_f32(a, b, 1); } +// CHECK-LABEL: test_vset_lane_f16 +// CHECK: mov +float16x4_t test_vset_lane_f16(float16_t *a, float16x4_t b) { + return vset_lane_f16(*a, b, 1); +} + // CHECK-LABEL: test_vsetq_lane_u8 // CHECK: vmov uint8x16_t test_vsetq_lane_u8(uint8_t a, uint8x16_t b) { @@ -9211,6 +9229,12 @@ float32x4_t test_vsetq_lane_f32(float32_t a, float32x4_t b) { return vsetq_lane_f32(a, b, 3); } +// CHECK-LABEL: test_vsetq_lane_f16 +// CHECK: vmov +float16x8_t test_vsetq_lane_f16(float16_t *a, float16x8_t b) { + return vsetq_lane_f16(*a, b, 3); +} + // CHECK-LABEL: test_vset_lane_s64 // The optimizer is able to get rid of all moves now. int64x1_t test_vset_lane_s64(int64_t a, int64x1_t b) { diff --git a/test/CodeGen/attr-disable-tail-calls.c b/test/CodeGen/attr-disable-tail-calls.c new file mode 100644 index 0000000..8141349 --- /dev/null +++ b/test/CodeGen/attr-disable-tail-calls.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 %s -emit-llvm -mdisable-tail-calls -o - | FileCheck %s -check-prefix=CHECK -check-prefix=DISABLE +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 %s -emit-llvm -o - | FileCheck %s -check-prefix=CHECK -check-prefix=ENABLE + +// CHECK: define i32 @f1() [[ATTR:#[0-9]+]] { + +int f1() { + return 0; +} + +// DISABLE: attributes [[ATTR]] = { {{.*}} "disable-tail-calls"="true" {{.*}} } +// ENABLE: attributes [[ATTR]] = { {{.*}} "disable-tail-calls"="false" {{.*}} } diff --git a/test/CodeGen/attr-mode-vector-types.c b/test/CodeGen/attr-mode-vector-types.c new file mode 100644 index 0000000..3c028fb --- /dev/null +++ b/test/CodeGen/attr-mode-vector-types.c @@ -0,0 +1,41 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -emit-llvm -o - | FileCheck %s + +typedef int __attribute__((mode(byte))) __attribute__((vector_size(4))) vec_t1; +typedef int __attribute__((mode(QI))) __attribute__((vector_size(8))) vec_t2; +typedef int __attribute__((mode(SI))) __attribute__((vector_size(16))) vec_t3; +typedef int __attribute__((mode(DI))) __attribute__((vector_size(64)))vec_t4; +typedef float __attribute__((mode(SF))) __attribute__((vector_size(128))) vec_t5; +typedef float __attribute__((mode(DF))) __attribute__((vector_size(256))) vec_t6; + +void check() { + // CHECK: alloca <4 x i8> + vec_t1 v1; + // CHECK: alloca <8 x i8> + vec_t2 v2; + // CHECK: alloca <4 x i32> + vec_t3 v3; + // CHECK: alloca <8 x i64> + vec_t4 v4; + // CHECK: alloca <32 x float> + vec_t5 v5; + // CHECK: alloca <32 x double> + vec_t6 v6; +} + +// CHECK: ret i32 4 +int check_size1() { return sizeof(vec_t1); } + +// CHECK: ret i32 8 +int check_size2() { return sizeof(vec_t2); } + +// CHECK: ret i32 16 +int check_size3() { return sizeof(vec_t3); } + +// CHECK: ret i32 64 +int check_size4() { return sizeof(vec_t4); } + +// CHECK: ret i32 128 +int check_size5() { return sizeof(vec_t5); } + +// CHECK: ret i32 256 +int check_size6() { return sizeof(vec_t6); } diff --git a/test/CodeGen/attr-target.c b/test/CodeGen/attr-target.c new file mode 100644 index 0000000..8c0f335 --- /dev/null +++ b/test/CodeGen/attr-target.c @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -triple x86_64-linux-gnu -target-cpu x86-64 -emit-llvm %s -o - | FileCheck %s + +int baz(int a) { return 4; } + +int __attribute__((target("avx,sse4.2,arch=ivybridge"))) foo(int a) { return 4; } + +int __attribute__((target("tune=sandybridge"))) walrus(int a) { return 4; } +int __attribute__((target("fpmath=387"))) koala(int a) { return 4; } + +int __attribute__((target("mno-sse2"))) echidna(int a) { return 4; } + +int bar(int a) { return baz(a) + foo(a); } + +// Check that we emit the additional subtarget and cpu features for foo and not for baz or bar. +// CHECK: baz{{.*}} #0 +// CHECK: foo{{.*}} #1 +// We ignore the tune attribute so walrus should be identical to baz and bar. +// CHECK: walrus{{.*}} #0 +// We're currently ignoring the fpmath attribute so koala should be identical to baz and bar. +// CHECK: koala{{.*}} #0 +// CHECK: echidna{{.*}} #2 +// CHECK: bar{{.*}} #0 +// CHECK: #0 = {{.*}}"target-cpu"="x86-64" "target-features"="+sse,+sse2" +// CHECK: #1 = {{.*}}"target-cpu"="ivybridge" "target-features"="+sse,+sse2,+avx,+sse4.2" +// CHECK: #2 = {{.*}}"target-cpu"="x86-64" "target-features"="+sse,+sse2,-sse2" diff --git a/test/CodeGen/bounds-checking.c b/test/CodeGen/bounds-checking.c index d93cd3e..90b7f0f 100644 --- a/test/CodeGen/bounds-checking.c +++ b/test/CodeGen/bounds-checking.c @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -fsanitize=local-bounds -emit-llvm -triple x86_64-apple-darwin10 %s -o - | FileCheck %s -// RUN: %clang_cc1 -fsanitize=array-bounds -O -fsanitize-undefined-trap-on-error -emit-llvm -triple x86_64-apple-darwin10 -DNO_DYNAMIC %s -o - | FileCheck %s +// RUN: %clang_cc1 -fsanitize=array-bounds -O -fsanitize-trap=array-bounds -emit-llvm -triple x86_64-apple-darwin10 -DNO_DYNAMIC %s -o - | FileCheck %s // CHECK-LABEL: @f double f(int b, int i) { diff --git a/test/CodeGen/builtins-arm.c b/test/CodeGen/builtins-arm.c index 9f3ed9a..2b81856 100644 --- a/test/CodeGen/builtins-arm.c +++ b/test/CodeGen/builtins-arm.c @@ -84,3 +84,42 @@ void prefetch(int i) { __builtin_arm_prefetch(&i, 1, 0); // CHECK: call {{.*}} @llvm.prefetch(i8* %{{.*}}, i32 1, i32 3, i32 0) } + +unsigned rsr() { + // CHECK: [[V0:[%A-Za-z0-9.]+]] = {{.*}} call i32 @llvm.read_register.i32(metadata !7) + // CHECK-NEXT: ret i32 [[V0]] + return __builtin_arm_rsr("cp1:2:c3:c4:5"); +} + +unsigned long long rsr64() { + // CHECK: [[V0:[%A-Za-z0-9.]+]] = {{.*}} call i64 @llvm.read_register.i64(metadata !8) + // CHECK-NEXT: ret i64 [[V0]] + return __builtin_arm_rsr64("cp1:2:c3"); +} + +void *rsrp() { + // CHECK: [[V0:[%A-Za-z0-9.]+]] = {{.*}} call i32 @llvm.read_register.i32(metadata !9) + // CHECK-NEXT: [[V1:[%A-Za-z0-9.]+]] = inttoptr i32 [[V0]] to i8* + // CHECK-NEXT: ret i8* [[V1]] + return __builtin_arm_rsrp("sysreg"); +} + +void wsr(unsigned v) { + // CHECK: call void @llvm.write_register.i32(metadata !7, i32 %v) + __builtin_arm_wsr("cp1:2:c3:c4:5", v); +} + +void wsr64(unsigned long long v) { + // CHECK: call void @llvm.write_register.i64(metadata !8, i64 %v) + __builtin_arm_wsr64("cp1:2:c3", v); +} + +void wsrp(void *v) { + // CHECK: [[V0:[%A-Za-z0-9.]+]] = ptrtoint i8* %v to i32 + // CHECK-NEXT: call void @llvm.write_register.i32(metadata !9, i32 [[V0]]) + __builtin_arm_wsrp("sysreg", v); +} + +// CHECK: !7 = !{!"cp1:2:c3:c4:5"} +// CHECK: !8 = !{!"cp1:2:c3"} +// CHECK: !9 = !{!"sysreg"} diff --git a/test/CodeGen/builtins-arm64.c b/test/CodeGen/builtins-arm64.c index cc1f547..f2c1c54 100644 --- a/test/CodeGen/builtins-arm64.c +++ b/test/CodeGen/builtins-arm64.c @@ -43,3 +43,39 @@ void prefetch() { __builtin_arm_prefetch(0, 0, 0, 0, 0); // plil1keep // CHECK: call {{.*}} @llvm.prefetch(i8* null, i32 0, i32 3, i32 0) } + +unsigned rsr() { + // CHECK: [[V0:[%A-Za-z0-9.]+]] = {{.*}} call i64 @llvm.read_register.i64(metadata ![[M0:[0-9]]]) + // CHECK-NEXT: trunc i64 [[V0]] to i32 + return __builtin_arm_rsr("1:2:3:4:5"); +} + +unsigned long rsr64() { + // CHECK: call i64 @llvm.read_register.i64(metadata ![[M0:[0-9]]]) + return __builtin_arm_rsr64("1:2:3:4:5"); +} + +void *rsrp() { + // CHECK: [[V0:[%A-Za-z0-9.]+]] = {{.*}} call i64 @llvm.read_register.i64(metadata ![[M0:[0-9]]]) + // CHECK-NEXT: inttoptr i64 [[V0]] to i8* + return __builtin_arm_rsrp("1:2:3:4:5"); +} + +void wsr(unsigned v) { + // CHECK: [[V0:[%A-Za-z0-9.]+]] = zext i32 %v to i64 + // CHECK-NEXT: call void @llvm.write_register.i64(metadata ![[M0:[0-9]]], i64 [[V0]]) + __builtin_arm_wsr("1:2:3:4:5", v); +} + +void wsr64(unsigned long v) { + // CHECK: call void @llvm.write_register.i64(metadata ![[M0:[0-9]]], i64 %v) + __builtin_arm_wsr64("1:2:3:4:5", v); +} + +void wsrp(void *v) { + // CHECK: [[V0:[%A-Za-z0-9.]+]] = ptrtoint i8* %v to i64 + // CHECK-NEXT: call void @llvm.write_register.i64(metadata ![[M0:[0-9]]], i64 [[V0]]) + __builtin_arm_wsrp("1:2:3:4:5", v); +} + +// CHECK: ![[M0]] = !{!"1:2:3:4:5"} diff --git a/test/CodeGen/builtins-ppc-p8vector.c b/test/CodeGen/builtins-ppc-p8vector.c index f74bbad..ac40790 100644 --- a/test/CodeGen/builtins-ppc-p8vector.c +++ b/test/CodeGen/builtins-ppc-p8vector.c @@ -3,6 +3,8 @@ // RUN: %clang_cc1 -faltivec -target-feature +power8-vector -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-LE // RUN: not %clang_cc1 -faltivec -triple powerpc64-unknown-unknown -emit-llvm %s -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PPC +vector signed char vsc = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 }; +vector unsigned char vuc = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 }; vector int vi = { -1, 2, -3, 4 }; vector unsigned int vui = { 1, 2, 3, 4 }; vector bool int vbi = {0, -1, -1, 0}; @@ -11,6 +13,8 @@ vector signed long long vsll = { 1, 2 }; vector unsigned long long vull = { 1, 2 }; int res_i; +vector signed char res_vsc; +vector unsigned char res_vuc; vector int res_vi; vector unsigned int res_vui; vector bool int res_vbi; @@ -737,4 +741,23 @@ void test1() { // CHECK: @llvm.ppc.altivec.vminud // CHECK-LE: @llvm.ppc.altivec.vminud + /* vec_vbpermq */ + res_vsll = vec_vbpermq(vsc, vsc); +// CHECK: llvm.ppc.altivec.vbpermq +// CHECK-LE: llvm.ppc.altivec.vbpermq + + res_vull = vec_vbpermq(vuc, vuc); +// CHECK: llvm.ppc.altivec.vbpermq +// CHECK-LE: llvm.ppc.altivec.vbpermq +// CHECK-PPC: warning: implicit declaration of function 'vec_vbpermq' + + /* vec_vgbbd */ + res_vsc = vec_vgbbd(vsc); +// CHECK: llvm.ppc.altivec.vgbbd +// CHECK-LE: llvm.ppc.altivec.vgbbd + + res_vuc = vec_vgbbd(vuc); +// CHECK: llvm.ppc.altivec.vgbbd +// CHECK-LE: llvm.ppc.altivec.vgbbd +// CHECK-PPC: warning: implicit declaration of function 'vec_vgbbd' } diff --git a/test/CodeGen/catch-undef-behavior.c b/test/CodeGen/catch-undef-behavior.c index 6695419..7875536 100644 --- a/test/CodeGen/catch-undef-behavior.c +++ b/test/CodeGen/catch-undef-behavior.c @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -fsanitize=alignment,null,object-size,shift-base,shift-exponent,return,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize-recover=alignment,null,object-size,shift-base,shift-exponent,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-COMMON --check-prefix=CHECK-UBSAN -// RUN: %clang_cc1 -fsanitize-undefined-trap-on-error -fsanitize=alignment,null,object-size,shift-base,shift-exponent,return,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize-recover=alignment,null,object-size,shift-base,shift-exponent,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-COMMON --check-prefix=CHECK-TRAP +// RUN: %clang_cc1 -fsanitize-trap=alignment,null,object-size,shift-base,shift-exponent,return,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize-recover=alignment,null,object-size,shift-base,shift-exponent,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize=alignment,null,object-size,shift-base,shift-exponent,return,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize-recover=alignment,null,object-size,shift-base,shift-exponent,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-COMMON --check-prefix=CHECK-TRAP // RUN: %clang_cc1 -fsanitize=null -fsanitize-recover=null -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-NULL // RUN: %clang_cc1 -fsanitize=signed-integer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-OVERFLOW // REQUIRES: asserts diff --git a/test/CodeGen/cleanup-destslot-simple.c b/test/CodeGen/cleanup-destslot-simple.c index bae97c8..b8328af 100644 --- a/test/CodeGen/cleanup-destslot-simple.c +++ b/test/CodeGen/cleanup-destslot-simple.c @@ -13,7 +13,9 @@ int test() { return *p; // CHECK: [[X:%.*]] = alloca i32 // CHECK: [[P:%.*]] = alloca i32* -// LIFETIME: call void @llvm.lifetime.start(i64 4, i8* %{{.*}}) -// LIFETIME: call void @llvm.lifetime.start(i64 8, i8* %{{.*}}) +// LIFETIME: call void @llvm.lifetime.start(i64 4, i8* %{{.*}}){{( #[0-9]+)?}}, !dbg +// LIFETIME: call void @llvm.lifetime.start(i64 8, i8* %{{.*}}){{( #[0-9]+)?}}, !dbg // CHECK-NOT: store i32 %{{.*}}, i32* %cleanup.dest.slot +// LIFETIME: call void @llvm.lifetime.end(i64 8, {{.*}}){{( #[0-9]+)?}}, !dbg +// LIFETIME: call void @llvm.lifetime.end(i64 4, {{.*}}){{( #[0-9]+)?}}, !dbg } diff --git a/test/CodeGen/exceptions-seh.c b/test/CodeGen/exceptions-seh.c index d8135e8..1b77ad6 100644 --- a/test/CodeGen/exceptions-seh.c +++ b/test/CodeGen/exceptions-seh.c @@ -19,12 +19,12 @@ int safe_div(int numerator, int denominator, int *res) { *res = myres; return success; } -// CHECK-LABEL: define i32 @safe_div(i32 %numerator, i32 %denominator, i32* %res) +// CHECK-LABEL: define i32 @safe_div(i32 %numerator, i32 %denominator, i32* %res) {{.*}} personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) // CHECK: invoke void @try_body(i32 %{{.*}}, i32 %{{.*}}, i32* %{{.*}}) #[[NOINLINE:[0-9]+]] // CHECK: to label %{{.*}} unwind label %[[lpad:[^ ]*]] // // CHECK: [[lpad]] -// CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) +// CHECK: landingpad { i8*, i32 } // CHECK-NEXT: catch i8* null // CHECK-NOT: br i1 // CHECK: br label %[[except:[^ ]*]] @@ -46,7 +46,7 @@ int filter_expr_capture(void) { return r; } -// CHECK-LABEL: define i32 @filter_expr_capture() +// CHECK-LABEL: define i32 @filter_expr_capture() {{.*}} personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) // CHECK: call void (...) @llvm.frameescape(i32* %[[r:[^ ,]*]]) // CHECK: store i32 42, i32* %[[r]] // CHECK: invoke void @j() #[[NOINLINE]] @@ -77,7 +77,7 @@ int nested_try(void) { } return r; } -// CHECK-LABEL: define i32 @nested_try() +// CHECK-LABEL: define i32 @nested_try() {{.*}} personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) // CHECK: store i32 42, i32* %[[r:[^ ,]*]] // CHECK: invoke void @j() #[[NOINLINE]] // CHECK: to label %[[cont:[^ ]*]] unwind label %[[lpad:[^ ]*]] @@ -87,7 +87,7 @@ int nested_try(void) { // CHECK: br label %[[inner_try_cont:[^ ]*]] // // CHECK: [[lpad]] -// CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) +// CHECK: landingpad { i8*, i32 } // CHECK: catch i8* bitcast (i32 (i8*, i8*)* @"\01?filt$1@0@nested_try@@" to i8*) // CHECK: catch i8* bitcast (i32 (i8*, i8*)* @"\01?filt$0@0@nested_try@@" to i8*) // CHECK: store i8* %{{.*}}, i8** %[[ehptr_slot:[^ ]*]] @@ -125,7 +125,7 @@ void basic_finally(void) { --g; } } -// CHECK-LABEL: define void @basic_finally() +// CHECK-LABEL: define void @basic_finally() {{.*}} personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) // CHECK: load i32, i32* @g // CHECK: add i32 %{{.*}}, 1 // CHECK: store i32 %{{.*}}, i32* @g @@ -139,7 +139,7 @@ void basic_finally(void) { // CHECK: ret void // // CHECK: [[lpad]] -// CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) +// CHECK: landingpad { i8*, i32 } // CHECK-NEXT: cleanup // CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) // CHECK: call void @"\01?fin$0@0@basic_finally@@"(i8 1, i8* %[[fp]]) diff --git a/test/CodeGen/exceptions.c b/test/CodeGen/exceptions.c index ae0af4d..039ec84 100644 --- a/test/CodeGen/exceptions.c +++ b/test/CodeGen/exceptions.c @@ -5,8 +5,8 @@ void test1() { extern void test1_helper(void (^)(int)); - // CHECK-LABEL: define void @test1() - // CHECK-ARM-LABEL: define arm_aapcscc void @test1() + // CHECK-LABEL: define void @test1() {{.*}} personality i8* bitcast (i32 (...)* @__gcc_personality_v0 to i8*) + // CHECK-ARM-LABEL: define arm_aapcscc void @test1() {{.*}} personality i8* bitcast (i32 (...)* @__gcc_personality_sj0 to i8*) __block int x = 10; @@ -14,9 +14,9 @@ void test1() { // CHECK-ARM: invoke arm_aapcscc void @test1_helper( test1_helper(^(int v) { x = v; }); - // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gcc_personality_v0 to i8*) + // CHECK: landingpad { i8*, i32 } // CHECK-NEXT: cleanup - // CHECK-ARM: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gcc_personality_sj0 to i8*) + // CHECK-ARM: landingpad { i8*, i32 } // CHECK-ARM-NEXT: cleanup } diff --git a/test/CodeGen/inline-asm-immediate-ubsan.c b/test/CodeGen/inline-asm-immediate-ubsan.c new file mode 100644 index 0000000..77d5e4f --- /dev/null +++ b/test/CodeGen/inline-asm-immediate-ubsan.c @@ -0,0 +1,30 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s \ +// RUN: -fsanitize=signed-integer-overflow \ +// RUN: | FileCheck %s --check-prefix=CHECK + +// Verify we emit constants for "immediate" inline assembly arguments. +// Emitting a scalar expression can make the immediate be generated as +// overflow intrinsics, if the overflow sanitizer is enabled. + +// Check both 'i' and 'I': +// - 'i' accepts symbolic constants. +// - 'I' doesn't, and is really an immediate-required constraint. + +// See also PR23517. + +// CHECK-LABEL: @test_inlineasm_i +// CHECK: call void asm sideeffect "int $0", "i{{.*}}"(i32 2) +void test_inlineasm_i() { + __asm__ __volatile__("int %0" :: "i"(1 + 1)); +} + +// CHECK-LABEL: @test_inlineasm_I +// CHECK: call void asm sideeffect "int $0", "I{{.*}}"(i32 2) +// CHECK: call void asm sideeffect "int $0", "I{{.*}}"(i32 3) +void test_inlineasm_I() { + __asm__ __volatile__("int %0" :: "I"(1 + 1)); + + // Also check a C non-ICE. + static const int N = 1; + __asm__ __volatile__("int %0" :: "I"(N + 2)); +} diff --git a/test/CodeGen/ms-inline-asm.c b/test/CodeGen/ms-inline-asm.c index a6f1b71..d98b498 100644 --- a/test/CodeGen/ms-inline-asm.c +++ b/test/CodeGen/ms-inline-asm.c @@ -432,6 +432,8 @@ void t37() { // CHECK: mov eax, $$4294967292 __asm mov eax, ~15 // CHECK: mov eax, $$4294967280 + __asm mov eax, 6 ^ 3 +// CHECK: mov eax, $$5 // CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"() } diff --git a/test/CodeGen/partial-reinitialization1.c b/test/CodeGen/partial-reinitialization1.c new file mode 100644 index 0000000..6a764b7 --- /dev/null +++ b/test/CodeGen/partial-reinitialization1.c @@ -0,0 +1,74 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -emit-llvm -o - | FileCheck %s + +struct P1 { + struct Q1 { + char a[6]; + char b[6]; + } q; +}; + +// CHECK: { [6 x i8] c"foo\00\00\00", [6 x i8] c"\00x\00\00\00\00" } +struct P1 l1 = { + (struct Q1){ "foo", "bar" }, + .q.b = { "boo" }, + .q.b = { [1] = 'x' } +}; + +// CHECK: { [6 x i8] c"foo\00\00\00", [6 x i8] c"bxo\00\00\00" } +struct P1 l1a = { + (struct Q1){ "foo", "bar" }, + .q.b = { "boo" }, + .q.b[1] = 'x' +}; + + +struct P2 { char x[6]; }; + +// CHECK: { [6 x i8] c"n\00\00\00\00\00" } +struct P2 l2 = { + .x = { [1] = 'o' }, + .x = { [0] = 'n' } +}; + +struct P3 { + struct Q3 { + struct R1 { + int a, b, c; + } r1; + + struct R2 { + int d, e, f; + } r2; + } q; +}; + +// CHECK: @l3 = global %struct.P3 { %struct.Q3 { %struct.R1 { i32 1, i32 2, i32 3 }, %struct.R2 { i32 0, i32 10, i32 0 } } } +struct P3 l3 = { + (struct Q3){ { 1, 2, 3 }, { 4, 5, 6 } }, + .q.r2 = { 7, 8, 9 }, + .q.r2 = { .e = 10 } +}; + +// This bit is taken from Sema/wchar.c so we can avoid the wchar.h include. +typedef __WCHAR_TYPE__ wchar_t; + +struct P4 { + wchar_t x[6]; +}; + +// CHECK: { [6 x i32] [i32 102, i32 111, i32 120, i32 0, i32 0, i32 0] } +struct P4 l4 = { { L"foo" }, .x[2] = L'x' }; + +struct P5 { + int x; + struct Q5 { + int a, b, c; + } q; + int y; +}; + +// A three-pass test +// CHECK: @l5 = global %struct.P5 { i32 1, %struct.Q5 { i32 6, i32 9, i32 8 }, i32 5 } +struct P5 l5 = { 1, { 2, 3, 4 }, 5, + .q = { 6, 7, 8 }, + .q.b = 9 }; diff --git a/test/CodeGen/partial-reinitialization2.c b/test/CodeGen/partial-reinitialization2.c new file mode 100644 index 0000000..c4f6567 --- /dev/null +++ b/test/CodeGen/partial-reinitialization2.c @@ -0,0 +1,108 @@ +// RUN: %clang_cc1 %s -triple x86_64-unknown-unknown -emit-llvm -o - | FileCheck %s + +struct P1 { char x[6]; } g1 = { "foo" }; +struct LP1 { struct P1 p1; }; + +struct P2 { int a, b, c; } g2 = { 1, 2, 3 }; +struct LP2 { struct P2 p2; }; +struct LP2P2 { struct P2 p1, p2; }; +union UP2 { struct P2 p2; }; + +struct LP3 { struct P1 p1[2]; } g3 = { { "dog" }, { "cat" } }; +struct LLP3 { struct LP3 l3; }; +union ULP3 { struct LP3 l3; }; + +// CHECK-LABEL: test1 +void test1(void) +{ + // CHECK: call void @llvm.memcpy{{.*}}%struct.P1, %struct.P1* @g1{{.*}}i64 6, i32 {{[0-9]}}, i1 false) + // CHECK: store i8 120, i8* % + + struct LP1 l = { .p1 = g1, .p1.x[2] = 'x' }; +} + +// CHECK-LABEL: test2 +void test2(void) +{ + // CHECK: call void @llvm.memcpy{{.*}}%struct.P1, %struct.P1* @g1{{.*}}i64 6, i32 {{[0-9]}}, i1 false) + // CHECK: store i8 114, i8* % + + struct LP1 l = { .p1 = g1, .p1.x[1] = 'r' }; +} + +// CHECK-LABEL: test3 +void test3(void) +{ + // CHECK: call void @llvm.memcpy{{.*}}%struct.P2* @g2{{.*}}i64 12, i32 {{[0-9]}}, i1 false) + // CHECK: store i32 10, i32* % + + struct LP2 l = { .p2 = g2, .p2.b = 10 }; +} + +// CHECK-LABEL: get235 +struct P2 get235() +{ + struct P2 p = { 2, 3, 5 }; + return p; +} + +// CHECK-LABEL: get456789 +struct LP2P2 get456789() +{ + struct LP2P2 l = { { 4, 5, 6 }, { 7, 8, 9 } }; + return l; +} + +// CHECK-LABEL: get123 +union UP2 get123() +{ + union UP2 u = { { 1, 2, 3 } }; + return u; +} + +// CHECK-LABEL: test4 +void test4(void) +{ + // CHECK: [[CALL:%[a-z0-9]+]] = call {{.*}}@get123() + // CHECK: store{{.*}}[[CALL]], {{.*}}[[TMP0:%[a-z0-9]+]] + // CHECK: [[TMP1:%[a-z0-9]+]] = bitcast {{.*}}[[TMP0]] + // CHECK: call void @llvm.memcpy{{.*}}[[TMP1]], i64 12, i32 {{[0-9]}}, i1 false) + // CHECK: store i32 100, i32* % + + struct LUP2 { union UP2 up; } var = { get123(), .up.p2.a = 100 }; +} + +// CHECK-LABEL: test5 +void test5(void) +{ + // .l3 = g3 + // CHECK: call void @llvm.memcpy{{.*}}%struct.LP3, %struct.LP3* @g3{{.*}}i64 12, i32 {{[0-9]}}, i1 false) + + // .l3.p1 = { [0] = g1 } implicitly sets [1] to zero + // CHECK: call void @llvm.memcpy{{.*}}%struct.P1, %struct.P1* @g1{{.*}}i64 6, i32 {{[0-9]}}, i1 false) + // CHECK: getelementptr{{.*}}%struct.P1, %struct.P1*{{.*}}i64 1 + // CHECK: call void @llvm.memset{{.*}}i8 0, i64 6, i32 {{[0-9]}}, i1 false) + + // .l3.p1[1].x[1] = 'x' + // CHECK: store i8 120, i8* % + + struct LLP3 var = { .l3 = g3, .l3.p1 = { [0] = g1 }, .l3.p1[1].x[1] = 'x' }; +} + +// CHECK-LABEL: test6 +void test6(void) +{ + // CHECK: [[LP:%[a-z0-9]+]] = getelementptr{{.*}}%struct.LLP2P2, %struct.LLP2P2*{{.*}}, i32 0, i32 0 + // CHECK: call {{.*}}get456789(%struct.LP2P2* {{.*}}[[LP]]) + + // CHECK: [[CALL:%[a-z0-9]+]] = call {{.*}}@get235() + // CHECK: store{{.*}}[[CALL]], {{.*}}[[TMP0:%[a-z0-9]+]] + // CHECK: [[TMP1:%[a-z0-9]+]] = bitcast {{.*}}[[TMP0]] + // CHECK: call void @llvm.memcpy{{.*}}[[TMP1]], i64 12, i32 {{[0-9]}}, i1 false) + + // CHECK: store i32 10, i32* % + + struct LLP2P2 { struct LP2P2 lp; } var = { get456789(), + .lp.p1 = get235(), + .lp.p1.b = 10 }; +} diff --git a/test/CodeGen/safestack-attr.cpp b/test/CodeGen/safestack-attr.cpp new file mode 100644 index 0000000..9d1ed0d --- /dev/null +++ b/test/CodeGen/safestack-attr.cpp @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -triple x86_64-linux-unknown -emit-llvm -o - %s -fsanitize=safe-stack | FileCheck -check-prefix=SP %s + +__attribute__((no_sanitize("safe-stack"))) +int foo(int *a) { return *a; } + +// SP-NOT: attributes #{{.*}} = { {{.*}}safestack{{.*}} } diff --git a/test/CodeGen/sanitize-trap.c b/test/CodeGen/sanitize-trap.c new file mode 100644 index 0000000..76ac1f0 --- /dev/null +++ b/test/CodeGen/sanitize-trap.c @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s -fsanitize=signed-integer-overflow,integer-divide-by-zero -fsanitize-trap=integer-divide-by-zero | FileCheck %s + +int f(int x, int y) { + // CHECK: %[[B1:.*]] = icmp ne i32 %[[D:.*]], 0 + // CHECK: %[[B2:.*]] = icmp ne i32 %[[N:.*]], -2147483648 + // CHECK: %[[B3:.*]] = icmp ne i32 %[[D]], -1 + // CHECK: %[[B4:.*]] = or i1 %[[B2]], %[[B3]] + // CHECK: br i1 %[[B1]], label %[[L1:[0-9a-z_.]*]], label %[[L2:[0-9a-z_.]*]] + + // CHECK: [[L2]] + // CHECK-NEXT: call void @llvm.trap() + // CHECK-NEXT: unreachable + + // CHECK: [[L1]] + // CHECK-NEXT: br i1 %[[B4]], label %[[L3:[0-9a-z_.]*]], label %[[L4:[0-9a-z_.]*]] + + // CHECK: [[L4]] + // CHECK-NEXT: zext + // CHECK-NEXT: zext + // CHECK-NEXT: __ubsan_handle_divrem_overflow + + // CHECK: [[L3]] + // CHECK-NEXT: sdiv i32 %[[N]], %[[D]] + return x / y; +} diff --git a/test/CodeGen/stack-protector.c b/test/CodeGen/stack-protector.c index 2fb9b2c..8039b60 100644 --- a/test/CodeGen/stack-protector.c +++ b/test/CodeGen/stack-protector.c @@ -6,6 +6,8 @@ // SSPSTRONG: define void @test1(i8* %msg) #0 { // RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 3 | FileCheck -check-prefix=SSPREQ %s // SSPREQ: define void @test1(i8* %msg) #0 { +// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=safe-stack | FileCheck -check-prefix=SAFESTACK %s +// SAFESTACK: define void @test1(i8* %msg) #0 { typedef __SIZE_TYPE__ size_t; @@ -26,3 +28,5 @@ void test1(const char *msg) { // SSPSTRONG: attributes #{{.*}} = { nounwind sspstrong{{.*}} } // SSPREQ: attributes #{{.*}} = { nounwind sspreq{{.*}} } + +// SAFESTACK: attributes #{{.*}} = { nounwind safestack{{.*}} } diff --git a/test/CodeGen/systemz-inline-asm.c b/test/CodeGen/systemz-inline-asm.c index 92ed4bb..7d5a6b2 100644 --- a/test/CodeGen/systemz-inline-asm.c +++ b/test/CodeGen/systemz-inline-asm.c @@ -6,31 +6,31 @@ unsigned long gl; void test_store_m(unsigned int i) { asm("st %1, %0" : "=m" (gi) : "r" (i)); // CHECK-LABEL: define void @test_store_m(i32 zeroext %i) -// CHECK: call void asm "st $1, $0", "=*m,r"(i32* @gi, i32 %i) +// CHECK: call void asm "st $1, $0", "=*m,r"(i32* nonnull @gi, i32 %i) } void test_store_Q(unsigned int i) { asm("st %1, %0" : "=Q" (gi) : "r" (i)); // CHECK-LABEL: define void @test_store_Q(i32 zeroext %i) -// CHECK: call void asm "st $1, $0", "=*Q,r"(i32* @gi, i32 %i) +// CHECK: call void asm "st $1, $0", "=*Q,r"(i32* nonnull @gi, i32 %i) } void test_store_R(unsigned int i) { asm("st %1, %0" : "=R" (gi) : "r" (i)); // CHECK-LABEL: define void @test_store_R(i32 zeroext %i) -// CHECK: call void asm "st $1, $0", "=*R,r"(i32* @gi, i32 %i) +// CHECK: call void asm "st $1, $0", "=*R,r"(i32* nonnull @gi, i32 %i) } void test_store_S(unsigned int i) { asm("st %1, %0" : "=S" (gi) : "r" (i)); // CHECK-LABEL: define void @test_store_S(i32 zeroext %i) -// CHECK: call void asm "st $1, $0", "=*S,r"(i32* @gi, i32 %i) +// CHECK: call void asm "st $1, $0", "=*S,r"(i32* nonnull @gi, i32 %i) } void test_store_T(unsigned int i) { asm("st %1, %0" : "=T" (gi) : "r" (i)); // CHECK-LABEL: define void @test_store_T(i32 zeroext %i) -// CHECK: call void asm "st $1, $0", "=*T,r"(i32* @gi, i32 %i) +// CHECK: call void asm "st $1, $0", "=*T,r"(i32* nonnull @gi, i32 %i) } int test_load_m() { @@ -38,7 +38,7 @@ int test_load_m() { asm("l %0, %1" : "=r" (i) : "m" (gi)); return i; // CHECK-LABEL: define signext i32 @test_load_m() -// CHECK: call i32 asm "l $0, $1", "=r,*m"(i32* @gi) +// CHECK: call i32 asm "l $0, $1", "=r,*m"(i32* nonnull @gi) } int test_load_Q() { @@ -46,7 +46,7 @@ int test_load_Q() { asm("l %0, %1" : "=r" (i) : "Q" (gi)); return i; // CHECK-LABEL: define signext i32 @test_load_Q() -// CHECK: call i32 asm "l $0, $1", "=r,*Q"(i32* @gi) +// CHECK: call i32 asm "l $0, $1", "=r,*Q"(i32* nonnull @gi) } int test_load_R() { @@ -54,7 +54,7 @@ int test_load_R() { asm("l %0, %1" : "=r" (i) : "R" (gi)); return i; // CHECK-LABEL: define signext i32 @test_load_R() -// CHECK: call i32 asm "l $0, $1", "=r,*R"(i32* @gi) +// CHECK: call i32 asm "l $0, $1", "=r,*R"(i32* nonnull @gi) } int test_load_S() { @@ -62,7 +62,7 @@ int test_load_S() { asm("l %0, %1" : "=r" (i) : "S" (gi)); return i; // CHECK-LABEL: define signext i32 @test_load_S() -// CHECK: call i32 asm "l $0, $1", "=r,*S"(i32* @gi) +// CHECK: call i32 asm "l $0, $1", "=r,*S"(i32* nonnull @gi) } int test_load_T() { @@ -70,7 +70,7 @@ int test_load_T() { asm("l %0, %1" : "=r" (i) : "T" (gi)); return i; // CHECK-LABEL: define signext i32 @test_load_T() -// CHECK: call i32 asm "l $0, $1", "=r,*T"(i32* @gi) +// CHECK: call i32 asm "l $0, $1", "=r,*T"(i32* nonnull @gi) } void test_mI(unsigned char *c) { diff --git a/test/CodeGen/target-data.c b/test/CodeGen/target-data.c index d601158..3c3ea04 100644 --- a/test/CodeGen/target-data.c +++ b/test/CodeGen/target-data.c @@ -174,3 +174,11 @@ // RUN: %clang_cc1 -triple spir64-unknown -o - -emit-llvm %s | \ // RUN: FileCheck %s -check-prefix=SPIR64 // SPIR64: target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024" + +// RUN: %clang_cc1 -triple bpfel -o - -emit-llvm %s | \ +// RUN: FileCheck %s -check-prefix=BPFEL +// BPFEL: target datalayout = "e-m:e-p:64:64-i64:64-n32:64-S128" + +// RUN: %clang_cc1 -triple bpfeb -o - -emit-llvm %s | \ +// RUN: FileCheck %s -check-prefix=BPFEB +// BPFEB: target datalayout = "E-m:e-p:64:64-i64:64-n32:64-S128" diff --git a/test/CodeGenCXX/arm.cpp b/test/CodeGenCXX/arm.cpp index 7d94cba..0fadfe9 100644 --- a/test/CodeGenCXX/arm.cpp +++ b/test/CodeGenCXX/arm.cpp @@ -291,7 +291,7 @@ namespace test7 { // Static and guard tested at top of file - // CHECK-LABEL: define void @_ZN5test74testEv() + // CHECK-LABEL: define void @_ZN5test74testEv() {{.*}} personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) void test() { // CHECK: [[T0:%.*]] = load atomic i8, i8* bitcast (i32* @_ZGVZN5test74testEvE1x to i8*) acquire, align 1 // CHECK-NEXT: [[T1:%.*]] = and i8 [[T0]], 1 @@ -311,7 +311,7 @@ namespace test7 { // CHECK: ret void static int x = foo(); - // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK: landingpad { i8*, i32 } // CHECK-NEXT: cleanup // CHECK: call void @__cxa_guard_abort(i32* @_ZGVZN5test74testEvE1x) // CHECK: resume { i8*, i32 } @@ -326,7 +326,7 @@ namespace test8 { // Static and guard tested at top of file - // CHECK-LABEL: define void @_ZN5test84testEv() + // CHECK-LABEL: define void @_ZN5test84testEv() {{.*}} personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) void test() { // CHECK: [[T0:%.*]] = load atomic i8, i8* bitcast (i32* @_ZGVZN5test84testEvE1x to i8*) acquire, align 1 // CHECK-NEXT: [[T1:%.*]] = and i8 [[T0]], 1 @@ -351,7 +351,7 @@ namespace test8 { // CHECK: ret void static A x; - // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK: landingpad { i8*, i32 } // CHECK-NEXT: cleanup // CHECK: call void @__cxa_guard_abort(i32* @_ZGVZN5test84testEvE1x) // CHECK: resume { i8*, i32 } diff --git a/test/CodeGenCXX/atomicinit.cpp b/test/CodeGenCXX/atomicinit.cpp index a47099c..5e5174b 100644 --- a/test/CodeGenCXX/atomicinit.cpp +++ b/test/CodeGenCXX/atomicinit.cpp @@ -65,15 +65,15 @@ namespace PR18097 { }; // CHECK-LABEL: define {{.*}} @__cxx_global_var_init - // CHECK: call void @_ZN7PR180977dynamic1XC1Ei({{.*}}* @_ZN7PR180977dynamic1aE, i32 1) + // CHECK: call void @_ZN7PR180977dynamic1XC1Ei({{.*}}* nonnull @_ZN7PR180977dynamic1aE, i32 1) _Atomic(X) a = X(1); // CHECK-LABEL: define {{.*}} @__cxx_global_var_init - // CHECK: call void @_ZN7PR180977dynamic1XC1Ei({{.*}}* @_ZN7PR180977dynamic1bE, i32 2) + // CHECK: call void @_ZN7PR180977dynamic1XC1Ei({{.*}}* nonnull @_ZN7PR180977dynamic1bE, i32 2) _Atomic(X) b(X(2)); // CHECK-LABEL: define {{.*}} @__cxx_global_var_init - // CHECK: call void @_ZN7PR180977dynamic1XC1Ei({{.*}}* @_ZN7PR180977dynamic1cE, i32 3) + // CHECK: call void @_ZN7PR180977dynamic1XC1Ei({{.*}}* nonnull @_ZN7PR180977dynamic1cE, i32 3) _Atomic(X) c{X(3)}; struct Y { diff --git a/test/CodeGenCXX/cfi-cast.cpp b/test/CodeGenCXX/cfi-cast.cpp index c671bad..0908963 100644 --- a/test/CodeGenCXX/cfi-cast.cpp +++ b/test/CodeGenCXX/cfi-cast.cpp @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-derived-cast -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-DCAST %s -// RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-unrelated-cast -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-UCAST %s -// RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-unrelated-cast,cfi-cast-strict -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-UCAST-STRICT %s +// RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-derived-cast -fsanitize-trap=cfi-derived-cast -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-DCAST %s +// RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-unrelated-cast -fsanitize-trap=cfi-unrelated-cast -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-UCAST %s +// RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-unrelated-cast,cfi-cast-strict -fsanitize-trap=cfi-unrelated-cast,cfi-cast-strict -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-UCAST-STRICT %s // In this test the main thing we are searching for is something like // 'metadata !"1B"' where "1B" is the mangled name of the class we are @@ -19,7 +19,7 @@ struct C : A {}; // CHECK-DCAST-LABEL: define void @_Z3abpP1A void abp(A *a) { // CHECK-DCAST: [[P:%[^ ]*]] = call i1 @llvm.bitset.test(i8* {{%[^ ]*}}, metadata !"1B") - // CHECK-DCAST-NEXT: br i1 [[P]], label %[[CONTBB:[^ ]*]], label %[[TRAPBB:[^ ]*]] + // CHECK-DCAST-NEXT: br i1 [[P]], label %[[CONTBB:[^ ]*]], label %[[TRAPBB:[^ ,]*]] // CHECK-DCAST: [[TRAPBB]] // CHECK-DCAST-NEXT: call void @llvm.trap() @@ -33,7 +33,7 @@ void abp(A *a) { // CHECK-DCAST-LABEL: define void @_Z3abrR1A void abr(A &a) { // CHECK-DCAST: [[P:%[^ ]*]] = call i1 @llvm.bitset.test(i8* {{%[^ ]*}}, metadata !"1B") - // CHECK-DCAST-NEXT: br i1 [[P]], label %[[CONTBB:[^ ]*]], label %[[TRAPBB:[^ ]*]] + // CHECK-DCAST-NEXT: br i1 [[P]], label %[[CONTBB:[^ ]*]], label %[[TRAPBB:[^ ,]*]] // CHECK-DCAST: [[TRAPBB]] // CHECK-DCAST-NEXT: call void @llvm.trap() @@ -47,7 +47,7 @@ void abr(A &a) { // CHECK-DCAST-LABEL: define void @_Z4abrrO1A void abrr(A &&a) { // CHECK-DCAST: [[P:%[^ ]*]] = call i1 @llvm.bitset.test(i8* {{%[^ ]*}}, metadata !"1B") - // CHECK-DCAST-NEXT: br i1 [[P]], label %[[CONTBB:[^ ]*]], label %[[TRAPBB:[^ ]*]] + // CHECK-DCAST-NEXT: br i1 [[P]], label %[[CONTBB:[^ ]*]], label %[[TRAPBB:[^ ,]*]] // CHECK-DCAST: [[TRAPBB]] // CHECK-DCAST-NEXT: call void @llvm.trap() @@ -61,7 +61,7 @@ void abrr(A &&a) { // CHECK-UCAST-LABEL: define void @_Z3vbpPv void vbp(void *p) { // CHECK-UCAST: [[P:%[^ ]*]] = call i1 @llvm.bitset.test(i8* {{%[^ ]*}}, metadata !"1B") - // CHECK-UCAST-NEXT: br i1 [[P]], label %[[CONTBB:[^ ]*]], label %[[TRAPBB:[^ ]*]] + // CHECK-UCAST-NEXT: br i1 [[P]], label %[[CONTBB:[^ ]*]], label %[[TRAPBB:[^ ,]*]] // CHECK-UCAST: [[TRAPBB]] // CHECK-UCAST-NEXT: call void @llvm.trap() @@ -75,7 +75,7 @@ void vbp(void *p) { // CHECK-UCAST-LABEL: define void @_Z3vbrRc void vbr(char &r) { // CHECK-UCAST: [[P:%[^ ]*]] = call i1 @llvm.bitset.test(i8* {{%[^ ]*}}, metadata !"1B") - // CHECK-UCAST-NEXT: br i1 [[P]], label %[[CONTBB:[^ ]*]], label %[[TRAPBB:[^ ]*]] + // CHECK-UCAST-NEXT: br i1 [[P]], label %[[CONTBB:[^ ]*]], label %[[TRAPBB:[^ ,]*]] // CHECK-UCAST: [[TRAPBB]] // CHECK-UCAST-NEXT: call void @llvm.trap() @@ -89,7 +89,7 @@ void vbr(char &r) { // CHECK-UCAST-LABEL: define void @_Z4vbrrOc void vbrr(char &&r) { // CHECK-UCAST: [[P:%[^ ]*]] = call i1 @llvm.bitset.test(i8* {{%[^ ]*}}, metadata !"1B") - // CHECK-UCAST-NEXT: br i1 [[P]], label %[[CONTBB:[^ ]*]], label %[[TRAPBB:[^ ]*]] + // CHECK-UCAST-NEXT: br i1 [[P]], label %[[CONTBB:[^ ]*]], label %[[TRAPBB:[^ ,]*]] // CHECK-UCAST: [[TRAPBB]] // CHECK-UCAST-NEXT: call void @llvm.trap() diff --git a/test/CodeGenCXX/cfi-vcall.cpp b/test/CodeGenCXX/cfi-vcall.cpp index b0f79d9..333c7bd 100644 --- a/test/CodeGenCXX/cfi-vcall.cpp +++ b/test/CodeGenCXX/cfi-vcall.cpp @@ -1,4 +1,15 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-vcall -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-vcall -fsanitize-trap=cfi-vcall -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=ITANIUM --check-prefix=NDIAG %s +// RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-vcall -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=ITANIUM --check-prefix=DIAG --check-prefix=DIAG-ABORT %s +// RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-vcall -fsanitize-recover=cfi-vcall -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=ITANIUM --check-prefix=DIAG --check-prefix=DIAG-RECOVER %s +// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -fsanitize=cfi-vcall -fsanitize-trap=cfi-vcall -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=MS --check-prefix=NDIAG %s + +// MS: @[[VTA:[0-9]*]] {{.*}} comdat($"\01??_7A@@6B@") +// MS: @[[VTB:[0-9]*]] {{.*}} comdat($"\01??_7B@@6B0@@") +// MS: @[[VTAinB:[0-9]*]] {{.*}} comdat($"\01??_7B@@6BA@@@") +// MS: @[[VTAinC:[0-9]*]] {{.*}} comdat($"\01??_7C@@6B@") +// MS: @[[VTBinD:[0-9]*]] {{.*}} comdat($"\01??_7D@?A@@6BB@@@") +// MS: @[[VTAinBinD:[0-9]*]] {{.*}} comdat($"\01??_7D@?A@@6BA@@@") +// MS: @[[VTFA:[0-9]*]] {{.*}} comdat($"\01??_7FA@?1??foo@@YAXXZ@6B@") struct A { A(); @@ -7,6 +18,8 @@ struct A { struct B : virtual A { B(); + virtual void g(); + virtual void h(); }; struct C : virtual A { @@ -18,6 +31,7 @@ namespace { struct D : B, C { D(); virtual void f(); + virtual void h(); }; } @@ -30,37 +44,75 @@ D::D() {} void A::f() { } +void B::g() { +} + void D::f() { } -// CHECK: define void @_Z2afP1A +void D::h() { +} + +// DIAG: @[[SRC:.*]] = private unnamed_addr constant [{{.*}} x i8] c"{{.*}}cfi-vcall.cpp\00", align 1 +// DIAG: @[[TYPE:.*]] = private unnamed_addr constant { i16, i16, [4 x i8] } { i16 -1, i16 0, [4 x i8] c"'A'\00" } +// DIAG: @[[BADTYPESTATIC:.*]] = private unnamed_addr global { { [{{.*}} x i8]*, i32, i32 }, { i16, i16, [4 x i8] }*, i8 } { { [{{.*}} x i8]*, i32, i32 } { [{{.*}} x i8]* @[[SRC]], i32 [[@LINE+21]], i32 3 }, { i16, i16, [4 x i8] }* @[[TYPE]], i8 0 } + +// ITANIUM: define void @_Z2afP1A +// MS: define void @"\01?af@@YAXPEAUA@@@Z" void af(A *a) { - // CHECK: [[P:%[^ ]*]] = call i1 @llvm.bitset.test(i8* {{%[^ ]*}}, metadata !"1A") - // CHECK-NEXT: br i1 [[P]], label %[[CONTBB:[^ ]*]], label %[[TRAPBB:[^ ]*]] + // ITANIUM: [[P:%[^ ]*]] = call i1 @llvm.bitset.test(i8* [[VT:%[^ ]*]], metadata !"1A") + // MS: [[P:%[^ ]*]] = call i1 @llvm.bitset.test(i8* [[VT:%[^ ]*]], metadata !"A@@") + // CHECK-NEXT: br i1 [[P]], label %[[CONTBB:[^ ,]*]], label %[[TRAPBB:[^ ,]*]] + // CHECK-NEXT: {{^$}} // CHECK: [[TRAPBB]] - // CHECK-NEXT: call void @llvm.trap() - // CHECK-NEXT: unreachable + // NDIAG-NEXT: call void @llvm.trap() + // NDIAG-NEXT: unreachable + // DIAG-NEXT: [[VTINT:%[^ ]*]] = ptrtoint i8* [[VT]] to i64 + // DIAG-ABORT-NEXT: call void @__ubsan_handle_cfi_bad_type_abort(i8* bitcast ({{.*}} @[[BADTYPESTATIC]] to i8*), i64 [[VTINT]]) + // DIAG-ABORT-NEXT: unreachable + // DIAG-RECOVER-NEXT: call void @__ubsan_handle_cfi_bad_type(i8* bitcast ({{.*}} @[[BADTYPESTATIC]] to i8*), i64 [[VTINT]]) + // DIAG-RECOVER-NEXT: br label %[[CONTBB]] // CHECK: [[CONTBB]] // CHECK: call void % a->f(); } -// CHECK: define internal void @_Z3df1PN12_GLOBAL__N_11DE +// ITANIUM: define internal void @_Z3df1PN12_GLOBAL__N_11DE +// MS: define internal void @"\01?df1@@YAXPEAUD@?A@@@Z" void df1(D *d) { - // CHECK: {{%[^ ]*}} = call i1 @llvm.bitset.test(i8* {{%[^ ]*}}, metadata !"[{{.*}}cfi-vcall.cpp]N12_GLOBAL__N_11DE") + // ITANIUM: {{%[^ ]*}} = call i1 @llvm.bitset.test(i8* {{%[^ ]*}}, metadata !"[{{.*}}cfi-vcall.cpp]N12_GLOBAL__N_11DE") + // MS: {{%[^ ]*}} = call i1 @llvm.bitset.test(i8* {{%[^ ]*}}, metadata !"A@@") d->f(); } -// CHECK: define internal void @_Z3df2PN12_GLOBAL__N_11DE +// ITANIUM: define internal void @_Z3dg1PN12_GLOBAL__N_11DE +// MS: define internal void @"\01?dg1@@YAXPEAUD@?A@@@Z" +void dg1(D *d) { + // ITANIUM: {{%[^ ]*}} = call i1 @llvm.bitset.test(i8* {{%[^ ]*}}, metadata !"1B") + // MS: {{%[^ ]*}} = call i1 @llvm.bitset.test(i8* {{%[^ ]*}}, metadata !"B@@") + d->g(); +} + +// ITANIUM: define internal void @_Z3dh1PN12_GLOBAL__N_11DE +// MS: define internal void @"\01?dh1@@YAXPEAUD@?A@@@Z" +void dh1(D *d) { + // ITANIUM: {{%[^ ]*}} = call i1 @llvm.bitset.test(i8* {{%[^ ]*}}, metadata !"[{{.*}}cfi-vcall.cpp]N12_GLOBAL__N_11DE") + // MS: {{%[^ ]*}} = call i1 @llvm.bitset.test(i8* {{%[^ ]*}}, metadata !"[{{.*}}cfi-vcall.cpp]D@?A@@") + d->h(); +} + +// ITANIUM: define internal void @_Z3df2PN12_GLOBAL__N_11DE +// MS: define internal void @"\01?df2@@YAXPEAUD@?A@@@Z" __attribute__((no_sanitize("cfi"))) void df2(D *d) { // CHECK-NOT: call i1 @llvm.bitset.test d->f(); } -// CHECK: define internal void @_Z3df3PN12_GLOBAL__N_11DE +// ITANIUM: define internal void @_Z3df3PN12_GLOBAL__N_11DE +// MS: define internal void @"\01?df3@@YAXPEAUD@?A@@@Z" __attribute__((no_sanitize("address"))) __attribute__((no_sanitize("cfi-vcall"))) void df3(D *d) { // CHECK-NOT: call i1 @llvm.bitset.test @@ -71,20 +123,43 @@ D d; void foo() { df1(&d); + dg1(&d); + dh1(&d); df2(&d); df3(&d); + + struct FA : A { + void f() {} + } fa; + af(&fa); } -// CHECK-DAG: !{!"1A", [3 x i8*]* @_ZTV1A, i64 16} -// CHECK-DAG: !{!"1A", [5 x i8*]* @_ZTCN12_GLOBAL__N_11DE0_1B, i64 32} -// CHECK-DAG: !{!"1B", [5 x i8*]* @_ZTCN12_GLOBAL__N_11DE0_1B, i64 32} -// CHECK-DAG: !{!"1A", [9 x i8*]* @_ZTCN12_GLOBAL__N_11DE8_1C, i64 64} -// CHECK-DAG: !{!"1C", [9 x i8*]* @_ZTCN12_GLOBAL__N_11DE8_1C, i64 32} -// CHECK-DAG: !{!"1A", [10 x i8*]* @_ZTVN12_GLOBAL__N_11DE, i64 32} -// CHECK-DAG: !{!"1B", [10 x i8*]* @_ZTVN12_GLOBAL__N_11DE, i64 32} -// CHECK-DAG: !{!"1C", [10 x i8*]* @_ZTVN12_GLOBAL__N_11DE, i64 72} -// CHECK-DAG: !{!"[{{.*}}cfi-vcall.cpp]N12_GLOBAL__N_11DE", [10 x i8*]* @_ZTVN12_GLOBAL__N_11DE, i64 32} -// CHECK-DAG: !{!"1A", [5 x i8*]* @_ZTV1B, i64 32} -// CHECK-DAG: !{!"1B", [5 x i8*]* @_ZTV1B, i64 32} -// CHECK-DAG: !{!"1A", [5 x i8*]* @_ZTV1C, i64 32} -// CHECK-DAG: !{!"1C", [5 x i8*]* @_ZTV1C, i64 32} +// Check for the expected number of elements (9 or 15 respectively). +// MS: !llvm.bitsets = !{[[X:[^,]*(,[^,]*){8}]]} +// ITANIUM: !llvm.bitsets = !{[[X:[^,]*(,[^,]*){14}]]} + +// ITANIUM-DAG: !{!"1A", [3 x i8*]* @_ZTV1A, i64 16} +// ITANIUM-DAG: !{!"1A", [7 x i8*]* @_ZTCN12_GLOBAL__N_11DE0_1B, i64 32} +// ITANIUM-DAG: !{!"1B", [7 x i8*]* @_ZTCN12_GLOBAL__N_11DE0_1B, i64 32} +// ITANIUM-DAG: !{!"1A", [9 x i8*]* @_ZTCN12_GLOBAL__N_11DE8_1C, i64 64} +// ITANIUM-DAG: !{!"1C", [9 x i8*]* @_ZTCN12_GLOBAL__N_11DE8_1C, i64 32} +// ITANIUM-DAG: !{!"1A", [12 x i8*]* @_ZTVN12_GLOBAL__N_11DE, i64 32} +// ITANIUM-DAG: !{!"1B", [12 x i8*]* @_ZTVN12_GLOBAL__N_11DE, i64 32} +// ITANIUM-DAG: !{!"1C", [12 x i8*]* @_ZTVN12_GLOBAL__N_11DE, i64 88} +// ITANIUM-DAG: !{!"[{{.*}}cfi-vcall.cpp]N12_GLOBAL__N_11DE", [12 x i8*]* @_ZTVN12_GLOBAL__N_11DE, i64 32} +// ITANIUM-DAG: !{!"1A", [7 x i8*]* @_ZTV1B, i64 32} +// ITANIUM-DAG: !{!"1B", [7 x i8*]* @_ZTV1B, i64 32} +// ITANIUM-DAG: !{!"1A", [5 x i8*]* @_ZTV1C, i64 32} +// ITANIUM-DAG: !{!"1C", [5 x i8*]* @_ZTV1C, i64 32} +// ITANIUM-DAG: !{!"1A", [3 x i8*]* @_ZTVZ3foovE2FA, i64 16} +// ITANIUM-DAG: !{!"[{{.*}}cfi-vcall.cpp]Z3foovE2FA", [3 x i8*]* @_ZTVZ3foovE2FA, i64 16} + +// MS-DAG: !{!"A@@", [2 x i8*]* @[[VTA]], i64 8} +// MS-DAG: !{!"B@@", [3 x i8*]* @[[VTB]], i64 8} +// MS-DAG: !{!"A@@", [2 x i8*]* @[[VTAinB]], i64 8} +// MS-DAG: !{!"A@@", [2 x i8*]* @[[VTAinC]], i64 8} +// MS-DAG: !{!"B@@", [3 x i8*]* @[[VTBinD]], i64 8} +// MS-DAG: !{!"[{{.*}}cfi-vcall.cpp]D@?A@@", [3 x i8*]* @[[VTBinD]], i64 8} +// MS-DAG: !{!"A@@", [2 x i8*]* @[[VTAinBinD]], i64 8} +// MS-DAG: !{!"A@@", [2 x i8*]* @[[VTFA]], i64 8} +// MS-DAG: !{!"[{{.*}}cfi-vcall.cpp]FA@?1??foo@@YAXXZ@", [2 x i8*]* @[[VTFA]], i64 8} diff --git a/test/CodeGenCXX/ctor-globalopt.cpp b/test/CodeGenCXX/ctor-globalopt.cpp index 672fc90..26ec523 100644 --- a/test/CodeGenCXX/ctor-globalopt.cpp +++ b/test/CodeGenCXX/ctor-globalopt.cpp @@ -13,7 +13,7 @@ // CHECK-LABEL: define internal void @_GLOBAL__sub_I_ctor_globalopt.cpp() // CHECK: call void @ -// CHECK-NOT: call +// CHECK-NOT: call{{ }} // O1: @llvm.global_ctors = appending global [0 x { i32, void ()*, i8* }] zeroinitializer diff --git a/test/CodeGenCXX/cxx11-exception-spec.cpp b/test/CodeGenCXX/cxx11-exception-spec.cpp index 3fb5c15..a3dff79 100644 --- a/test/CodeGenCXX/cxx11-exception-spec.cpp +++ b/test/CodeGenCXX/cxx11-exception-spec.cpp @@ -13,7 +13,7 @@ template<typename T> struct S { // CHECK: define {{.*}} @_Z1fIsEvv() [[NONE:#[0-9]+]] { template<> void f<short>() { h(); } -// CHECK: define {{.*}} @_Z1fIA2_sEvv() [[NUW:#[0-9]+]] { +// CHECK: define {{.*}} @_Z1fIA2_sEvv() [[NUW:#[0-9]+]] personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { template<> void f<short[2]>() noexcept { h(); } // CHECK: define {{.*}} @_ZN1SIsE1fEv() @@ -24,7 +24,7 @@ template<> void S<short[2]>::f() noexcept { h(); } // CHECK: define {{.*}} @_Z1fIDsEvv() [[NONE]] comdat { template void f<char16_t>(); -// CHECK: define {{.*}} @_Z1fIA2_DsEvv() [[NUW]] comdat { +// CHECK: define {{.*}} @_Z1fIA2_DsEvv() [[NUW]] comdat personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { template void f<char16_t[2]>(); // CHECK: define {{.*}} @_ZN1SIDsE1fEv() @@ -34,7 +34,7 @@ template void S<char16_t>::f(); template void S<char16_t[2]>::f(); void h() { - // CHECK: define {{.*}} @_Z1fIiEvv() [[NUW]] comdat { + // CHECK: define {{.*}} @_Z1fIiEvv() [[NUW]] comdat personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { f<int>(); // CHECK: define {{.*}} @_Z1fIA2_iEvv() [[NONE]] comdat { f<int[2]>(); @@ -45,7 +45,7 @@ void h() { // CHECK-NOT: [[NUW]] S<int[2]>::f(); - // CHECK: define {{.*}} @_Z1fIfEvv() [[NUW]] comdat { + // CHECK: define {{.*}} @_Z1fIfEvv() [[NUW]] comdat personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { void (*f1)() = &f<float>; // CHECK: define {{.*}} @_Z1fIdEvv() [[NONE]] comdat { void (*f2)() = &f<double>; @@ -56,7 +56,7 @@ void h() { // CHECK-NOT: [[NUW]] void (*f4)() = &S<double>::f; - // CHECK: define {{.*}} @_Z1fIA4_cEvv() [[NUW]] comdat { + // CHECK: define {{.*}} @_Z1fIA4_cEvv() [[NUW]] comdat personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { (void)&f<char[4]>; // CHECK: define {{.*}} @_Z1fIcEvv() [[NONE]] comdat { (void)&f<char>; diff --git a/test/CodeGenCXX/destructors.cpp b/test/CodeGenCXX/destructors.cpp index 2918cf3..b47c6c6 100644 --- a/test/CodeGenCXX/destructors.cpp +++ b/test/CodeGenCXX/destructors.cpp @@ -191,10 +191,11 @@ namespace test3 { // CHECK4: ret void // CHECK4-LABEL: define internal void @_ZN5test312_GLOBAL__N_11DD0Ev(%"struct.test3::(anonymous namespace)::D"* %this) unnamed_addr + // CHECK4-SAME: personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) // CHECK4: invoke void {{.*}} @_ZN5test312_GLOBAL__N_11CD2Ev // CHECK4: call void @_ZdlPv({{.*}}) [[NUW:#[0-9]+]] // CHECK4: ret void - // CHECK4: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK4: landingpad { i8*, i32 } // CHECK4-NEXT: cleanup // CHECK4: call void @_ZdlPv({{.*}}) [[NUW]] // CHECK4: resume { i8*, i32 } @@ -210,10 +211,11 @@ namespace test3 { // CHECK4: ret void // CHECK4-LABEL: define internal void @_ZN5test312_GLOBAL__N_11CD0Ev(%"struct.test3::(anonymous namespace)::C"* %this) unnamed_addr + // CHECK4-SAME: personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) // CHECK4: invoke void @_ZN5test312_GLOBAL__N_11CD2Ev( // CHECK4: call void @_ZdlPv({{.*}}) [[NUW]] // CHECK4: ret void - // CHECK4: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK4: landingpad { i8*, i32 } // CHECK4-NEXT: cleanup // CHECK4: call void @_ZdlPv({{.*}}) [[NUW]] // CHECK4: resume { i8*, i32 } diff --git a/test/CodeGenCXX/dllexport.cpp b/test/CodeGenCXX/dllexport.cpp index 477e7dc..0eb6476 100644 --- a/test/CodeGenCXX/dllexport.cpp +++ b/test/CodeGenCXX/dllexport.cpp @@ -532,6 +532,22 @@ struct __declspec(dllexport) InheritFromTemplate : SomeTemplate<int> {}; // M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_F?$SomeTemplate@H@@QAEXXZ" +namespace PR23801 { +template <typename> +struct S { + ~S() {} +}; +struct A { + A(int); + S<int> s; +}; +struct __declspec(dllexport) B { + B(A = 0) {} +}; +} +// +// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FB@PR23801@@QAEXXZ" + struct __declspec(dllexport) T { // Copy assignment operator: // M32-DAG: define weak_odr dllexport x86_thiscallcc dereferenceable({{[0-9]+}}) %struct.T* @"\01??4T@@QAEAAU0@ABU0@@Z" diff --git a/test/CodeGenCXX/dynamic-cast.cpp b/test/CodeGenCXX/dynamic-cast.cpp index fe85e21..9467f3e 100644 --- a/test/CodeGenCXX/dynamic-cast.cpp +++ b/test/CodeGenCXX/dynamic-cast.cpp @@ -3,6 +3,7 @@ struct A { virtual void f(); }; struct B : A { }; // CHECK: {{define.*@_Z1fP1A}} +// CHECK-SAME: personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) B fail; const B& f(A *a) { try { @@ -11,7 +12,7 @@ const B& f(A *a) { // CHECK: invoke void @__cxa_bad_cast() [[NR:#[0-9]+]] dynamic_cast<const B&>(*a); } catch (...) { - // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK: landingpad { i8*, i32 } // CHECK-NEXT: catch i8* null } return fail; diff --git a/test/CodeGenCXX/eh.cpp b/test/CodeGenCXX/eh.cpp index 77655f0..b44e814 100644 --- a/test/CodeGenCXX/eh.cpp +++ b/test/CodeGenCXX/eh.cpp @@ -102,6 +102,7 @@ namespace test6 { // PR7127 namespace test7 { // CHECK-LABEL: define i32 @_ZN5test73fooEv() +// CHECK-SAME: personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) int foo() { // CHECK: [[CAUGHTEXNVAR:%.*]] = alloca i8* // CHECK-NEXT: [[SELECTORVAR:%.*]] = alloca i32 @@ -115,7 +116,7 @@ namespace test7 { throw 1; } -// CHECK: [[CAUGHTVAL:%.*]] = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) +// CHECK: [[CAUGHTVAL:%.*]] = landingpad { i8*, i32 } // CHECK-NEXT: catch i8* bitcast (i8** @_ZTIi to i8*) // CHECK-NEXT: catch i8* null // CHECK-NEXT: [[CAUGHTEXN:%.*]] = extractvalue { i8*, i32 } [[CAUGHTVAL]], 0 @@ -137,7 +138,7 @@ namespace test7 { throw; } } -// CHECK: [[CAUGHTVAL:%.*]] = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) +// CHECK: [[CAUGHTVAL:%.*]] = landingpad { i8*, i32 } // CHECK-NEXT: catch i8* null // CHECK-NEXT: [[CAUGHTEXN:%.*]] = extractvalue { i8*, i32 } [[CAUGHTVAL]], 0 // CHECK-NEXT: store i8* [[CAUGHTEXN]], i8** [[CAUGHTEXNVAR]] @@ -186,11 +187,12 @@ namespace test9 { // CHECK-LABEL: define void @_ZN5test91AC2Ev(%"struct.test9::A"* %this) unnamed_addr + // CHECK-SAME: personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) A::A() try { // CHECK: invoke void @_ZN5test96opaqueEv() opaque(); } catch (int x) { - // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK: landingpad { i8*, i32 } // CHECK-NEXT: catch i8* bitcast (i8** @_ZTIi to i8*) // CHECK: call i8* @__cxa_begin_catch diff --git a/test/CodeGenCXX/exceptions-seh.cpp b/test/CodeGenCXX/exceptions-seh.cpp index 3e77f12..2cee4f7 100644 --- a/test/CodeGenCXX/exceptions-seh.cpp +++ b/test/CodeGenCXX/exceptions-seh.cpp @@ -22,6 +22,7 @@ extern "C" void use_cxx() { // Make sure we use __CxxFrameHandler3 for C++ EH. // CXXEH-LABEL: define void @use_cxx() +// CXXEH-SAME: personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) // CXXEH: call %struct.HasCleanup* @"\01??0HasCleanup@@QEAA@XZ"(%struct.HasCleanup* %{{.*}}) // CXXEH: invoke void @might_throw() // CXXEH: to label %[[cont:[^ ]*]] unwind label %[[lpad:[^ ]*]] @@ -31,7 +32,7 @@ extern "C" void use_cxx() { // CXXEH: ret void // // CXXEH: [[lpad]] -// CXXEH: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) +// CXXEH: landingpad { i8*, i32 } // CXXEH-NEXT: cleanup // CXXEH: call void @"\01??1HasCleanup@@QEAA@XZ"(%struct.HasCleanup* %{{.*}}) // CXXEH: br label %[[resume:[^ ]*]] @@ -59,6 +60,7 @@ extern "C" void use_seh() { // Make sure we use __C_specific_handler for SEH. // CHECK-LABEL: define void @use_seh() +// CHECK-SAME: personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) // CHECK: invoke void @might_throw() #[[NOINLINE:[0-9]+]] // CHECK: to label %[[cont:[^ ]*]] unwind label %[[lpad:[^ ]*]] // @@ -66,7 +68,7 @@ extern "C" void use_seh() { // CHECK: br label %[[ret:[^ ]*]] // // CHECK: [[lpad]] -// CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) +// CHECK: landingpad { i8*, i32 } // CHECK-NEXT: catch i8* // // CHECK: br label %[[ret]] @@ -86,15 +88,17 @@ void use_seh_in_lambda() { } // CXXEH-LABEL: define void @"\01?use_seh_in_lambda@@YAXXZ"() -// CXXEH: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) +// CXXEH-SAME: personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) +// CXXEH: landingpad { i8*, i32 } // NOCXX-LABEL: define void @"\01?use_seh_in_lambda@@YAXXZ"() // NOCXX-NOT: invoke // NOCXX: ret void // CHECK-LABEL: define internal void @"\01??R<lambda_0>@?use_seh_in_lambda@@YAXXZ@QEBAXXZ"(%class.anon* %this) +// CXXEH-SAME: personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) // CHECK: invoke void @might_throw() #[[NOINLINE]] -// CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) +// CHECK: landingpad { i8*, i32 } static int my_unique_global; @@ -114,10 +118,11 @@ void use_inline() { use_seh_in_inline_func(); } -// CHECK-LABEL: define linkonce_odr void @use_seh_in_inline_func() #{{[0-9]+}} comdat { +// CHECK-LABEL: define linkonce_odr void @use_seh_in_inline_func() #{{[0-9]+}} comdat +// CHECK-SAME: personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) // CHECK: invoke void @might_throw() // -// CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) +// CHECK: landingpad { i8*, i32 } // CHECK-NEXT: catch i8* bitcast (i32 (i8*, i8*)* @"\01?filt$0@0@use_seh_in_inline_func@@" to i8*) // // CHECK: invoke void @might_throw() @@ -126,7 +131,7 @@ void use_inline() { // CHECK: call void @"\01?fin$0@0@use_seh_in_inline_func@@"(i8 0, i8* %[[fp]]) // CHECK: ret void // -// CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) +// CHECK: landingpad { i8*, i32 } // CHECK-NEXT: cleanup // CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) // CHECK: call void @"\01?fin$0@0@use_seh_in_inline_func@@"(i8 1, i8* %[[fp]]) diff --git a/test/CodeGenCXX/init-invariant.cpp b/test/CodeGenCXX/init-invariant.cpp index 45816b2..8af4ae6 100644 --- a/test/CodeGenCXX/init-invariant.cpp +++ b/test/CodeGenCXX/init-invariant.cpp @@ -41,13 +41,13 @@ void e() { static const A a = A(); } -// CHECK: call void @_ZN1AC1Ev({{.*}}* @a) +// CHECK: call void @_ZN1AC1Ev({{.*}}* nonnull @a) // CHECK: call {{.*}}@llvm.invariant.start(i64 4, i8* bitcast ({{.*}} @a to i8*)) -// CHECK: call void @_ZN1BC1Ev({{.*}}* @b) +// CHECK: call void @_ZN1BC1Ev({{.*}}* nonnull @b) // CHECK-NOT: call {{.*}}@llvm.invariant.start(i64 4, i8* bitcast ({{.*}} @b to i8*)) -// CHECK: call void @_ZN1CC1Ev({{.*}}* @c) +// CHECK: call void @_ZN1CC1Ev({{.*}}* nonnull @c) // CHECK-NOT: call {{.*}}@llvm.invariant.start(i64 4, i8* bitcast ({{.*}} @c to i8*)) // CHECK: call i32 @_Z1fv( @@ -55,6 +55,6 @@ void e() { // CHECK: call {{.*}}@llvm.invariant.start(i64 4, i8* bitcast ({{.*}} @d to i8*)) // CHECK-LABEL: define void @_Z1ev( -// CHECK: call void @_ZN1AC1Ev(%struct.A* @_ZZ1evE1a) +// CHECK: call void @_ZN1AC1Ev(%struct.A* nonnull @_ZZ1evE1a) // CHECK: call {{.*}}@llvm.invariant.start(i64 4, i8* bitcast ({{.*}} @_ZZ1evE1a to i8*)) // CHECK-NOT: llvm.invariant.end diff --git a/test/CodeGenCXX/mangle-long-double.cpp b/test/CodeGenCXX/mangle-long-double.cpp new file mode 100644 index 0000000..e248c47 --- /dev/null +++ b/test/CodeGenCXX/mangle-long-double.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu %s -emit-llvm -o - | FileCheck %s --check-prefix=POWER64-LINUX +// RUN: %clang_cc1 -triple powerpc-unknown-linux-gnu %s -emit-llvm -o - | FileCheck %s --check-prefix=POWER-LINUX +// RUN: %clang_cc1 -triple powerpc64-apple-darwin9 %s -emit-llvm -o - | FileCheck %s --check-prefix=POWER64-DARWIN +// RUN: %clang_cc1 -triple powerpc-apple-darwin9 %s -emit-llvm -o - | FileCheck %s --check-prefix=POWER-DARWIN +// RUN: %clang_cc1 -triple s390x-unknown-linux-gnu %s -emit-llvm -o - | FileCheck %s --check-prefix=S390X-LINUX + +void f(long double) {} +// POWER64-LINUX: _Z1fg +// POWER-LINUX: _Z1fg +// POWER64-DARWIN: _Z1fe +// POWER-DARWIN: _Z1fe +// S390X-LINUX: _Z1fg diff --git a/test/CodeGenCXX/microsoft-abi-member-pointers.cpp b/test/CodeGenCXX/microsoft-abi-member-pointers.cpp index c12ceae..8cb4a1f 100755 --- a/test/CodeGenCXX/microsoft-abi-member-pointers.cpp +++ b/test/CodeGenCXX/microsoft-abi-member-pointers.cpp @@ -119,7 +119,7 @@ void (UnspecSingle::*us_f_mp)() = &UnspecSingle::foo; // CHECK: @"\01?v_f_mp@Const@@3P8Virtual@@AEXXZQ2@" = // CHECK: global { i8*, i32, i32 } { i8* bitcast ({{.*}} @"\01?foo@Virtual@@QAEXXZ" to i8*), i32 0, i32 0 }, align 4 // CHECK: @"\01?u_f_mp@Const@@3P8Unspecified@@AEXXZQ2@" = -// CHECK: global { i8*, i32, i32, i32 } { i8* bitcast ({{.*}} @"\01?foo@Unspecified@@QAEXXZ" to i8*), i32 0, i32 12, i32 0 }, align 4 +// CHECK: global { i8*, i32, i32, i32 } { i8* bitcast ({{.*}} @"\01?foo@Unspecified@@QAEXXZ" to i8*), i32 0, i32 0, i32 0 }, align 4 // CHECK: @"\01?us_f_mp@Const@@3P8UnspecSingle@@AEXXZQ2@" = // CHECK: global { i8*, i32, i32, i32 } { i8* bitcast ({{.*}} @"\01?foo@UnspecSingle@@QAEXXZ" to i8*), i32 0, i32 0, i32 0 }, align 4 } @@ -191,11 +191,11 @@ void EmitNonVirtualMemberPointers() { // CHECK: { i8* bitcast (void (%{{.*}}*)* @"\01?foo@Virtual@@QAEXXZ" to i8*), i32 0, i32 0 }, // CHECK: { i8*, i32, i32 }* %{{.*}}, align 4 // CHECK: store { i8*, i32, i32, i32 } -// CHECK: { i8* bitcast (void (%{{.*}}*)* @"\01?foo@Unspecified@@QAEXXZ" to i8*), i32 0, i32 12, i32 0 }, +// CHECK: { i8* bitcast (void (%{{.*}}*)* @"\01?foo@Unspecified@@QAEXXZ" to i8*), i32 0, i32 0, i32 0 }, // CHECK: { i8*, i32, i32, i32 }* %{{.*}}, align 4 // CHECK: store { i8*, i32, i32, i32 } // CHECK: { i8* bitcast (void (%{{.*}}*)* @"\01?foo@UnspecWithVBPtr@@QAEXXZ" to i8*), -// CHECK: i32 0, i32 4, i32 0 }, +// CHECK: i32 0, i32 0, i32 0 }, // CHECK: { i8*, i32, i32, i32 }* %{{.*}}, align 4 // CHECK: ret void // CHECK: } @@ -678,6 +678,17 @@ static_assert(sizeof(int A::*) == 12, ""); // CHECK-LABEL: define void @"\01?test@pr20007_pragma2@@YAXXZ" } +namespace pr23823 { +struct Base { void Method(); }; +struct Child : Base {}; +void use(void (Child::*const &)()); +void f() { use(&Child::Method); } +#pragma pointers_to_members(full_generality, virtual_inheritance) +static_assert(sizeof(int Base::*) == 4, ""); +static_assert(sizeof(int Child::*) == 4, ""); +#pragma pointers_to_members(best_case) +} + namespace pr19987 { template <typename T> struct S { diff --git a/test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp b/test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp index 5f6849d..89a62c2 100644 --- a/test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp +++ b/test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp @@ -17,6 +17,7 @@ struct S { // CHECK-DAG: @"\01?$TSS0@?1??h@@YAAAUS@@_N@Z" = linkonce_odr global i32 0 // CHECK-LABEL: define {{.*}} @"\01?f@@YAAAUS@@XZ"() +// CHECK-SAME: personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) extern inline S &f() { static thread_local S s; // CHECK: %[[guard:.*]] = load i32, i32* @"\01??__J?1??f@@YAAAUS@@XZ@51" @@ -38,7 +39,7 @@ extern inline S &f() { // CHECK-NEXT: ret %struct.S* @"\01?s@?1??f@@YAAAUS@@XZ@4U2@A" // CHECK: [[lpad:.*]]: -// CHECK-NEXT: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) +// CHECK-NEXT: landingpad { i8*, i32 } // CHECK-NEXT: cleanup // CHECK: %[[guard:.*]] = load i32, i32* @"\01??__J?1??f@@YAAAUS@@XZ@51" // CHECK-NEXT: %[[mask:.*]] = and i32 %[[guard]], -2 diff --git a/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp b/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp index f6f7583..af930c8 100644 --- a/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp +++ b/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fno-rtti -emit-llvm -triple=i386-pc-win32 %s -o - | FileCheck %s --check-prefix=CHECK32 -// RUN: %clang_cc1 -fno-rtti -emit-llvm -triple=x86_64-pc-win32 %s -o - | FileCheck %s --check-prefix=CHECK64 +// RUN: %clang_cc1 -std=c++11 -fno-rtti -emit-llvm -triple=i386-pc-win32 %s -o - | FileCheck %s --check-prefix=CHECK32 +// RUN: %clang_cc1 -std=c++11 -fno-rtti -emit-llvm -triple=x86_64-pc-win32 %s -o - | FileCheck %s --check-prefix=CHECK64 struct S { int x, y, z; @@ -13,12 +13,15 @@ struct U { U(const U &); }; +struct B; + struct C { virtual void foo(); virtual int bar(int, double); virtual S baz(int); virtual S qux(U); virtual void thud(...); + virtual void (B::*plugh())(); }; namespace { @@ -47,6 +50,8 @@ void f() { void (C::*ptr6)(...); ptr6 = &C::thud; + auto ptr7 = &C::plugh; + // CHECK32-LABEL: define void @"\01?f@@YAXXZ"() // CHECK32: store i8* bitcast (void (%struct.C*, ...)* @"\01??_9C@@$BA@AE" to i8*), i8** %ptr @@ -167,4 +172,18 @@ void f() { // CHECK64: ret void // CHECK64: } +// CHECK32: define linkonce_odr x86_thiscallcc void @"\01??_9C@@$BBE@AE"(%struct.C* %this, ...) {{.*}} comdat align 2 { +// CHECK32: [[VPTR:%.*]] = getelementptr inbounds void (%struct.C*, ...)*, void (%struct.C*, ...)** %{{.*}}, i64 5 +// CHECK32: [[CALLEE:%.*]] = load void (%struct.C*, ...)*, void (%struct.C*, ...)** [[VPTR]] +// CHECK32: musttail call x86_thiscallcc void (%struct.C*, ...) [[CALLEE]](%struct.C* %{{.*}}, ...) +// CHECK32: ret void +// CHECK32: } + +// CHECK64: define linkonce_odr void @"\01??_9C@@$BCI@AA"(%struct.C* %this, ...) {{.*}} comdat align 2 { +// CHECK64: [[VPTR:%.*]] = getelementptr inbounds void (%struct.C*, ...)*, void (%struct.C*, ...)** %{{.*}}, i64 5 +// CHECK64: [[CALLEE:%.*]] = load void (%struct.C*, ...)*, void (%struct.C*, ...)** [[VPTR]] +// CHECK64: musttail call void (%struct.C*, ...) [[CALLEE]](%struct.C* %{{.*}}, ...) +// CHECK64: ret void +// CHECK64: } + // CHECK32: #[[ATTR]] = {{{.*}}"thunk"{{.*}}} diff --git a/test/CodeGenCXX/microsoft-abi-vmemptr-fastcall.cpp b/test/CodeGenCXX/microsoft-abi-vmemptr-fastcall.cpp index 6d42b85..97ab199 100644 --- a/test/CodeGenCXX/microsoft-abi-vmemptr-fastcall.cpp +++ b/test/CodeGenCXX/microsoft-abi-vmemptr-fastcall.cpp @@ -1,11 +1,15 @@ -// RUN: %clang_cc1 -fms-extensions -triple i686-pc-windows-msvc %s -emit-llvm-only -verify - -// We reject this because LLVM doesn't forward the second regparm through the -// thunk. +// RUN: %clang_cc1 -fms-extensions -triple i686-pc-windows-msvc %s -emit-llvm -o - | FileCheck %s struct A { - virtual void __fastcall f(int a, int b); // expected-error {{cannot compile this pointer to fastcall virtual member function yet}} + virtual void __fastcall f(int a, int b); }; void (__fastcall A::*doit())(int, int) { return &A::f; } + +// CHECK: define linkonce_odr x86_fastcallcc void @"\01??_9A@@$BA@AI"(%struct.A* inreg %this, ...) {{.*}} comdat align 2 { +// CHECK: [[VPTR:%.*]] = getelementptr inbounds void (%struct.A*, ...)*, void (%struct.A*, ...)** %{{.*}}, i64 0 +// CHECK: [[CALLEE:%.*]] = load void (%struct.A*, ...)*, void (%struct.A*, ...)** [[VPTR]] +// CHECK: musttail call x86_fastcallcc void (%struct.A*, ...) [[CALLEE]](%struct.A* inreg %{{.*}}, ...) +// CHECK: ret void +// CHECK: } diff --git a/test/CodeGenCXX/mingw-w64-seh-exceptions.cpp b/test/CodeGenCXX/mingw-w64-seh-exceptions.cpp index bacddb2..9025f87 100644 --- a/test/CodeGenCXX/mingw-w64-seh-exceptions.cpp +++ b/test/CodeGenCXX/mingw-w64-seh-exceptions.cpp @@ -16,9 +16,11 @@ extern "C" void test() { } // X64: define void @test() +// X64-SAME: personality i8* bitcast (i32 (...)* @__gxx_personality_seh0 to i8*) // X64: invoke void @foo() -// X64: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_seh0 to i8*) +// X64: landingpad { i8*, i32 } // X86: define void @test() +// X86-SAME: personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) // X86: invoke void @foo() -// X86: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) +// X86: landingpad { i8*, i32 } diff --git a/test/CodeGenCXX/nrvo.cpp b/test/CodeGenCXX/nrvo.cpp index f4ed7cd..8744d14 100644 --- a/test/CodeGenCXX/nrvo.cpp +++ b/test/CodeGenCXX/nrvo.cpp @@ -44,6 +44,7 @@ X test1(bool B) { // CHECK-LABEL: define void @_Z5test2b // CHECK-EH-LABEL: define void @_Z5test2b +// CHECK-EH-SAME: personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) X test2(bool B) { // No NRVO. @@ -82,7 +83,7 @@ X test2(bool B) { // -> %cleanup, %lpad1 // %lpad: landing pad for ctor of 'y', dtor of 'y' - // CHECK-EH: [[CAUGHTVAL:%.*]] = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK-EH: [[CAUGHTVAL:%.*]] = landingpad { i8*, i32 } // CHECK-EH-NEXT: cleanup // CHECK-EH-NEXT: extractvalue { i8*, i32 } [[CAUGHTVAL]], 0 // CHECK-EH-NEXT: extractvalue { i8*, i32 } [[CAUGHTVAL]], 1 @@ -116,7 +117,7 @@ X test2(bool B) { // CHECK-EH: resume { i8*, i32 } // %terminate.lpad: terminate landing pad. - // CHECK-EH: [[T0:%.*]] = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK-EH: [[T0:%.*]] = landingpad { i8*, i32 } // CHECK-EH-NEXT: catch i8* null // CHECK-EH-NEXT: [[T1:%.*]] = extractvalue { i8*, i32 } [[T0]], 0 // CHECK-EH-NEXT: call void @__clang_call_terminate(i8* [[T1]]) [[NR_NUW:#[0-9]+]] @@ -178,9 +179,9 @@ X test6() { // CHECK: [[A:%.*]] = alloca [[X:%.*]], align 8 // CHECK-NEXT: [[PTR:%.*]] = getelementptr inbounds %class.X, %class.X* [[A]], i32 0, i32 0 // CHECK-NEXT: call void @llvm.lifetime.start(i64 1, i8* [[PTR]]) - // CHECK-NEXT: call {{.*}} @_ZN1XC1Ev([[X]]* [[A]]) - // CHECK-NEXT: call {{.*}} @_ZN1XC1ERKS_([[X]]* {{%.*}}, [[X]]* dereferenceable({{[0-9]+}}) [[A]]) - // CHECK-NEXT: call {{.*}} @_ZN1XD1Ev([[X]]* [[A]]) + // CHECK-NEXT: call {{.*}} @_ZN1XC1Ev([[X]]* nonnull [[A]]) + // CHECK-NEXT: call {{.*}} @_ZN1XC1ERKS_([[X]]* {{%.*}}, [[X]]* nonnull dereferenceable({{[0-9]+}}) [[A]]) + // CHECK-NEXT: call {{.*}} @_ZN1XD1Ev([[X]]* nonnull [[A]]) // CHECK-NEXT: call void @llvm.lifetime.end(i64 1, i8* [[PTR]]) // CHECK-NEXT: ret void } diff --git a/test/CodeGenCXX/partial-destruction.cpp b/test/CodeGenCXX/partial-destruction.cpp index 01e2894..d135149 100644 --- a/test/CodeGenCXX/partial-destruction.cpp +++ b/test/CodeGenCXX/partial-destruction.cpp @@ -12,6 +12,7 @@ namespace test0 { opaque(); } // CHECK-LABEL: define void @_ZN5test04testEv() + // CHECK-SAME: personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) // CHECK: [[AS:%.*]] = alloca [10 x [[A:%.*]]], align // CHECK-NEXT: [[ENDVAR:%.*]] = alloca [[A]]* // CHECK-NEXT: [[EXN:%.*]] = alloca i8* @@ -50,7 +51,7 @@ namespace test0 { // CHECK: ret void // Partial destroy for initialization. - // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK: landingpad { i8*, i32 } // CHECK-NEXT: cleanup // CHECK: [[PARTIAL_END:%.*]] = load [[A]]*, [[A]]** [[ENDVAR]] // CHECK-NEXT: [[T0:%.*]] = icmp eq [[A]]* [[E_BEGIN]], [[PARTIAL_END]] @@ -62,7 +63,7 @@ namespace test0 { // CHECK-NEXT: br i1 [[T0]], // Primary EH destructor. - // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK: landingpad { i8*, i32 } // CHECK-NEXT: cleanup // CHECK: [[E0:%.*]] = getelementptr inbounds [10 x [[A]]], [10 x [[A]]]* [[AS]], i32 0, i32 0 // CHECK-NEXT: [[E_END:%.*]] = getelementptr inbounds [[A]], [[A]]* [[E0]], i64 10 @@ -72,7 +73,7 @@ namespace test0 { // FIXME: There's some really bad block ordering here which causes // the partial destroy for the primary normal destructor to fall // within the primary EH destructor. - // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK: landingpad { i8*, i32 } // CHECK-NEXT: cleanup // CHECK: [[T0:%.*]] = icmp eq [[A]]* [[ED_BEGIN]], [[ED_CUR]] // CHECK-NEXT: br i1 [[T0]] @@ -99,6 +100,7 @@ namespace test1 { B v = { 5, 6, 7, 8 }; } // CHECK-LABEL: define void @_ZN5test14testEv() + // CHECK-SAME: personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) // CHECK: [[V:%.*]] = alloca [[B:%.*]], align 4 // CHECK-NEXT: alloca i8* // CHECK-NEXT: alloca i32 @@ -114,9 +116,9 @@ namespace test1 { // CHECK-NEXT: ret void // FIXME: again, the block ordering is pretty bad here - // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK: landingpad { i8*, i32 } // CHECK-NEXT: cleanup - // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK: landingpad { i8*, i32 } // CHECK-NEXT: cleanup // CHECK: invoke void @_ZN5test11AD1Ev([[A]]* [[Y]]) // CHECK: invoke void @_ZN5test11AD1Ev([[A]]* [[X]]) @@ -129,6 +131,7 @@ namespace test2 { A v[4][7]; // CHECK-LABEL: define void @_ZN5test24testEv() + // CHECK-SAME: personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) // CHECK: [[V:%.*]] = alloca [4 x [7 x [[A:%.*]]]], align 1 // CHECK-NEXT: alloca i8* // CHECK-NEXT: alloca i32 @@ -144,7 +147,7 @@ namespace test2 { // CHECK-NEXT: br i1 [[DONE]], // Partial destruction landing pad. - // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK: landingpad { i8*, i32 } // CHECK-NEXT: cleanup // CHECK: [[EMPTY:%.*]] = icmp eq [[A]]* [[BEGIN]], [[CUR]] // CHECK-NEXT: br i1 [[EMPTY]], diff --git a/test/CodeGenCXX/pragma-loop-safety.cpp b/test/CodeGenCXX/pragma-loop-safety.cpp new file mode 100644 index 0000000..d12e412 --- /dev/null +++ b/test/CodeGenCXX/pragma-loop-safety.cpp @@ -0,0 +1,49 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm -o - %s | FileCheck %s + +// Verify assume_safety vectorization is recognized. +void vectorize_test(int *List, int Length) { +// CHECK: define {{.*}} @_Z14vectorize_testPii +// CHECK: [[LOAD1_IV:.+]] = load i32, i32* [[IV1:[^,]+]], {{.*}}!llvm.mem.parallel_loop_access ![[LOOP1_ID:[0-9]+]] +// CHECK-NEXT: [[LOAD1_LEN:.+]] = load i32, i32* [[LEN1:.+]], {{.*}}!llvm.mem.parallel_loop_access ![[LOOP1_ID]] +// CHECK-NEXT: [[CMP1:.+]] = icmp slt i32[[LOAD1_IV]],[[LOAD1_LEN]] +// CHECK-NEXT: br i1[[CMP1]], label %[[LOOP1_BODY:[^,]+]], label %[[LOOP1_END:[^,]+]], !llvm.loop ![[LOOP1_HINTS:[0-9]+]] +#pragma clang loop vectorize(assume_safety) + for (int i = 0; i < Length; i++) { + // CHECK: [[LOOP1_BODY]] + // CHECK-NEXT: [[RHIV1:.+]] = load i32, i32* [[IV1]], {{.*}}!llvm.mem.parallel_loop_access ![[LOOP1_ID]] + // CHECK-NEXT: [[CALC1:.+]] = mul nsw i32[[RHIV1]], 2 + // CHECK-NEXT: [[SIV1:.+]] = load i32, i32* [[IV1]]{{.*}}!llvm.mem.parallel_loop_access ![[LOOP1_ID]] + // CHECK-NEXT: [[INDEX1:.+]] = sext i32[[SIV1]] to i64 + // CHECK-NEXT: [[ARRAY1:.+]] = load i32*, i32** [[LIST1:.*]], {{.*}}!llvm.mem.parallel_loop_access ![[LOOP1_ID]] + // CHECK-NEXT: [[PTR1:.+]] = getelementptr inbounds i32, i32*[[ARRAY1]], i64[[INDEX1]] + // CHECK-NEXT: store i32[[CALC1]], i32*[[PTR1]], {{.*}}!llvm.mem.parallel_loop_access ![[LOOP1_ID]] + List[i] = i * 2; + } + // CHECK: [[LOOP1_END]] +} + +// Verify assume_safety interleaving is recognized. +void interleave_test(int *List, int Length) { +// CHECK: define {{.*}} @_Z15interleave_testPii +// CHECK: [[LOAD2_IV:.+]] = load i32, i32* [[IV2:[^,]+]], {{.*}}!llvm.mem.parallel_loop_access ![[LOOP2_ID:[0-9]+]] +// CHECK-NEXT: [[LOAD2_LEN:.+]] = load i32, i32* [[LEN2:.+]], {{.*}}!llvm.mem.parallel_loop_access ![[LOOP2_ID]] +// CHECK-NEXT: [[CMP2:.+]] = icmp slt i32[[LOAD2_IV]],[[LOAD2_LEN]] +// CHECK-NEXT: br i1[[CMP2]], label %[[LOOP2_BODY:[^,]+]], label %[[LOOP2_END:[^,]+]], !llvm.loop ![[LOOP2_HINTS:[0-9]+]] +#pragma clang loop interleave(assume_safety) + for (int i = 0; i < Length; i++) { + // CHECK: [[LOOP2_BODY]] + // CHECK-NEXT: [[RHIV2:.+]] = load i32, i32* [[IV2]], {{.*}}!llvm.mem.parallel_loop_access ![[LOOP2_ID]] + // CHECK-NEXT: [[CALC2:.+]] = mul nsw i32[[RHIV2]], 2 + // CHECK-NEXT: [[SIV2:.+]] = load i32, i32* [[IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[LOOP2_ID]] + // CHECK-NEXT: [[INDEX2:.+]] = sext i32[[SIV2]] to i64 + // CHECK-NEXT: [[ARRAY2:.+]] = load i32*, i32** [[LIST2:.*]], {{.*}}!llvm.mem.parallel_loop_access ![[LOOP2_ID]] + // CHECK-NEXT: [[PTR2:.+]] = getelementptr inbounds i32, i32*[[ARRAY2]], i64[[INDEX2]] + // CHECK-NEXT: store i32[[CALC2]], i32*[[PTR2]], {{.*}}!llvm.mem.parallel_loop_access ![[LOOP2_ID]] + List[i] = i * 2; + } + // CHECK: [[LOOP2_END]] +} + +// CHECK: ![[LOOP1_HINTS]] = distinct !{![[LOOP1_HINTS]], ![[INTENABLE_1:.*]]} +// CHCCK: ![[INTENABLE_1]] = !{!"llvm.loop.vectorize.enable", i1 true} +// CHECK: ![[LOOP2_HINTS]] = distinct !{![[LOOP2_HINTS]], ![[INTENABLE_1:.*]]} diff --git a/test/CodeGenCXX/redefine_extname.cpp b/test/CodeGenCXX/redefine_extname.cpp new file mode 100644 index 0000000..2b6b703 --- /dev/null +++ b/test/CodeGenCXX/redefine_extname.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -triple=i386-pc-solaris2.11 -w -emit-llvm %s -o - | FileCheck %s + +extern "C" { + struct statvfs64 { + int f; + }; +#pragma redefine_extname statvfs64 statvfs + int statvfs64(struct statvfs64 *); +} + +void foo() { + struct statvfs64 st; + statvfs64(&st); +// Check that even if there is a structure with redefined name before the +// pragma, subsequent function name redefined properly. PR5172, Comment 11. +// CHECK: call i32 @statvfs(%struct.statvfs64* %st) +} + diff --git a/test/CodeGenCXX/stack-reuse.cpp b/test/CodeGenCXX/stack-reuse.cpp index a975f30..473a57c 100644 --- a/test/CodeGenCXX/stack-reuse.cpp +++ b/test/CodeGenCXX/stack-reuse.cpp @@ -134,8 +134,8 @@ int large_combiner_test(S_large s) { // CHECK-LABEL: define i32 @large_combiner_test // CHECK: [[T1:%.*]] = alloca %struct.Combiner // CHECK: [[T2:%.*]] = alloca %struct.Combiner -// CHECK: [[T3:%.*]] = call %struct.Combiner* @_ZN8CombinerC1E7S_large(%struct.Combiner* [[T1]], [9 x i32] %s.coerce) -// CHECK: call void @_ZN8Combiner1fEv(%struct.Combiner* sret [[T2]], %struct.Combiner* [[T1]]) +// CHECK: [[T3:%.*]] = call %struct.Combiner* @_ZN8CombinerC1E7S_large(%struct.Combiner* nonnull [[T1]], [9 x i32] %s.coerce) +// CHECK: call void @_ZN8Combiner1fEv(%struct.Combiner* nonnull sret [[T2]], %struct.Combiner* nonnull [[T1]]) // CHECK: [[T4:%.*]] = getelementptr inbounds %struct.Combiner, %struct.Combiner* [[T2]], i32 0, i32 0, i32 0, i32 0 // CHECK: [[T5:%.*]] = load i32, i32* [[T4]] // CHECK: ret i32 [[T5]] diff --git a/test/CodeGenCXX/threadsafe-statics-exceptions.cpp b/test/CodeGenCXX/threadsafe-statics-exceptions.cpp index 70decc9..41325fa 100644 --- a/test/CodeGenCXX/threadsafe-statics-exceptions.cpp +++ b/test/CodeGenCXX/threadsafe-statics-exceptions.cpp @@ -8,6 +8,7 @@ struct X { struct Y { }; // CHECK-LABEL: define void @_Z1fv +// CHECK-SAME: personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) void f() { // CHECK: call i32 @__cxa_guard_acquire(i64* @_ZGVZ1fvE1x) // CHECK: invoke void @_ZN1XC1Ev @@ -21,7 +22,7 @@ void f() { throw Y(); // Finally, the landing pad. - // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK: landingpad { i8*, i32 } // CHECK: cleanup // CHECK: call void @__cxa_guard_abort(i64* @_ZGVZ1fvE1x) // CHECK: resume { i8*, i32 } diff --git a/test/CodeGenCXX/typeid.cpp b/test/CodeGenCXX/typeid.cpp index 9d21290..364f058 100644 --- a/test/CodeGenCXX/typeid.cpp +++ b/test/CodeGenCXX/typeid.cpp @@ -31,13 +31,14 @@ const std::type_info &a_ti = typeid(a); const std::type_info &A10_c_ti = typeid(char const[10]); // CHECK-LABEL: define i8* @_ZN5Test11fEv +// CHECK-SAME: personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) const char *f() { try { // CHECK: br i1 // CHECK: invoke void @__cxa_bad_typeid() [[NR:#[0-9]+]] return typeid(*static_cast<A *>(0)).name(); } catch (...) { - // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK: landingpad { i8*, i32 } // CHECK-NEXT: catch i8* null } diff --git a/test/CodeGenCXX/windows-itanium-exceptions.cpp b/test/CodeGenCXX/windows-itanium-exceptions.cpp index 3694d2c..b2c8707 100644 --- a/test/CodeGenCXX/windows-itanium-exceptions.cpp +++ b/test/CodeGenCXX/windows-itanium-exceptions.cpp @@ -20,7 +20,8 @@ void attempt() { // CHECK: unreachable // CHECK: } -// CHECK: define {{.*}}void @_Z7attemptv() {{.*}} { +// CHECK: define {{.*}}void @_Z7attemptv() +// CHECK-SAME: personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) // CHECK: %exn.slot = alloca i8* // CHECK: %ehselector.slot = alloca i32 // CHECK: invoke {{.*}}void @_Z6exceptv() @@ -28,7 +29,7 @@ void attempt() { // CHECK: invoke.cont: // CHECK: br label %try.cont // CHECK: lpad: -// CHECK: %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) +// CHECK: %0 = landingpad { i8*, i32 } // CHECK: catch i8* null // CHECK: %1 = extractvalue { i8*, i32 } %0, 0 // CHECK: store i8* %1, i8** %exn.slot diff --git a/test/CodeGenObjC/autorelease.m b/test/CodeGenObjC/autorelease.m index 6bb80fd..ab65f80 100644 --- a/test/CodeGenObjC/autorelease.m +++ b/test/CodeGenObjC/autorelease.m @@ -46,7 +46,7 @@ int tryTo(int (*f)(void)) { // CHECK-NEXT: [[T2:%.*]] = invoke i32 [[T1]]() // CHECK: store i32 [[T2]], i32* [[RET]] // CHECK: invoke void @objc_autoreleasePoolPop(i8* [[T0]]) -// CHECK: landingpad { i8*, i32 } personality +// CHECK: landingpad { i8*, i32 } // CHECK-NEXT: catch i8* null // CHECK: call i8* @objc_begin_catch // CHECK-NEXT: store i32 0, i32* [[RET]] diff --git a/test/CodeGenObjC/blocks-2.m b/test/CodeGenObjC/blocks-2.m index 0c6bd56..b9562ad 100644 --- a/test/CodeGenObjC/blocks-2.m +++ b/test/CodeGenObjC/blocks-2.m @@ -30,7 +30,7 @@ void test1() { // CHECK-NEXT: call void @_Block_object_dispose(i8* [[T1]], i32 8) // CHECK-NEXT: ret void - // CHECK: landingpad { i8*, i32 } personality + // CHECK: landingpad { i8*, i32 } // CHECK-NEXT: cleanup // CHECK: [[T1:%.*]] = bitcast [[N_T]]* [[N]] to i8* // CHECK-NEXT: call void @_Block_object_dispose(i8* [[T1]], i32 8) diff --git a/test/CodeGenObjC/exceptions.m b/test/CodeGenObjC/exceptions.m index f27892d..075b714 100644 --- a/test/CodeGenObjC/exceptions.m +++ b/test/CodeGenObjC/exceptions.m @@ -55,14 +55,14 @@ int f2() { @try { // CHECK: store i32 6, i32* [[X]] x++; - // CHECK-NEXT: call void asm sideeffect "", "*m,*m"(i32* [[X]] + // CHECK-NEXT: call void asm sideeffect "", "*m,*m"(i32* nonnull [[X]] // CHECK-NEXT: call void @foo() // CHECK-NEXT: call void @objc_exception_try_exit // CHECK-NEXT: [[T:%.*]] = load i32, i32* [[X]] foo(); } @catch (id) { // Landing pad. Note that we elide the re-enter. - // CHECK: call void asm sideeffect "", "=*m,=*m"(i32* [[X]] + // CHECK: call void asm sideeffect "", "=*m,=*m"(i32* nonnull [[X]] // CHECK-NEXT: call i8* @objc_exception_extract // CHECK-NEXT: [[T1:%.*]] = load i32, i32* [[X]] // CHECK-NEXT: [[T2:%.*]] = add nsw i32 [[T1]], -1 @@ -93,7 +93,7 @@ void f3() { // CHECK-NEXT: br i1 @try { - // CHECK: call void @f3_helper(i32 0, i32* [[X]]) + // CHECK: call void @f3_helper(i32 0, i32* nonnull [[X]]) // CHECK: call void @objc_exception_try_exit( f3_helper(0, &x); } @finally { @@ -101,12 +101,12 @@ void f3() { // CHECK: call void @objc_exception_try_enter // CHECK: call i32 @_setjmp @try { - // CHECK: call void @f3_helper(i32 1, i32* [[X]]) + // CHECK: call void @f3_helper(i32 1, i32* nonnull [[X]]) // CHECK: call void @objc_exception_try_exit( f3_helper(1, &x); } @finally { // CHECK: [[DEST2:%.*]] = phi i32 [ 0, {{%.*}} ], [ 5, {{%.*}} ] - // CHECK: call void @f3_helper(i32 2, i32* [[X]]) + // CHECK: call void @f3_helper(i32 2, i32* nonnull [[X]]) f3_helper(2, &x); // This loop is large enough to dissuade the optimizer from just @@ -123,7 +123,7 @@ void f3() { // CHECK: [[DEST1]] } - // CHECK: call void @f3_helper(i32 4, i32* [[X]]) + // CHECK: call void @f3_helper(i32 4, i32* nonnull [[X]]) // CHECK-NEXT: call void @llvm.lifetime.end(i64 4, i8* [[XPTR]]) // CHECK-NEXT: ret void f3_helper(4, &x); @@ -135,7 +135,7 @@ void f4() { // CHECK-LABEL: define void @f4() // CHECK: [[EXNDATA:%.*]] = alloca [[EXNDATA_T:%.*]], align - // CHECK: call void @objc_exception_try_enter([[EXNDATA_T]]* [[EXNDATA]]) + // CHECK: call void @objc_exception_try_enter([[EXNDATA_T]]* nonnull [[EXNDATA]]) // CHECK: call i32 @_setjmp @try { // CHECK: call void @f4_help(i32 0) @@ -144,7 +144,7 @@ void f4() { // The finally cleanup has two threaded entrypoints after optimization: // finally.no-call-exit: Predecessor is when the catch throws. - // CHECK: call i8* @objc_exception_extract([[EXNDATA_T]]* [[EXNDATA]]) + // CHECK: call i8* @objc_exception_extract([[EXNDATA_T]]* nonnull [[EXNDATA]]) // CHECK-NEXT: call void @f4_help(i32 2) // CHECK-NEXT: br label // -> rethrow @@ -154,7 +154,7 @@ void f4() { // to rethrow and should be true only in the last case. // CHECK: phi i8* // CHECK-NEXT: phi i1 - // CHECK-NEXT: call void @objc_exception_try_exit([[EXNDATA_T]]* [[EXNDATA]]) + // CHECK-NEXT: call void @objc_exception_try_exit([[EXNDATA_T]]* nonnull [[EXNDATA]]) // CHECK-NEXT: call void @f4_help(i32 2) // CHECK-NEXT: br i1 // -> ret, rethrow @@ -163,8 +163,8 @@ void f4() { // CHECK: ret void // Catch mechanism: - // CHECK: call i8* @objc_exception_extract([[EXNDATA_T]]* [[EXNDATA]]) - // CHECK-NEXT: call void @objc_exception_try_enter([[EXNDATA_T]]* [[EXNDATA]]) + // CHECK: call i8* @objc_exception_extract([[EXNDATA_T]]* nonnull [[EXNDATA]]) + // CHECK-NEXT: call void @objc_exception_try_enter([[EXNDATA_T]]* nonnull [[EXNDATA]]) // CHECK: call i32 @_setjmp // -> next, finally.no-call-exit // CHECK: call i32 @objc_exception_match diff --git a/test/CodeGenObjC/gnu-exceptions.m b/test/CodeGenObjC/gnu-exceptions.m index 82eb6cb..76e9e1d 100644 --- a/test/CodeGenObjC/gnu-exceptions.m +++ b/test/CodeGenObjC/gnu-exceptions.m @@ -6,7 +6,8 @@ void log(int i); @class C; -// CHECK: define void @test0() [[TF:#[0-9]+]] { +// CHECK: define void @test0() [[TF:#[0-9]+]] +// CHECK-SAME: personality i8* bitcast (i32 (...)* @__gnu_objc_personality_v0 to i8*) void test0() { @try { // CHECK: invoke void @opaque() @@ -15,7 +16,7 @@ void test0() { // CHECK: call void @log(i32 1) } @catch (C *c) { - // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gnu_objc_personality_v0 to i8*) + // CHECK: landingpad { i8*, i32 } // CHECK-NEXT: catch i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i64 0, i64 0) // CHECK: br i1 diff --git a/test/CodeGenObjC/objc-asm-attribute-test.m b/test/CodeGenObjC/objc-asm-attribute-test.m index 589b08a..7b3a64d 100644 --- a/test/CodeGenObjC/objc-asm-attribute-test.m +++ b/test/CodeGenObjC/objc-asm-attribute-test.m @@ -13,10 +13,19 @@ __attribute__((objc_runtime_name("MySecretNamespace.Protocol2"))) + (void) ClsMethodP2; @end +__attribute__((objc_runtime_name("MySecretNamespace.Protocol3"))) +@protocol Protocol3 +@end + __attribute__((objc_runtime_name("MySecretNamespace.Message"))) @interface Message <Protocol, Protocol2> { id MyIVAR; } + +@property(retain) Message *msgProp; +@property(retain) Message<Protocol3> *msgProtoProp; +@property(retain) id<Protocol3> idProtoProp; + @end @implementation Message @@ -46,9 +55,14 @@ id Test16877359() { return [SLREarth alloc]; } -// CHECK: @"OBJC_IVAR_$_MySecretNamespace.Message.MyIVAR" = global i64 +// CHECK: @"OBJC_IVAR_$_MySecretNamespace.Message.MyIVAR" = global i64 0 // CHECK: @"OBJC_CLASS_$_MySecretNamespace.Message" = global %struct._class_t // CHECK: @"OBJC_METACLASS_$_MySecretNamespace.Message" = global %struct._class_t + +// CHECK: private global [42 x i8] c"T@\22MySecretNamespace.Message\22,&,V_msgProp\00" +// CHECK: private global [76 x i8] c"T@\22MySecretNamespace.Message<MySecretNamespace.Protocol3>\22,&,V_msgProtoProp\00" +// CHECK: private global [50 x i8] c"T@\22<MySecretNamespace.Protocol3>\22,&,V_idProtoProp\00" + // CHECK: @"OBJC_CLASS_$_foo" = external global %struct._class_t // CHECK: define internal i8* @"\01-[Message MyMethod]" // CHECK: [[IVAR:%.*]] = load i64, i64* @"OBJC_IVAR_$_MySecretNamespace.Message.MyIVAR" diff --git a/test/CodeGenObjC/synchronized.m b/test/CodeGenObjC/synchronized.m index 212d98a..0ce179c 100644 --- a/test/CodeGenObjC/synchronized.m +++ b/test/CodeGenObjC/synchronized.m @@ -32,7 +32,7 @@ void foo(id a) { // CHECK: call i32 @_setjmp @synchronized(a) { // This is unreachable, but the optimizers can't know that. - // CHECK: call void asm sideeffect "", "=*m,=*m,=*m"(i8** [[A]], i8** [[SYNC]] + // CHECK: call void asm sideeffect "", "=*m,=*m,=*m"(i8** nonnull [[A]], i8** nonnull [[SYNC]] // CHECK: call i32 @objc_sync_exit // CHECK: call i8* @objc_exception_extract // CHECK: call void @objc_exception_throw diff --git a/test/CodeGenObjC/terminate.m b/test/CodeGenObjC/terminate.m index 4992b99..a756bfb 100644 --- a/test/CodeGenObjC/terminate.m +++ b/test/CodeGenObjC/terminate.m @@ -10,20 +10,22 @@ void test0(void) { test0_helper(); // CHECK-WITH-LABEL: define void @test0() + // CHECK-WITH-SAME: personality i8* bitcast (i32 (...)* @__gcc_personality_v0 to i8*) // CHECK-WITH: [[PTR:%.*]] = alloca i8*, // CHECK-WITH: call void @destroy(i8** [[PTR]]) // CHECK-WITH-NEXT: ret void // CHECK-WITH: invoke void @destroy(i8** [[PTR]]) - // CHECK-WITH: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gcc_personality_v0 to i8*) + // CHECK-WITH: landingpad { i8*, i32 } // CHECK-WITH-NEXT: catch i8* null // CHECK-WITH-NEXT: call void @objc_terminate() // CHECK-WITHOUT-LABEL: define void @test0() + // CHECK-WITHOUT-SAME: personality i8* bitcast (i32 (...)* @__gcc_personality_v0 to i8*) // CHECK-WITHOUT: [[PTR:%.*]] = alloca i8*, // CHECK-WITHOUT: call void @destroy(i8** [[PTR]]) // CHECK-WITHOUT-NEXT: ret void // CHECK-WITHOUT: invoke void @destroy(i8** [[PTR]]) - // CHECK-WITHOUT: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gcc_personality_v0 to i8*) + // CHECK-WITHOUT: landingpad { i8*, i32 } // CHECK-WITHOUT-NEXT: catch i8* null // CHECK-WITHOUT-NEXT: call void @abort() } diff --git a/test/CodeGenObjCXX/catch-id-type.mm b/test/CodeGenObjCXX/catch-id-type.mm index 0a2b940..aa861cb 100644 --- a/test/CodeGenObjCXX/catch-id-type.mm +++ b/test/CodeGenObjCXX/catch-id-type.mm @@ -30,7 +30,7 @@ id FUNC() { } catch( id error ) { - // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK: landingpad { i8*, i32 } // CHECK-NEXT: catch i8* bitcast ({ i8*, i8*, i32, i8* }* @_ZTIPU11objcproto1P4INTF to i8*) // CHECK-NEXT: catch i8* bitcast ({ i8*, i8*, i32, i8* }* @_ZTIP11objc_object to i8*) // CHECK-NEXT: catch i8* bitcast ({ i8*, i8*, i32, i8* }* @_ZTIP10objc_class to i8*) diff --git a/test/CodeGenObjCXX/debug-info-cyclic.mm b/test/CodeGenObjCXX/debug-info-cyclic.mm index 8983fe5..37a8064 100644 --- a/test/CodeGenObjCXX/debug-info-cyclic.mm +++ b/test/CodeGenObjCXX/debug-info-cyclic.mm @@ -1,12 +1,13 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin -g -emit-llvm %s -o - | FileCheck %s struct B { -// CHECK: ![[B:[0-9]+]] = !DICompositeType(tag: DW_TAG_structure_type, name: "B" +// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "B" // CHECK-SAME: line: [[@LINE-2]], // CHECK-SAME: size: 8, align: 8, // CHECK-NOT: offset: // CHECK-NOT: DIFlagFwdDecl // CHECK-SAME: elements: ![[BMEMBERS:[0-9]+]] +// CHECK-SAME: identifier: [[B:.*]]) // CHECK: ![[BMEMBERS]] = !{![[BB:[0-9]+]]} B(struct A *); // CHECK: ![[BB]] = !DISubprogram(name: "B", scope: ![[B]] diff --git a/test/CodeGenObjCXX/exceptions-legacy.mm b/test/CodeGenObjCXX/exceptions-legacy.mm index f6cd296..dac259d 100644 --- a/test/CodeGenObjCXX/exceptions-legacy.mm +++ b/test/CodeGenObjCXX/exceptions-legacy.mm @@ -15,7 +15,7 @@ void test0(id obj) { // CHECK-LABEL: define void @_Z5test0P11objc_object( // Enter the @synchronized block. // CHECK: call i32 @objc_sync_enter(i8* [[OBJ:%.*]]) -// CHECK: call void @objc_exception_try_enter([[BUF_T:%.*]]* [[BUF:%.*]]) +// CHECK: call void @objc_exception_try_enter([[BUF_T:%.*]]* nonnull [[BUF:%.*]]) // CHECK-NEXT: [[T0:%.*]] = getelementptr [[BUF_T]], [[BUF_T]]* [[BUF]], i32 0, i32 0, i32 0 // CHECK-NEXT: [[T1:%.*]] = call i32 @_setjmp(i32* [[T0]]) // CHECK-NEXT: [[T2:%.*]] = icmp eq i32 [[T1]], 0 @@ -25,7 +25,7 @@ void test0(id obj) { // CHECK: invoke void @_Z3foov() // Leave the @synchronized. The reload of obj here is unnecessary. -// CHECK: call void @objc_exception_try_exit([[BUF_T]]* [[BUF]]) +// CHECK: call void @objc_exception_try_exit([[BUF_T]]* nonnull [[BUF]]) // CHECK-NEXT: [[T0:%.*]] = load i8*, i8** // CHECK-NEXT: call i32 @objc_sync_exit(i8* [[T0]]) // CHECK-NEXT: ret void @@ -33,7 +33,7 @@ void test0(id obj) { // Real EH cleanup. // CHECK: [[T0:%.*]] = landingpad // CHECK-NEXT: cleanup -// CHECK-NEXT: call void @objc_exception_try_exit([[BUF_T]]* [[BUF]]) +// CHECK-NEXT: call void @objc_exception_try_exit([[BUF_T]]* nonnull [[BUF]]) // CHECK-NEXT: [[T0:%.*]] = load i8*, i8** // CHECK-NEXT: call i32 @objc_sync_exit(i8* [[T0]]) // CHECK-NEXT: resume @@ -41,7 +41,7 @@ void test0(id obj) { // ObjC EH "cleanup". // CHECK: [[T0:%.*]] = load i8*, i8** // CHECK-NEXT: call i32 @objc_sync_exit(i8* [[T0]]) -// CHECK-NEXT: [[T0:%.*]] = call i8* @objc_exception_extract([[BUF_T]]* [[BUF]]) +// CHECK-NEXT: [[T0:%.*]] = call i8* @objc_exception_extract([[BUF_T]]* nonnull [[BUF]]) // CHECK-NEXT: call void @objc_exception_throw(i8* [[T0]]) // CHECK-NEXT: unreachable @@ -54,7 +54,7 @@ void test1(id obj, bool *failed) { } // CHECK-LABEL: define void @_Z5test1P11objc_objectPb( // Enter the @try block. -// CHECK: call void @objc_exception_try_enter([[BUF_T]]* [[BUF:%.*]]) +// CHECK: call void @objc_exception_try_enter([[BUF_T]]* nonnull [[BUF:%.*]]) // CHECK-NEXT: [[T0:%.*]] = getelementptr [[BUF_T]], [[BUF_T]]* [[BUF]], i32 0, i32 0, i32 0 // CHECK-NEXT: [[T1:%.*]] = call i32 @_setjmp(i32* [[T0]]) // CHECK-NEXT: [[T2:%.*]] = icmp eq i32 [[T1]], 0 @@ -64,14 +64,14 @@ void test1(id obj, bool *failed) { // CHECK: invoke void @_Z3foov() // Leave the @try. -// CHECK: call void @objc_exception_try_exit([[BUF_T]]* [[BUF]]) +// CHECK: call void @objc_exception_try_exit([[BUF_T]]* nonnull [[BUF]]) // CHECK-NEXT: br label // CHECK: ret void // Real EH cleanup. // CHECK: [[T0:%.*]] = landingpad // CHECK-NEXT: cleanup -// CHECK-NEXT: call void @objc_exception_try_exit([[BUF_T]]* [[BUF]]) +// CHECK-NEXT: call void @objc_exception_try_exit([[BUF_T]]* nonnull [[BUF]]) // CHECK-NEXT: resume // Catch handler. Reload of 'failed' address is unnecessary. diff --git a/test/CodeGenObjCXX/exceptions.mm b/test/CodeGenObjCXX/exceptions.mm index a62a82b..ef25f35 100644 --- a/test/CodeGenObjCXX/exceptions.mm +++ b/test/CodeGenObjCXX/exceptions.mm @@ -6,12 +6,13 @@ void opaque(); namespace test0 { // CHECK-LABEL: define void @_ZN5test03fooEv + // CHECK-SAME: personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) void foo() { try { // CHECK: invoke void @_Z6opaquev opaque(); } catch (OCType *T) { - // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) + // CHECK: landingpad { i8*, i32 } // CHECK-NEXT: catch %struct._objc_typeinfo* @"OBJC_EHTYPE_$_OCType" } } diff --git a/test/CoverageMapping/control-flow-macro.c b/test/CoverageMapping/control-flow-macro.c new file mode 100644 index 0000000..149cb55 --- /dev/null +++ b/test/CoverageMapping/control-flow-macro.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only %s | FileCheck %s + +#define ifc if + +// CHECK: main +// CHECK-NEXT: File 0, {{[0-9]+}}:40 -> [[END:[0-9]+]]:2 = #0 +int main(int argc, const char *argv[]) { + // CHECK: Expansion,File 0, [[@LINE+1]]:3 -> [[@LINE+1]]:6 = #0 + ifc(1) return 0; + // Expansion,File 0, [[@LINE+2]]:3 -> [[@LINE+2]]:6 = (#0 - #1) + // File 0, [[@LINE+1]]:6 -> [[END]]:2 = (#0 - #1) + ifc(1) return 0; + return 0; +} diff --git a/test/Driver/aarch64-cpus.c b/test/Driver/aarch64-cpus.c index 43e3ccd..4d4e1bc 100644 --- a/test/Driver/aarch64-cpus.c +++ b/test/Driver/aarch64-cpus.c @@ -109,5 +109,24 @@ // RUN: %clang -target aarch64 -mbig-endian -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s // RUN: %clang -target aarch64_be -mbig-endian -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s // RUN: %clang -target aarch64_be -mbig-endian -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s +// ================== Check whether -march accepts mixed-case values. +// RUN: %clang -target aarch64_be -march=ARMV8.1A -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s +// RUN: %clang -target aarch64_be -march=ARMV8.1-A -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s +// RUN: %clang -target aarch64 -mbig-endian -march=Armv8.1A -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s +// RUN: %clang -target aarch64 -mbig-endian -march=Armv8.1-A -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s +// RUN: %clang -target aarch64_be -mbig-endian -march=ARMv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s +// RUN: %clang -target aarch64_be -mbig-endian -march=ARMV8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s // GENERICV81A-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.1a" +// ================== Check whether -mcpu accepts mixed-case values. +// RUN: %clang -target aarch64 -mcpu=Cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CASE-INSENSITIVE-CA53 %s +// CASE-INSENSITIVE-CA53: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a53" + +// RUN: %clang -target arm64 -mcpu=cortex-A53 -### -c %s 2>&1 | FileCheck -check-prefix=CASE-INSENSITIVE-ARM64-CA53 %s +// CASE-INSENSITIVE-ARM64-CA53: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "cortex-a53" + +// RUN: %clang -target aarch64 -mcpu=CORTEX-A57 -### -c %s 2>&1 | FileCheck -check-prefix=CASE-INSENSITIVE-CA57 %s +// CASE-INSENSITIVE-CA57: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a57" + +// RUN: %clang -target arm64 -mcpu=Cortex-A57 -### -c %s 2>&1 | FileCheck -check-prefix=CASE-INSENSITIVE-ARM64-CA57 %s +// CASE-INSENSITIVE-ARM64-CA57: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "cortex-a57" diff --git a/test/Driver/arm-cortex-cpus.c b/test/Driver/arm-cortex-cpus.c index b9db962..ef3056d 100644 --- a/test/Driver/arm-cortex-cpus.c +++ b/test/Driver/arm-cortex-cpus.c @@ -402,3 +402,12 @@ // RUN: %clang -target arm-linux-gnueabi -mcpu=CorteX-a15 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CASE-INSENSITIVE-CPUV7A %s // RUN: %clang -target arm-linux-gnueabi -mcpu=CorteX-A17 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CASE-INSENSITIVE-CPUV7A %s // CHECK-CASE-INSENSITIVE-CPUV7A: "-cc1"{{.*}} "-triple" "armv7-{{.*}} + +// ================== Check whether -march accepts mixed-case values. +// RUN: %clang -target arm -march=Armv5 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CASE-INSENSITIVE-V5 %s +// RUN: %clang -target arm -march=ARMV5 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CASE-INSENSITIVE-V5 %s +// CHECK-CASE-INSENSITIVE-V5: "-cc1"{{.*}} "-triple" "armv5-{{.*}} "-target-cpu" "arm10tdmi" + +// RUN: %clang -target arm -march=Armv6t2 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CASE-INSENSITIVE-V6T2-THUMB %s +// RUN: %clang -target arm -march=ARMV6T2 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CASE-INSENSITIVE-V6T2-THUMB %s +// CHECK-CASE-INSENSITIVE-V6T2-THUMB: "-cc1"{{.*}} "-triple" "thumbv6t2-{{.*}} "-target-cpu" "arm1156t2-s" diff --git a/test/Driver/asan.c b/test/Driver/asan.c index f199e90..4db103d 100644 --- a/test/Driver/asan.c +++ b/test/Driver/asan.c @@ -1,8 +1,13 @@ -// RUN: %clang -target i386-unknown-unknown -fsanitize=address %s -S -emit-llvm -o - | FileCheck %s -// RUN: %clang -O1 -target i386-unknown-unknown -fsanitize=address %s -S -emit-llvm -o - | FileCheck %s -// RUN: %clang -O2 -target i386-unknown-unknown -fsanitize=address %s -S -emit-llvm -o - | FileCheck %s -// RUN: %clang -O3 -target i386-unknown-unknown -fsanitize=address %s -S -emit-llvm -o - | FileCheck %s -// Verify that -fsanitize=address invokes asan instrumentation. +// RUN: %clang -target i386-unknown-linux -fsanitize=address %s -S -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-ASAN +// RUN: %clang -O1 -target i386-unknown-linux -fsanitize=address %s -S -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-ASAN +// RUN: %clang -O2 -target i386-unknown-linux -fsanitize=address %s -S -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-ASAN +// RUN: %clang -O3 -target i386-unknown-linux -fsanitize=address %s -S -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-ASAN +// RUN: %clang -target i386-unknown-linux -fsanitize=kernel-address %s -S -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-KASAN +// RUN: %clang -O1 -target i386-unknown-linux -fsanitize=kernel-address %s -S -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-KASAN +// RUN: %clang -O2 -target i386-unknown-linux -fsanitize=kernel-address %s -S -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-KASAN +// RUN: %clang -O3 -target i386-unknown-linux -fsanitize=kernel-address %s -S -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-KASAN +// Verify that -fsanitize={address,kernel-address} invoke ASan and KASan instrumentation. int foo(int *a) { return *a; } -// CHECK: __asan_init +// CHECK-ASAN: __asan_init +// CHECK-KASAN: __asan_load4_noabort diff --git a/test/Driver/cl-options.c b/test/Driver/cl-options.c index 244e686..a1145f1 100644 --- a/test/Driver/cl-options.c +++ b/test/Driver/cl-options.c @@ -204,10 +204,11 @@ // NOSTRICT: "-relaxed-aliasing" // For some warning ids, we can map from MSVC warning to Clang warning. -// RUN: %clang_cl -wd4005 -wd4996 -### -- %s 2>&1 | FileCheck -check-prefix=Wno %s +// RUN: %clang_cl -wd4005 -wd4996 -wd4910 -### -- %s 2>&1 | FileCheck -check-prefix=Wno %s // Wno: "-cc1" // Wno: "-Wno-macro-redefined" // Wno: "-Wno-deprecated-declarations" +// Wno: "-Wno-dllexport-explicit-instantiation-decl" // Ignored options. Check that we don't get "unused during compilation" errors. // RUN: %clang_cl /c \ diff --git a/test/Driver/cl-outputs.c b/test/Driver/cl-outputs.c index b92c826..3d986db 100644 --- a/test/Driver/cl-outputs.c +++ b/test/Driver/cl-outputs.c @@ -266,9 +266,3 @@ // RUN: %clang_cl /P /Fifoo.x /obar.x -### -- %s 2>&1 | FileCheck -check-prefix=FioRACE2 %s // FioRACE2: "-E" // FioRACE2: "-o" "foo.x" - -// RUN: %clang_cl /c /GL -### -- %s 2>&1 | FileCheck -check-prefix=LTO-DEFAULT %s -// LTO-DEFAULT: "-emit-llvm-bc"{{.*}}"-o" "cl-outputs.obj" - -// RUN: %clang_cl /c /GL /Fofoo -### -- %s 2>&1 | FileCheck -check-prefix=LTO-FO %s -// LTO-FO: "-emit-llvm-bc"{{.*}}"-o" "foo.obj" diff --git a/test/Driver/fsanitize.c b/test/Driver/fsanitize.c index fff59a3..bac12dc 100644 --- a/test/Driver/fsanitize.c +++ b/test/Driver/fsanitize.c @@ -1,7 +1,11 @@ +// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fsanitize-trap=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-TRAP +// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fsanitize-trap=undefined -fno-sanitize-trap=signed-integer-overflow %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-TRAP2 +// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fsanitize-undefined-trap-on-error %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-TRAP // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-TRAP // RUN: %clang -target x86_64-linux-gnu -fsanitize-undefined-trap-on-error -fsanitize=undefined-trap %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-TRAP -// CHECK-UNDEFINED-TRAP: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){17}"}} -// CHECK-UNDEFINED-TRAP: "-fsanitize-undefined-trap-on-error" +// CHECK-UNDEFINED-TRAP: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute|function),?){18}"}} +// CHECK-UNDEFINED-TRAP: "-fsanitize-trap=alignment,array-bounds,bool,enum,float-cast-overflow,float-divide-by-zero,function,integer-divide-by-zero,nonnull-attribute,null,object-size,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unreachable,vla-bound" +// CHECK-UNDEFINED-TRAP2: "-fsanitize-trap=alignment,array-bounds,bool,enum,float-cast-overflow,float-divide-by-zero,function,integer-divide-by-zero,nonnull-attribute,null,object-size,return,returns-nonnull-attribute,shift-base,shift-exponent,unreachable,vla-bound" // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED // CHECK-UNDEFINED: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|function|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|vptr|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){19}"}} @@ -9,6 +13,9 @@ // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-DARWIN // CHECK-UNDEFINED-DARWIN: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|vptr|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){18}"}} +// RUN: %clang -target i386-unknown-openbsd -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-OPENBSD +// CHECK-UNDEFINED-OPENBSD: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){17}"}} + // RUN: %clang -target x86_64-linux-gnu -fsanitize=integer %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INTEGER // CHECK-INTEGER: "-fsanitize={{((signed-integer-overflow|unsigned-integer-overflow|integer-divide-by-zero|shift-base|shift-exponent),?){5}"}} @@ -27,11 +34,9 @@ // RUN: %clang -target x86_64-linux-gnu -fsanitize=shift -fno-sanitize=shift-base %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-FSANITIZE-SHIFT-PARTIAL // CHECK-FSANITIZE-SHIFT-PARTIAL: "-fsanitize=shift-exponent" -// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fsanitize-undefined-trap-on-error %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-TRAP-ON-ERROR-UNDEF -// CHECK-UNDEFINED-TRAP-ON-ERROR-UNDEF: '-fsanitize=undefined' not allowed with '-fsanitize-undefined-trap-on-error' - -// RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fsanitize-undefined-trap-on-error %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-TRAP-ON-ERROR-VPTR -// CHECK-UNDEFINED-TRAP-ON-ERROR-VPTR: '-fsanitize=vptr' not allowed with '-fsanitize-undefined-trap-on-error' +// RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fsanitize-trap=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-TRAP-UNDEF +// RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fsanitize-undefined-trap-on-error %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-TRAP-UNDEF +// CHECK-VPTR-TRAP-UNDEF: error: invalid argument '-fsanitize=vptr' not allowed with '-fsanitize-trap=undefined' // RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-NO-RTTI // CHECK-VPTR-NO-RTTI: '-fsanitize=vptr' not allowed with '-fno-rtti' @@ -57,6 +62,18 @@ // RUN: %clang -target x86_64-linux-gnu -fsanitize=leak,memory -pie -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANL-SANM // CHECK-SANL-SANM: '-fsanitize=leak' not allowed with '-fsanitize=memory' +// RUN: %clang -target x86_64-linux-gnu -fsanitize=kernel-address,thread -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANKA-SANT +// CHECK-SANKA-SANT: '-fsanitize=kernel-address' not allowed with '-fsanitize=thread' + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=kernel-address,memory -pie -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANKA-SANM +// CHECK-SANKA-SANM: '-fsanitize=kernel-address' not allowed with '-fsanitize=memory' + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=kernel-address,address -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANKA-SANA +// CHECK-SANKA-SANA: '-fsanitize=kernel-address' not allowed with '-fsanitize=address' + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=kernel-address,leak -pie -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANKA-SANL +// CHECK-SANKA-SANL: '-fsanitize=kernel-address' not allowed with '-fsanitize=leak' + // RUN: %clang -target x86_64-linux-gnu -fsanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-TRACK-ORIGINS // CHECK-ONLY-TRACK-ORIGINS: warning: argument unused during compilation: '-fsanitize-memory-track-origins' @@ -188,17 +205,29 @@ // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=function -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-FSAN-UBSAN-DARWIN // CHECK-FSAN-UBSAN-DARWIN: unsupported option '-fsanitize=function' for target 'x86_64-apple-darwin10' -// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI -// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi-derived-cast -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-DCAST -// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi-unrelated-cast -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-UCAST -// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi-nvcall -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-NVCALL -// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi-vcall -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-VCALL +// RUN: %clang -target armv7-apple-ios7 -miphoneos-version-min=7.0 -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-IOS +// CHECK-ASAN-IOS: unsupported option '-fsanitize=address' for target 'arm-apple-ios7' + +// RUN: %clang -target i386-pc-openbsd -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-OPENBSD +// CHECK-ASAN-OPENBSD: unsupported option '-fsanitize=address' for target 'i386-pc-openbsd' + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -flto -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI +// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi-derived-cast -flto -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-DCAST +// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi-unrelated-cast -flto -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-UCAST +// RUN: %clang -target x86_64-linux-gnu -flto -fsanitize=cfi-nvcall -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-NVCALL +// RUN: %clang -target x86_64-linux-gnu -flto -fsanitize=cfi-vcall -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-VCALL // CHECK-CFI: -emit-llvm-bc{{.*}}-fsanitize=cfi-derived-cast,cfi-unrelated-cast,cfi-nvcall,cfi-vcall // CHECK-CFI-DCAST: -emit-llvm-bc{{.*}}-fsanitize=cfi-derived-cast // CHECK-CFI-UCAST: -emit-llvm-bc{{.*}}-fsanitize=cfi-unrelated-cast // CHECK-CFI-NVCALL: -emit-llvm-bc{{.*}}-fsanitize=cfi-nvcall // CHECK-CFI-VCALL: -emit-llvm-bc{{.*}}-fsanitize=cfi-vcall +// RUN: %clang -target x86_64-linux-gnu -flto -fsanitize=cfi-derived-cast -fno-lto -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-NOLTO +// CHECK-CFI-NOLTO: '-fsanitize=cfi-derived-cast' only allowed with '-flto' + +// RUN: %clang -target x86_64-linux-gnu -fsanitize-trap=address -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-TRAP +// CHECK-ASAN-TRAP: error: unsupported argument 'address' to option '-fsanitize-trap' + // RUN: %clang_cl -fsanitize=address -c -MDd -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-DEBUGRTL // RUN: %clang_cl -fsanitize=address -c -MTd -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-DEBUGRTL // RUN: %clang_cl -fsanitize=address -c -LDd -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-DEBUGRTL @@ -216,3 +245,15 @@ // RUN: %clang_cl -fsanitize=address -c -MDd -MD -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-RELEASERTL // RUN: %clang_cl -fsanitize=address -c -LDd -LD -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-RELEASERTL // CHECK-ASAN-RELEASERTL-NOT: error: invalid argument + +// RUN: %clang -fno-sanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NOSP +// NOSP-NOT: "-fsanitize=safe-stack" + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP-ASAN +// RUN: %clang -target x86_64-linux-gnu -fstack-protector -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP +// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP +// SP-NOT: stack-protector +// SP: "-fsanitize=safe-stack" +// SP-ASAN-NOT: stack-protector +// SP-ASAN: "-fsanitize=address,safe-stack" diff --git a/test/Driver/mips-as.c b/test/Driver/mips-as.c index 755ae83..0da1a9e 100644 --- a/test/Driver/mips-as.c +++ b/test/Driver/mips-as.c @@ -281,3 +281,79 @@ // RUN: | FileCheck -check-prefix=NOODDSPREG --implicit-check-not=-modd-spreg %s // NOODDSPREG: as{{(.exe)?}}" // NOODDSPREG: -mno-odd-spreg +// +// RUN: %clang -target mips-linux-gnu -### -no-integrated-as -mdouble-float -msingle-float -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=SINGLEFLOAT --implicit-check-not=-mdouble-float %s +// SINGLEFLOAT: as{{(.exe)?}}" +// SINGLEFLOAT: -msingle-float +// +// RUN: %clang -target mips-linux-gnu -### -no-integrated-as -msingle-float -mdouble-float -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=DOUBLEFLOAT --implicit-check-not=-msingle-float %s +// DOUBLEFLOAT: as{{(.exe)?}}" +// DOUBLEFLOAT: -mdouble-float +// +// RUN: %clang -target mips-linux-gnu -### -no-integrated-as -msoft-float -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=SOFTFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s +// SOFTFLOAT-IMPLICIT-FPXX: as{{(.exe)?}}" +// SOFTFLOAT-IMPLICIT-FPXX: -msoft-float +// +// RUN: %clang -target mips-linux-gnu -### -no-integrated-as -msoft-float -mfpxx -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=SOFTFLOAT-EXPLICIT-FPXX %s +// SOFTFLOAT-EXPLICIT-FPXX: as{{(.exe)?}}" +// SOFTFLOAT-EXPLICIT-FPXX: -mfpxx +// SOFTFLOAT-EXPLICIT-FPXX: -msoft-float +// +// RUN: %clang -target mips-mti-linux-gnu -### -no-integrated-as -msoft-float -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=MTI-SOFTFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s +// MTI-SOFTFLOAT-IMPLICIT-FPXX: as{{(.exe)?}}" +// MTI-SOFTFLOAT-IMPLICIT-FPXX: -msoft-float +// +// RUN: %clang -target mips-mti-linux-gnu -### -no-integrated-as -msoft-float -mfpxx -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=MTI-SOFTFLOAT-EXPLICIT-FPXX %s +// MTI-SOFTFLOAT-EXPLICIT-FPXX: as{{(.exe)?}}" +// MTI-SOFTFLOAT-EXPLICIT-FPXX: -mfpxx +// MTI-SOFTFLOAT-EXPLICIT-FPXX: -msoft-float +// +// RUN: %clang -target mips-img-linux-gnu -### -no-integrated-as -msoft-float -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=IMG-SOFTFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s +// IMG-SOFTFLOAT-IMPLICIT-FPXX: as{{(.exe)?}}" +// IMG-SOFTFLOAT-IMPLICIT-FPXX: -msoft-float +// +// RUN: %clang -target mips-img-linux-gnu -### -no-integrated-as -msoft-float -mfpxx -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=IMG-SOFTFLOAT-EXPLICIT-FPXX %s +// IMG-SOFTFLOAT-EXPLICIT-FPXX: as{{(.exe)?}}" +// IMG-SOFTFLOAT-EXPLICIT-FPXX: -mfpxx +// IMG-SOFTFLOAT-EXPLICIT-FPXX: -msoft-float +// +// RUN: %clang -target mips-linux-gnu -### -no-integrated-as -msingle-float -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=SINGLEFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s +// SINGLEFLOAT-IMPLICIT-FPXX: as{{(.exe)?}}" +// SINGLEFLOAT-IMPLICIT-FPXX: -msingle-float +// +// RUN: %clang -target mips-linux-gnu -### -no-integrated-as -msingle-float -mfpxx -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=SINGLEFLOAT-EXPLICIT-FPXX %s +// SINGLEFLOAT-EXPLICIT-FPXX: as{{(.exe)?}}" +// SINGLEFLOAT-EXPLICIT-FPXX: -mfpxx +// SINGLEFLOAT-EXPLICIT-FPXX: -msingle-float +// +// RUN: %clang -target mips-mti-linux-gnu -### -no-integrated-as -msingle-float -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=MTI-SINGLEFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s +// MTI-SINGLEFLOAT-IMPLICIT-FPXX: as{{(.exe)?}}" +// MTI-SINGLEFLOAT-IMPLICIT-FPXX: -msingle-float +// +// RUN: %clang -target mips-mti-linux-gnu -### -no-integrated-as -msingle-float -mfpxx -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=MTI-SINGLEFLOAT-EXPLICIT-FPXX %s +// MTI-SINGLEFLOAT-EXPLICIT-FPXX: as{{(.exe)?}}" +// MTI-SINGLEFLOAT-EXPLICIT-FPXX: -mfpxx +// MTI-SINGLEFLOAT-EXPLICIT-FPXX: -msingle-float +// +// RUN: %clang -target mips-img-linux-gnu -### -no-integrated-as -msingle-float -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=IMG-SINGLEFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s +// IMG-SINGLEFLOAT-IMPLICIT-FPXX: as{{(.exe)?}}" +// IMG-SINGLEFLOAT-IMPLICIT-FPXX: -msingle-float +// +// RUN: %clang -target mips-img-linux-gnu -### -no-integrated-as -msingle-float -mfpxx -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=IMG-SINGLEFLOAT-EXPLICIT-FPXX %s +// IMG-SINGLEFLOAT-EXPLICIT-FPXX: as{{(.exe)?}}" +// IMG-SINGLEFLOAT-EXPLICIT-FPXX: -mfpxx +// IMG-SINGLEFLOAT-EXPLICIT-FPXX: -msingle-float diff --git a/test/Driver/mips-features.c b/test/Driver/mips-features.c index 5094f2b..461d778 100644 --- a/test/Driver/mips-features.c +++ b/test/Driver/mips-features.c @@ -157,3 +157,75 @@ // RUN: -G 16 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MIPS-G %s // CHECK-MIPS-G: "-mllvm" "-mips-ssection-threshold=16" +// +// -msoft-float (unknown vendor) +// RUN: %clang -target mips-linux-gnu -### -c %s -msoft-float 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-SOFTFLOAT %s +// CHECK-SOFTFLOAT: "-target-feature" "+soft-float" +// CHECK-SOFTFLOAT-NOT: "-target-feature" "+fpxx" +// +// -msoft-float -mfpxx (unknown vendor) +// RUN: %clang -target mips-linux-gnu -### -c %s -msoft-float -mfpxx 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-SOFTFLOAT-FPXX %s +// CHECK-SOFTFLOAT-FPXX: "-target-feature" "+soft-float" +// CHECK-SOFTFLOAT-FPXX: "-target-feature" "+fpxx" +// +// -msoft-float (MTI) +// RUN: %clang -target mips-mti-linux-gnu -### -c %s -msoft-float 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-MTI-SOFTFLOAT %s +// CHECK-MTI-SOFTFLOAT: "-target-feature" "+soft-float" +// CHECK-MTI-SOFTFLOAT-NOT: "-target-feature" "+fpxx" +// +// -msoft-float -mfpxx (MTI) +// RUN: %clang -target mips-mti-linux-gnu -### -c %s -msoft-float -mfpxx 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-MTI-SOFTFLOAT-FPXX %s +// CHECK-MTI-SOFTFLOAT-FPXX: "-target-feature" "+soft-float" +// CHECK-MTI-SOFTFLOAT-FPXX: "-target-feature" "+fpxx" +// +// -msoft-float (IMG) +// RUN: %clang -target mips-img-linux-gnu -### -c %s -msoft-float 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-IMG-SOFTFLOAT %s +// CHECK-IMG-SOFTFLOAT: "-target-feature" "+soft-float" +// CHECK-IMG-SOFTFLOAT-NOT: "-target-feature" "+fpxx" +// +// -msoft-float -mfpxx (IMG) +// RUN: %clang -target mips-img-linux-gnu -### -c %s -msoft-float -mfpxx 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-IMG-SOFTFLOAT-FPXX %s +// CHECK-IMG-SOFTFLOAT-FPXX: "-target-feature" "+soft-float" +// CHECK-IMG-SOFTFLOAT-FPXX: "-target-feature" "+fpxx" +// +// -msingle-float (unknown vendor) +// RUN: %clang -target mips-linux-gnu -### -c %s -msingle-float 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-SINGLEFLOAT %s +// CHECK-SINGLEFLOAT: "-target-feature" "+single-float" +// CHECK-SINGLEFLOAT-NOT: "-target-feature" "+fpxx" +// +// -msingle-float -mfpxx (unknown vendor) +// RUN: %clang -target mips-linux-gnu -### -c %s -msingle-float -mfpxx 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-SINGLEFLOAT-FPXX %s +// CHECK-SINGLEFLOAT-FPXX: "-target-feature" "+single-float" +// CHECK-SINGLEFLOAT-FPXX: "-target-feature" "+fpxx" +// +// -msingle-float (MTI) +// RUN: %clang -target mips-mti-linux-gnu -### -c %s -msingle-float 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-MTI-SINGLEFLOAT %s +// CHECK-MTI-SINGLEFLOAT: "-target-feature" "+single-float" +// CHECK-MTI-SINGLEFLOAT-NOT: "-target-feature" "+fpxx" +// +// -msingle-float -mfpxx (MTI) +// RUN: %clang -target mips-mti-linux-gnu -### -c %s -msingle-float -mfpxx 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-MTI-SINGLEFLOAT-FPXX %s +// CHECK-MTI-SINGLEFLOAT-FPXX: "-target-feature" "+single-float" +// CHECK-MTI-SINGLEFLOAT-FPXX: "-target-feature" "+fpxx" +// +// -msingle-float (IMG) +// RUN: %clang -target mips-img-linux-gnu -### -c %s -msingle-float 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-IMG-SINGLEFLOAT %s +// CHECK-IMG-SINGLEFLOAT: "-target-feature" "+single-float" +// CHECK-IMG-SINGLEFLOAT-NOT: "-target-feature" "+fpxx" +// +// -msingle-float -mfpxx (IMG) +// RUN: %clang -target mips-img-linux-gnu -### -c %s -msingle-float -mfpxx 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-IMG-SINGLEFLOAT-FPXX %s +// CHECK-IMG-SINGLEFLOAT-FPXX: "-target-feature" "+single-float" +// CHECK-IMG-SINGLEFLOAT-FPXX: "-target-feature" "+fpxx" diff --git a/test/Driver/mips-integrated-as.s b/test/Driver/mips-integrated-as.s index 2c298e7..0e12877 100644 --- a/test/Driver/mips-integrated-as.s +++ b/test/Driver/mips-integrated-as.s @@ -209,3 +209,87 @@ // RUN: FileCheck -check-prefix=ABICALLS-OFF %s // ABICALLS-OFF: -cc1as // ABICALLS-OFF: "-target-feature" "+noabicalls" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -msoft-float -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix=SOFTFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s +// SOFTFLOAT-IMPLICIT-FPXX: -cc1as +// SOFTFLOAT-IMPLICIT-FPXX: "-target-feature" "+soft-float" +// SOFTFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+fpxx" +// SOFTFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+nooddspreg" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -msoft-float -mfpxx -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix=SOFTFLOAT-EXPLICIT-FPXX %s +// SOFTFLOAT-EXPLICIT-FPXX: -cc1as +// SOFTFLOAT-EXPLICIT-FPXX: "-target-feature" "+soft-float" +// SOFTFLOAT-EXPLICIT-FPXX: "-target-feature" "+fpxx" +// SOFTFLOAT-EXPLICIT-FPXX: "-target-feature" "+nooddspreg" + +// RUN: %clang -target mips-mti-linux-gnu -### -fintegrated-as -msoft-float -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix=MTI-SOFTFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s +// MTI-SOFTFLOAT-IMPLICIT-FPXX: -cc1as +// MTI-SOFTFLOAT-IMPLICIT-FPXX: "-target-feature" "+soft-float" +// MTI-SOFTFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+fpxx" +// MTI-SOFTFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+nooddspreg" + +// RUN: %clang -target mips-mti-linux-gnu -### -fintegrated-as -msoft-float -mfpxx -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix=MTI-SOFTFLOAT-EXPLICIT-FPXX %s +// MTI-SOFTFLOAT-EXPLICIT-FPXX: -cc1as +// MTI-SOFTFLOAT-EXPLICIT-FPXX: "-target-feature" "+soft-float" +// MTI-SOFTFLOAT-EXPLICIT-FPXX: "-target-feature" "+fpxx" +// MTI-SOFTFLOAT-EXPLICIT-FPXX: "-target-feature" "+nooddspreg" + +// RUN: %clang -target mips-img-linux-gnu -### -fintegrated-as -msoft-float -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix=IMG-SOFTFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s +// IMG-SOFTFLOAT-IMPLICIT-FPXX: -cc1as +// IMG-SOFTFLOAT-IMPLICIT-FPXX: "-target-feature" "+soft-float" +// IMG-SOFTFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+fpxx" +// IMG-SOFTFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+nooddspreg" + +// RUN: %clang -target mips-img-linux-gnu -### -fintegrated-as -msoft-float -mfpxx -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix=IMG-SOFTFLOAT-EXPLICIT-FPXX %s +// IMG-SOFTFLOAT-EXPLICIT-FPXX: -cc1as +// IMG-SOFTFLOAT-EXPLICIT-FPXX: "-target-feature" "+soft-float" +// IMG-SOFTFLOAT-EXPLICIT-FPXX: "-target-feature" "+fpxx" +// IMG-SOFTFLOAT-EXPLICIT-FPXX: "-target-feature" "+nooddspreg" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -msingle-float -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix=SINGLEFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s +// SINGLEFLOAT-IMPLICIT-FPXX: -cc1as +// SINGLEFLOAT-IMPLICIT-FPXX: "-target-feature" "+single-float" +// SINGLEFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+fpxx" +// SINGLEFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+nooddspreg" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -msingle-float -mfpxx -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix=SINGLEFLOAT-EXPLICIT-FPXX %s +// SINGLEFLOAT-EXPLICIT-FPXX: -cc1as +// SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+single-float" +// SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+fpxx" +// SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+nooddspreg" + +// RUN: %clang -target mips-mti-linux-gnu -### -fintegrated-as -msingle-float -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix=MTI-SINGLEFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s +// MTI-SINGLEFLOAT-IMPLICIT-FPXX: -cc1as +// MTI-SINGLEFLOAT-IMPLICIT-FPXX: "-target-feature" "+single-float" +// MTI-SINGLEFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+fpxx" +// MTI-SINGLEFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+nooddspreg" + +// RUN: %clang -target mips-mti-linux-gnu -### -fintegrated-as -msingle-float -mfpxx -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix=MTI-SINGLEFLOAT-EXPLICIT-FPXX %s +// MTI-SINGLEFLOAT-EXPLICIT-FPXX: -cc1as +// MTI-SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+single-float" +// MTI-SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+fpxx" +// MTI-SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+nooddspreg" + +// RUN: %clang -target mips-img-linux-gnu -### -fintegrated-as -msingle-float -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix=IMG-SINGLEFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s +// IMG-SINGLEFLOAT-IMPLICIT-FPXX: -cc1as +// IMG-SINGLEFLOAT-IMPLICIT-FPXX: "-target-feature" "+single-float" +// IMG-SINGLEFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+fpxx" +// IMG-SINGLEFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+nooddspreg" + +// RUN: %clang -target mips-img-linux-gnu -### -fintegrated-as -msingle-float -mfpxx -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix=IMG-SINGLEFLOAT-EXPLICIT-FPXX %s +// IMG-SINGLEFLOAT-EXPLICIT-FPXX: -cc1as +// IMG-SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+single-float" +// IMG-SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+fpxx" +// IMG-SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+nooddspreg" diff --git a/test/Driver/modules.mm b/test/Driver/modules.mm index 63db699..d1536c7 100644 --- a/test/Driver/modules.mm +++ b/test/Driver/modules.mm @@ -6,3 +6,10 @@ // RUN: %clang -fmodules -### %s 2>&1 | FileCheck -check-prefix=CHECK-HAS-MODULES %s // RUN: %clang -fmodules -fno-cxx-modules -fcxx-modules -### %s 2>&1 | FileCheck -check-prefix=CHECK-HAS-MODULES %s // CHECK-HAS-MODULES: -fmodules + +// RUN: %clang -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MAPS %s +// RUN: %clang -fimplicit-module-maps -### %s 2>&1 | FileCheck -check-prefix=CHECK-HAS-MAPS %s +// RUN: %clang -fmodules -### %s 2>&1 | FileCheck -check-prefix=CHECK-HAS-MAPS %s +// RUN: %clang -fmodules -fno-implicit-module-maps -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MAPS %s +// CHECK-HAS-MAPS: -fimplicit-module-maps +// CHECK-NO-MAPS-NOT: -fimplicit-module-maps diff --git a/test/Driver/mrecip.c b/test/Driver/mrecip.c new file mode 100644 index 0000000..4e99b15 --- /dev/null +++ b/test/Driver/mrecip.c @@ -0,0 +1,70 @@ +//// +//// Verify that valid options for the -mrecip flag are passed through and invalid options cause an error. +//// + +//// If there are no options, convert to 'all'. + +// RUN: %clang -### -S %s -mrecip 2>&1 | FileCheck --check-prefix=RECIP0 %s +// RECIP0: "-mrecip=all" + +//// Check options that cover all types. + +// RUN: %clang -### -S %s -mrecip=all 2>&1 | FileCheck --check-prefix=RECIP1 %s +// RECIP1: "-mrecip=all" + +// RUN: %clang -### -S %s -mrecip=default 2>&1 | FileCheck --check-prefix=RECIP2 %s +// RECIP2: "-mrecip=default" + +// RUN: %clang -### -S %s -mrecip=none 2>&1 | FileCheck --check-prefix=RECIP3 %s +// RECIP3: "-mrecip=none" + +//// Check options that do not specify float or double. + +// RUN: %clang -### -S %s -mrecip=vec-sqrt 2>&1 | FileCheck --check-prefix=RECIP4 %s +// RECIP4: "-mrecip=vec-sqrt" + +// RUN: %clang -### -S %s -mrecip=!div,vec-div 2>&1 | FileCheck --check-prefix=RECIP5 %s +// RECIP5: "-mrecip=!div,vec-div" + +//// Check individual option types. + +// RUN: %clang -### -S %s -mrecip=vec-sqrtd 2>&1 | FileCheck --check-prefix=RECIP6 %s +// RECIP6: "-mrecip=vec-sqrtd" + +// RUN: %clang -### -S %s -mrecip=!divf 2>&1 | FileCheck --check-prefix=RECIP7 %s +// RECIP7: "-mrecip=!divf" + +// RUN: %clang -### -S %s -mrecip=divf,sqrtd,vec-divd,vec-sqrtf 2>&1 | FileCheck --check-prefix=RECIP8 %s +// RECIP8: "-mrecip=divf,sqrtd,vec-divd,vec-sqrtf" + +//// Check optional refinement step specifiers. + +// RUN: %clang -### -S %s -mrecip=all:1 2>&1 | FileCheck --check-prefix=RECIP9 %s +// RECIP9: "-mrecip=all:1" + +// RUN: %clang -### -S %s -mrecip=sqrtf:3 2>&1 | FileCheck --check-prefix=RECIP10 %s +// RECIP10: "-mrecip=sqrtf:3" + +// RUN: %clang -### -S %s -mrecip=div:5 2>&1 | FileCheck --check-prefix=RECIP11 %s +// RECIP11: "-mrecip=div:5" + +// RUN: %clang -### -S %s -mrecip=divd:1,!sqrtf:2,vec-divf:9,vec-sqrtd:0 2>&1 | FileCheck --check-prefix=RECIP12 %s +// RECIP12: "-mrecip=divd:1,!sqrtf:2,vec-divf:9,vec-sqrtd:0" + +//// Check invalid parameters. + +// RUN: %clang -### -S %s -mrecip=bogus 2>&1 | FileCheck --check-prefix=RECIP13 %s +// RECIP13: error: unknown argument + +// RUN: %clang -### -S %s -mrecip=divd:1,divd 2>&1 | FileCheck --check-prefix=RECIP14 %s +// RECIP14: error: invalid value + +// RUN: %clang -### -S %s -mrecip=sqrt,sqrtf 2>&1 | FileCheck --check-prefix=RECIP15 %s +// RECIP15: error: invalid value + +// RUN: %clang -### -S %s -mrecip=+default:10 2>&1 | FileCheck --check-prefix=RECIP16 %s +// RECIP16: error: invalid value + +// RUN: %clang -### -S %s -mrecip=!vec-divd: 2>&1 | FileCheck --check-prefix=RECIP17 %s +// RECIP17: error: invalid value + diff --git a/test/Driver/r600-mcpu.cl b/test/Driver/r600-mcpu.cl index 94a7734..4fbec0c 100644 --- a/test/Driver/r600-mcpu.cl +++ b/test/Driver/r600-mcpu.cl @@ -1,4 +1,4 @@ -// Check that -mcpu works for all supported GPUs +t// Check that -mcpu works for all supported GPUs // RUN: %clang -### -target r600 -x cl -S -emit-llvm -mcpu=r600 %s -o - 2>&1 | FileCheck --check-prefix=R600-CHECK %s // RUN: %clang -### -target r600 -x cl -S -emit-llvm -mcpu=rv630 %s -o - 2>&1 | FileCheck --check-prefix=R600-CHECK %s @@ -35,6 +35,9 @@ // RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri %s -o - 2>&1 | FileCheck --check-prefix=KAVERI-CHECK %s // RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=hawaii %s -o - 2>&1 | FileCheck --check-prefix=HAWAII-CHECK %s // RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=mullins %s -o - 2>&1 | FileCheck --check-prefix=MULLINS-CHECK %s +// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=tonga %s -o - 2>&1 | FileCheck --check-prefix=TONGA-CHECK %s +// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=iceland %s -o - 2>&1 | FileCheck --check-prefix=ICELAND-CHECK %s +// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=carrizo %s -o - 2>&1 | FileCheck --check-prefix=CARRIZO-CHECK %s // R600-CHECK: "-target-cpu" "r600" // RS880-CHECK: "-target-cpu" "rs880" @@ -60,3 +63,6 @@ // KAVERI-CHECK: "-target-cpu" "kaveri" // HAWAII-CHECK: "-target-cpu" "hawaii" // MULLINS-CHECK: "-target-cpu" "mullins" +// TONGA-CHECK: "-target-cpu" "tonga" +// ICELAND-CHECK: "-target-cpu" "iceland" +// CARRIZO-CHECK: "-target-cpu" "carrizo" diff --git a/test/Driver/rtti-options.cpp b/test/Driver/rtti-options.cpp index 46072ca..50354e5 100644 --- a/test/Driver/rtti-options.cpp +++ b/test/Driver/rtti-options.cpp @@ -15,17 +15,12 @@ // -fsanitize=vptr // Make sure we only error/warn once, when trying to enable vptr and // undefined and have -fno-rtti -// RUN: %clang -### -c -fsanitize=undefined -fsanitize=vptr -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-ERROR -check-prefix=CHECK-OK %s - -// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=vptr %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-WARN %s -// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=vptr -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s -// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=vptr -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-ERROR %s -// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=undefined -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s -// RUN: %clang -### -c -target x86_64-unknown-unknown -fsanitize=vptr %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s -// RUN: %clang -### -c -target x86_64-unknown-unknown -fsanitize=vptr -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s -// RUN: %clang -### -c -target x86_64-unknown-unknown -fsanitize=vptr -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-ERROR %s -// RUN: %clang -### -c -target x86_64-unknown-unknown -fsanitize=undefined %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s -// RUN: %clang -### -c -target x86_64-unknown-unknown -fsanitize=undefined -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s +// RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=undefined -fsanitize=vptr -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-ERROR -check-prefix=CHECK-OK %s +// RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=vptr %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s +// RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=vptr -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s +// RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=vptr -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-ERROR %s +// RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=undefined %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s +// RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=undefined -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s // Exceptions + no/default rtti // RUN: %clang -### -c -target x86_64-scei-ps4 -fcxx-exceptions -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-EXC-ERROR-CXX %s @@ -51,7 +46,6 @@ // RUN: %clang -### -c -target x86_64-unknown-unknown %s 2>&1 | FileCheck -check-prefix=CHECK-RTTI %s // CHECK-UNUSED: warning: argument unused during compilation: '-fcxx-exceptions' -// CHECK-SAN-WARN: implicitly disabling vptr sanitizer because rtti wasn't enabled // CHECK-SAN-ERROR: invalid argument '-fsanitize=vptr' not allowed with '-fno-rtti' // CHECK-EXC-WARN: implicitly enabling rtti for exception handling // CHECK-EXC-ERROR: invalid argument '-fno-rtti' not allowed with '-fexceptions' diff --git a/test/Driver/shave-toolchain.c b/test/Driver/shave-toolchain.c new file mode 100644 index 0000000..a02d049 --- /dev/null +++ b/test/Driver/shave-toolchain.c @@ -0,0 +1,22 @@ +// Ensure that '-target shave' picks a different compiler. +// Also check that '-I' is turned into '-i:' for the assembler. + +// Note that since we don't know where movi tools are installed, +// the driver may or may not find a full path to them. +// That is, the 0th argument will be "/path/to/my/moviCompile" +// or just "moviCompile" depending on whether moviCompile is found. +// As such, we test only for a trailing quote in its rendering. +// The same goes for "moviAsm". + +// RUN: %clang -target shave -c -### %s -Icommon 2>&1 \ +// RUN: | FileCheck %s -check-prefix=movicompile +// movicompile: moviCompile" "-DMYRIAD2" +// movicompile: moviAsm" "-no6thSlotCompression" "-cv:myriad2" "-noSPrefixing" "-a" "-i:common" "-elf" + +// RUN: %clang -target shave -c -### %s -DEFINE_ME -UNDEFINE_ME 2>&1 \ +// RUN: | FileCheck %s -check-prefix=defines +// defines: "-D" "EFINE_ME" "-U" "NDEFINE_ME" + +// RUN: %clang -target shave -c -### %s -Icommon -iquote quotepath -isystem syspath 2>&1 \ +// RUN: | FileCheck %s -check-prefix=includes +// includes: "-iquote" "quotepath" "-isystem" "syspath" diff --git a/test/Driver/sparc-float.c b/test/Driver/sparc-float.c index e84c487..6fa47f0 100644 --- a/test/Driver/sparc-float.c +++ b/test/Driver/sparc-float.c @@ -5,38 +5,36 @@ // RUN: %clang -c %s -### -o %t.o 2>&1 \ // RUN: -target sparc-linux-gnu \ // RUN: | FileCheck --check-prefix=CHECK-DEF %s -// CHECK-DEF: "-target-feature" "+soft-float" -// CHECK-DEF: "-msoft-float" +// CHECK-DEF-NOT: "-target-feature" "+soft-float" +// CHECK-DEF-NOT: "-msoft-float" // // -mhard-float // RUN: %clang -c %s -### -o %t.o 2>&1 \ // RUN: -target sparc-linux-gnu -mhard-float \ // RUN: | FileCheck --check-prefix=CHECK-HARD %s -// CHECK-HARD: "-mhard-float" +// CHECK-HARD-NOT: "-msoft-float" // // -msoft-float // RUN: %clang -c %s -### -o %t.o 2>&1 \ // RUN: -target sparc-linux-gnu -msoft-float \ // RUN: | FileCheck --check-prefix=CHECK-SOFT %s -// CHECK-SOFT: "-target-feature" "+soft-float" -// CHECK-SOFT: "-msoft-float" +// CHECK-SOFT: error: unsupported option '-msoft-float' // // Default sparc64 // RUN: %clang -c %s -### -o %t.o 2>&1 \ // RUN: -target sparc64-linux-gnu \ // RUN: | FileCheck --check-prefix=CHECK-DEF-SPARC64 %s -// CHECK-DEF-SPARC64: "-target-feature" "+soft-float" -// CHECK-DEF-SPARC64: "-msoft-float" +// CHECK-DEF-SPARC64-NOT: "-target-feature" "+soft-float" +// CHECK-DEF-SPARC64-NOT: "-msoft-float" // // -mhard-float // RUN: %clang -c %s -### -o %t.o 2>&1 \ // RUN: -target sparc64-linux-gnu -mhard-float \ // RUN: | FileCheck --check-prefix=CHECK-HARD-SPARC64 %s -// CHECK-HARD-SPARC64: "-mhard-float" +// CHECK-HARD-SPARC64-NOT: "-msoft-float" // // -msoft-float // RUN: %clang -c %s -### -o %t.o 2>&1 \ // RUN: -target sparc64-linux-gnu -msoft-float \ // RUN: | FileCheck --check-prefix=CHECK-SOFT-SPARC64 %s -// CHECK-SOFT-SPARC64: "-target-feature" "+soft-float" -// CHECK-SOFT-SPARC64: "-msoft-float" +// CHECK-SOFT-SPARC64: error: unsupported option '-msoft-float' diff --git a/test/FixIt/fixit-large-file.cpp b/test/FixIt/fixit-large-file.cpp new file mode 100644 index 0000000..a1dab53 --- /dev/null +++ b/test/FixIt/fixit-large-file.cpp @@ -0,0 +1,318 @@ +// Don't modify the source in place, since it might be readonly. +// RUN: cp %s %t.cpp +// RUN: not %clang_cc1 -fixit %t.cpp 2>&1 | FileCheck %s + +struct A { int x; }; +int foo(A *p) { + return p.x; +} + +// CHECK: error: member reference type 'A *' is a pointer; did you mean to use '->'? +// CHECK: note: FIX-IT applied suggested code changes +// CHECK-NOT: error: + +// The following comment block makes the file at least 16K, which causes clang +// to mmap it. This caused an issue with clang on Windows, where you cannot +// write a file which is currently mapped. +// +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx diff --git a/test/FixIt/fixit-nullability-declspec.cpp b/test/FixIt/fixit-nullability-declspec.cpp new file mode 100644 index 0000000..2ac20b9 --- /dev/null +++ b/test/FixIt/fixit-nullability-declspec.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -fblocks -Werror=nullability-declspec -x c++ -verify %s + +// RUN: cp %s %t +// RUN: not %clang_cc1 -fixit -fblocks -Werror=nullability-declspec -x c++ %t +// RUN: %clang_cc1 -fblocks -Werror=nullability-declspec -x c++ %t + +__nullable int *ip1; // expected-error{{nullability specifier '__nullable' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the pointer?}} +__nullable int (*fp1)(int); // expected-error{{nullability specifier '__nullable' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the function pointer?}} +__nonnull int (^bp1)(int); // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the block pointer?}} diff --git a/test/Format/style-on-command-line.cpp b/test/Format/style-on-command-line.cpp index 2e757cc..3f4f77a 100644 --- a/test/Format/style-on-command-line.cpp +++ b/test/Format/style-on-command-line.cpp @@ -29,3 +29,7 @@ void f() { int*i; int j; } + +// On Windows, the 'rm' commands fail when the previous process is still alive. +// This happens enough to make the test useless. +// REQUIRES: shell diff --git a/test/Frontend/rewrite-includes-modules.c b/test/Frontend/rewrite-includes-modules.c index 58d7809..613609d 100644 --- a/test/Frontend/rewrite-includes-modules.c +++ b/test/Frontend/rewrite-includes-modules.c @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x objective-c %s -F %S/../Modules/Inputs -E -frewrite-includes -o - | FileCheck %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x objective-c %s -F %S/../Modules/Inputs -E -frewrite-includes -o - | FileCheck %s int bar(); #include <Module/Module.h> diff --git a/test/Frontend/verify-ignore-unexpected.c b/test/Frontend/verify-ignore-unexpected.c new file mode 100644 index 0000000..bc3e0d1 --- /dev/null +++ b/test/Frontend/verify-ignore-unexpected.c @@ -0,0 +1,81 @@ +// RUN: not %clang_cc1 -DTEST_SWITCH -verify-ignore-unexpected=remark,aoeu,note -verify %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-BAD-SWITCH %s +#ifdef TEST_SWITCH +// expected-no-diagnostics +#endif +// CHECK-BAD-SWITCH: error: 'error' diagnostics seen but not expected: +// CHECK-BAD-SWITCH-NEXT: (frontend): invalid value 'aoeu' in '-verify-ignore-unexpected=' + +// RUN: %clang_cc1 -DTEST1 -verify %s +// RUN: %clang_cc1 -DTEST1 -verify -verify-ignore-unexpected %s +#ifdef TEST1 +#warning MyWarning1 + // expected-warning@-1 {{MyWarning1}} +int x; // expected-note {{previous definition is here}} +float x; // expected-error {{redefinition of 'x'}} +#endif + +// RUN: not %clang_cc1 -DTEST2 -verify %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-UNEXP %s +// RUN: not %clang_cc1 -DTEST2 -verify -verify-ignore-unexpected= %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-UNEXP %s +// RUN: not %clang_cc1 -DTEST2 -verify -verify-ignore-unexpected=note %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-NOTE %s +// RUN: not %clang_cc1 -DTEST2 -verify -verify-ignore-unexpected=warning %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-WARN %s +// RUN: not %clang_cc1 -DTEST2 -verify -verify-ignore-unexpected=error %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ERR %s +#ifdef TEST2 +#warning MyWarning2 +int x; +float x; +#endif +// CHECK-UNEXP: no expected directives found +// CHECK-UNEXP-NEXT: 'error' diagnostics seen but not expected +// CHECK-UNEXP-NEXT: Line {{[0-9]+}}: redefinition of 'x' +// CHECK-UNEXP-NEXT: 'warning' diagnostics seen but not expected +// CHECK-UNEXP-NEXT: Line {{[0-9]+}}: MyWarning2 +// CHECK-UNEXP-NEXT: 'note' diagnostics seen but not expected +// CHECK-UNEXP-NEXT: Line {{[0-9]+}}: previous definition is here +// CHECK-UNEXP-NEXT: 4 errors generated. + +// CHECK-NOTE: no expected directives found +// CHECK-NOTE-NEXT: 'error' diagnostics seen but not expected +// CHECK-NOTE-NEXT: Line {{[0-9]+}}: redefinition of 'x' +// CHECK-NOTE-NEXT: 'warning' diagnostics seen but not expected +// CHECK-NOTE-NEXT: Line {{[0-9]+}}: MyWarning2 +// CHECK-NOTE-NEXT: 3 errors generated. + +// CHECK-WARN: no expected directives found +// CHECK-WARN-NEXT: 'error' diagnostics seen but not expected +// CHECK-WARN-NEXT: Line {{[0-9]+}}: redefinition of 'x' +// CHECK-WARN-NEXT: 'note' diagnostics seen but not expected +// CHECK-WARN-NEXT: Line {{[0-9]+}}: previous definition is here +// CHECK-WARN-NEXT: 3 errors generated. + +// CHECK-ERR: no expected directives found +// CHECK-ERR-NEXT: 'warning' diagnostics seen but not expected +// CHECK-ERR-NEXT: Line {{[0-9]+}}: MyWarning2 +// CHECK-ERR-NEXT: 'note' diagnostics seen but not expected +// CHECK-ERR-NEXT: Line {{[0-9]+}}: previous definition is here +// CHECK-ERR-NEXT: 3 errors generated. + +// RUN: not %clang_cc1 -DTEST3 -verify -verify-ignore-unexpected %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-EXP %s +#ifdef TEST3 +// expected-error {{test3}} +#endif +// CHECK-EXP: 'error' diagnostics expected but not seen +// CHECK-EXP-NEXT: Line {{[0-9]+}}: test3 + +// RUN: not %clang_cc1 -DTEST4 -verify -verify-ignore-unexpected %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-NOEXP %s +// RUN: not %clang_cc1 -DTEST4 -verify -verify-ignore-unexpected=warning,error,note %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-NOEXP %s +#ifdef TEST4 +#warning MyWarning4 +int x; +float x; +#endif +// CHECK-NOEXP: error: no expected directives found +// CHECK-NOEXP-NEXT: 1 error generated diff --git a/test/Headers/pmmintrin.c b/test/Headers/pmmintrin.c new file mode 100644 index 0000000..5b7a3a4 --- /dev/null +++ b/test/Headers/pmmintrin.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -fsyntax-only -ffreestanding %s -verify +// RUN: %clang_cc1 -fsyntax-only -ffreestanding -x c++ %s -verify +// expected-no-diagnostics + +#if defined(i386) || defined(__x86_64__) +#include <pmmintrin.h> + +int __attribute__((__target__(("sse3")))) foo(int a) { + _mm_mwait(0, 0); + return 4; +} +#endif diff --git a/test/Headers/x86intrin-2.c b/test/Headers/x86intrin-2.c new file mode 100644 index 0000000..f98fdbd --- /dev/null +++ b/test/Headers/x86intrin-2.c @@ -0,0 +1,137 @@ +// RUN: %clang_cc1 -fsyntax-only -ffreestanding %s -verify +// RUN: %clang_cc1 -fsyntax-only -ffreestanding -fno-lax-vector-conversions %s -verify +// RUN: %clang_cc1 -fsyntax-only -ffreestanding -x c++ %s -verify +// expected-no-diagnostics + +#if defined(i386) || defined(__x86_64__) + +// Include the metaheader that includes all x86 intrinsic headers. +#include <x86intrin.h> + +void __attribute__((__target__("mmx"))) mm_empty_wrap(void) { + _mm_empty(); +} + +__m128 __attribute__((__target__("sse"))) mm_add_ss_wrap(__m128 a, __m128 b) { + return _mm_add_ss(a, b); +} + +__m128d __attribute__((__target__("sse2"))) mm_sqrt_sd_wrap(__m128d a, __m128d b) { + return _mm_sqrt_sd(a, b); +} + +void __attribute__((__target__("sse3"))) mm_mwait_wrap(int a) { + _mm_mwait(0, 0); +} + +__m64 __attribute__((__target__("ssse3"))) mm_abs_pi8_wrap(__m64 a) { + return _mm_abs_pi8(a); +} + +__m128i __attribute__((__target__("sse4.1"))) mm_minpos_epu16_wrap(__m128i v) { + return _mm_minpos_epu16(v); +} + +unsigned int __attribute__((__target__("sse4.2"))) mm_crc32_u8_wrap(unsigned int c, unsigned char d) { + return _mm_crc32_u8(c, d); +} + +__m128i __attribute__((__target__("aes"))) mm_aesenc_si128_wrap(__m128i v, __m128i r) { + return _mm_aesenc_si128(v, r); +} + +__m256d __attribute__((__target__("avx"))) mm256_add_pd_wrap(__m256d a, __m256d b) { + return _mm256_add_pd(a, b); +} + +__m256i __attribute__((__target__("avx2"))) mm256_abs_epi8_wrap(__m256i a) { + return _mm256_abs_epi8(a); +} + +unsigned short __attribute__((__target__("bmi"))) tzcnt_u16_wrap(unsigned short x) { + return __tzcnt_u16(x); +} + +unsigned int __attribute__((__target__("bmi2"))) bzhi_u32_wrap(unsigned int x, unsigned int y) { + return _bzhi_u32(x, y); +} + +unsigned short __attribute__((__target__("lzcnt"))) lzcnt16_wrap(unsigned short x) { + return __lzcnt16(x); +} + +__m256d __attribute__((__target__("fma"))) mm256_fmsubadd_pd_wrap(__m256d a, __m256d b, __m256d c) { + return _mm256_fmsubadd_pd(a, b, c); +} + +__m512i __attribute__((__target__("avx512f"))) mm512_setzero_si512_wrap(void) { + return _mm512_setzero_si512(); +} + +__mmask8 __attribute__((__target__("avx512vl"))) mm_cmpeq_epi32_mask_wrap(__m128i a, __m128i b) { + return _mm_cmpeq_epi32_mask(a, b); +} + +__v64qi __attribute__((__target__("avx512bw"))) mm512_setzero_qi_wrap(void) { + return _mm512_setzero_qi(); +} + +__m512i __attribute__((__target__("avx512dq"))) mm512_mullo_epi64_wrap(__m512i a, __m512i b) { + return _mm512_mullo_epi64(a, b); +} + +__mmask16 __attribute__((__target__("avx512vl,avx512bw"))) mm_cmpeq_epi8_mask_wrap(__m128i a, __m128i b) { + return _mm_cmpeq_epi8_mask(a, b); +} + +__m256i __attribute__((__target__("avx512vl,avx512dq"))) mm256_mullo_epi64_wrap(__m256i a, __m256i b) { + return _mm256_mullo_epi64(a, b); +} + +int __attribute__((__target__("rdrnd"))) rdrand16_step_wrap(unsigned short *p) { + return _rdrand16_step(p); +} + +#if defined(__x86_64__) +unsigned int __attribute__((__target__("fsgsbase"))) readfsbase_u32_wrap(void) { + return _readfsbase_u32(); +} +#endif + +unsigned int __attribute__((__target__("rtm"))) xbegin_wrap(void) { + return _xbegin(); +} + +__m128i __attribute__((__target__("sha"))) mm_sha1nexte_epu32_wrap(__m128i x, __m128i y) { + return _mm_sha1nexte_epu32(x, y); +} + +int __attribute__((__target__("rdseed"))) rdseed16_step_wrap(unsigned short *p) { + return _rdseed16_step(p); +} + +__m128i __attribute__((__target__("sse4a"))) mm_extract_si64_wrap(__m128i x, __m128i y) { + return _mm_extract_si64(x, y); +} + +__m128 __attribute__((__target__("fma4"))) mm_macc_ps_wrap(__m128 a, __m128 b, __m128 c) { + return _mm_macc_ps(a, b, c); +} + +__m256 __attribute__((__target__("xop"))) mm256_frcz_ps_wrap(__m256 a) { + return _mm256_frcz_ps(a); +} + +unsigned int __attribute__((__target__("tbm"))) blcfill_u32_wrap(unsigned int a) { + return __blcfill_u32(a); +} + +__m128 __attribute__((__target__("f16c"))) mm_cvtph_ps_wrap(__m128i a) { + return _mm_cvtph_ps(a); +} + +int __attribute__((__target__("rtm"))) xtest_wrap(void) { + return _xtest(); +} + +#endif diff --git a/test/Headers/x86intrin.c b/test/Headers/x86intrin.c index 6a1608b..7c15c48 100644 --- a/test/Headers/x86intrin.c +++ b/test/Headers/x86intrin.c @@ -5,126 +5,7 @@ #if defined(i386) || defined(__x86_64__) -// Pretend to enable all features. -#ifndef __3dNOW__ -#define __3dNOW__ -#endif -#ifndef __BMI__ -#define __BMI__ -#endif -#ifndef __BMI2__ -#define __BMI2__ -#endif -#ifndef __LZCNT__ -#define __LZCNT__ -#endif -#ifndef __POPCNT__ -#define __POPCNT__ -#endif -#ifndef __RDSEED__ -#define __RDSEED__ -#endif -#ifndef __PRFCHW__ -#define __PRFCHW__ -#endif -#ifndef __SSE4A__ -#define __SSE4A__ -#endif -#ifndef __FMA4__ -#define __FMA4__ -#endif -#ifndef __XOP__ -#define __XOP__ -#endif -#ifndef __F16C__ -#define __F16C__ -#endif -#ifndef __MMX__ -#define __MMX__ -#endif -#ifndef __SSE__ -#define __SSE__ -#endif -#ifndef __SSE2__ -#define __SSE2__ -#endif -#ifndef __SSE3__ -#define __SSE3__ -#endif -#ifndef __SSSE3__ -#define __SSSE3__ -#endif -#ifndef __SSE4_1__ -#define __SSE4_1__ -#endif -#ifndef __SSE4_2__ -#define __SSE4_2__ -#endif -#ifndef __AES__ -#define __AES__ -#endif -#ifndef __AVX__ -#define __AVX__ -#endif -#ifndef __AVX2__ -#define __AVX2__ -#endif -#ifndef __BMI__ -#define __BMI__ -#endif -#ifndef __BMI2__ -#define __BMI2__ -#endif -#ifndef __LZCNT__ -#define __LZCNT__ -#endif -#ifndef __FMA__ -#define __FMA__ -#endif -#ifndef __RDRND__ -#define __RDRND__ -#endif -#ifndef __SHA__ -#define __SHA__ -#endif -#ifndef __ADX__ -#define __ADX__ -#endif -#ifndef __TBM__ -#define __TBM__ -#endif -#ifndef __RTM__ -#define __RTM__ -#endif -#ifndef __PCLMUL__ -#define __PCLMUL__ -#endif -#ifndef __FSGSBASE__ -#define __FSGSBASE__ -#endif -#ifndef __AVX512F__ -#define __AVX512F__ -#endif -#ifndef __AVX512VL__ -#define __AVX512VL__ -#endif -#ifndef __AVX512BW__ -#define __AVX512BW__ -#endif -#ifndef __AVX512ER__ -#define __AVX512ER__ -#endif -#ifndef __AVX512PF__ -#define __AVX512PF__ -#endif -#ifndef __AVX512DQ__ -#define __AVX512DQ__ -#endif -#ifndef __AVX512CD__ -#define __AVX512CD__ -#endif - -// Now include the metaheader that includes all x86 intrinsic headers. +// Include the metaheader that includes all x86 intrinsic headers. #include <x86intrin.h> #endif diff --git a/test/Headers/xmmintrin.c b/test/Headers/xmmintrin.c index 76fff0d..5bf5d4a 100644 --- a/test/Headers/xmmintrin.c +++ b/test/Headers/xmmintrin.c @@ -2,7 +2,7 @@ // // RUN: rm -rf %t // RUN: %clang_cc1 %s -ffreestanding -triple x86_64-apple-macosx10.9.0 -emit-llvm -o - \ -// RUN: -fmodules -fmodules-cache-path=%t -isystem %S/Inputs/include \ +// RUN: -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -isystem %S/Inputs/include \ // RUN: | FileCheck %s #include <xmmintrin.h> diff --git a/test/Index/comment-objc-decls.m b/test/Index/comment-objc-decls.m index ae3b0bb..d53757c 100644 --- a/test/Index/comment-objc-decls.m +++ b/test/Index/comment-objc-decls.m @@ -20,19 +20,19 @@ * \param[in] range output value is unsigned int * \result return index */ -- (unsigned int)MethodMyProto:(id)anObject inRange:(unsigned int)range; +- (unsigned int)MethodMyProto:(nullable id)anObject inRange:(unsigned int)range; /** * \brief PropertyMyProto - This is protocol's property. */ -@property (copy) id PropertyMyProto; +@property (copy, nonnull) id PropertyMyProto; /** * \brief ClassMethodMyProto */ + ClassMethodMyProto; @end // CHECK: <Declaration>@protocol MyProto\n@end</Declaration> -// CHECK: <Declaration>- (unsigned int)MethodMyProto:(id)anObject inRange:(unsigned int)range;</Declaration> -// CHECK: <Declaration>@optional\n@property(readwrite, copy, atomic) id PropertyMyProto;</Declaration> +// CHECK: <Declaration>- (unsigned int)MethodMyProto:(nullable id)anObject inRange:(unsigned int)range;</Declaration> +// CHECK: <Declaration>@optional\n@property(readwrite, copy, atomic, nonnull) id PropertyMyProto;</Declaration> // CHECK: <Declaration>+ (id)ClassMethodMyProto;</Declaration> /** diff --git a/test/Index/complete-method-decls.m b/test/Index/complete-method-decls.m index eceaa83..0e3780b 100644 --- a/test/Index/complete-method-decls.m +++ b/test/Index/complete-method-decls.m @@ -82,6 +82,14 @@ typedef A *MyObjectRef; @end @implementation I1 +-(void)foo {} +@end + +@interface I2 +-(nonnull I2 *)produceI2:(nullable I2 *)i2; +@end + +@implementation I2 - @end @@ -153,6 +161,8 @@ typedef A *MyObjectRef; // CHECK-CCF: NotImplemented:{TypedText byref} (40) // CHECK-CCF: NotImplemented:{TypedText in} (40) // CHECK-CCF: NotImplemented:{TypedText inout} (40) +// CHECK-CCF: NotImplemented:{TypedText nonnull} (40) +// CHECK-CCF: NotImplemented:{TypedText nullable} (40) // CHECK-CCF: NotImplemented:{TypedText oneway} (40) // CHECK-CCF: NotImplemented:{TypedText out} (40) // CHECK-CCF: NotImplemented:{TypedText unsigned} (50) @@ -201,3 +211,6 @@ typedef A *MyObjectRef; // FIXME: It should be "MyObject <P1> *"" // CHECK-CLASSTY: ObjCInstanceMethodDecl:{LeftParen (}{Text A<P1> *}{RightParen )}{TypedText meth2} // CHECK-CLASSTY: ObjCInstanceMethodDecl:{LeftParen (}{Text MyObjectRef}{RightParen )}{TypedText meth3} + +// RUN: c-index-test -code-completion-at=%s:93:2 %s | FileCheck -check-prefix=CHECK-NULLABILITY %s +// CHECK-NULLABILITY: ObjCInstanceMethodDecl:{LeftParen (}{Text nonnull }{Text I2 *}{RightParen )}{TypedText produceI2}{TypedText :}{LeftParen (}{Text nullable }{Text I2 *}{RightParen )}{Text i2} (40) diff --git a/test/Index/complete-objc-message.m b/test/Index/complete-objc-message.m index 5a72005..a62b491 100644 --- a/test/Index/complete-objc-message.m +++ b/test/Index/complete-objc-message.m @@ -189,6 +189,14 @@ void test_DO(DO *d, A* a) { [d method:a aout:&a]; } +@interface Nullability +- (nonnull A *)method:(nullable A *)param; +@end + +void test_Nullability(Nullability *n, A* a) { + [n method: a]; +} + // RUN: c-index-test -code-completion-at=%s:23:19 %s | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: {TypedText categoryClassMethod} (35) // CHECK-CC1: {TypedText classMethod1:}{Placeholder (id)}{HorizontalSpace }{TypedText withKeyword:}{Placeholder (int)} (35) @@ -335,3 +343,6 @@ void test_DO(DO *d, A* a) { // RUN: c-index-test -code-completion-at=%s:189:6 %s | FileCheck -check-prefix=CHECK-DISTRIB-OBJECTS %s // CHECK-DISTRIB-OBJECTS: ObjCInstanceMethodDecl:{ResultType void}{TypedText method:}{Placeholder (in bycopy A *)}{HorizontalSpace }{TypedText result:}{Placeholder (out byref A **)} (35) + +// RUN: c-index-test -code-completion-at=%s:197:6 %s | FileCheck -check-prefix=CHECK-NULLABLE %s +// CHECK-NULLABLE: ObjCInstanceMethodDecl:{ResultType A * __nonnull}{TypedText method:}{Placeholder (nullable A *)} diff --git a/test/Index/complete-property-flags.m b/test/Index/complete-property-flags.m index 13ec1e7..9e3fc1a 100644 --- a/test/Index/complete-property-flags.m +++ b/test/Index/complete-property-flags.m @@ -13,6 +13,10 @@ // CHECK-CC1-NEXT: {TypedText copy} // CHECK-CC1-NEXT: {TypedText getter}{Text =}{Placeholder method} // CHECK-CC1-NEXT: {TypedText nonatomic} +// CHECK-CC1: {TypedText nonnull} +// CHECK-CC1-NEXT: {TypedText null_resettable} +// CHECK-CC1-NEXT: {TypedText null_unspecified} +// CHECK-CC1-NEXT: {TypedText nullable} // CHECK-CC1-NEXT: {TypedText readonly} // CHECK-CC1-NEXT: {TypedText readwrite} // CHECK-CC1-NEXT: {TypedText retain} @@ -27,6 +31,10 @@ // CHECK-CC1-ARC-NEXT: {TypedText copy} // CHECK-CC1-ARC-NEXT: {TypedText getter}{Text =}{Placeholder method} // CHECK-CC1-ARC-NEXT: {TypedText nonatomic} +// CHECK-CC1-ARC-NEXT: {TypedText nonnull} +// CHECK-CC1-ARC-NEXT: {TypedText null_resettable} +// CHECK-CC1-ARC-NEXT: {TypedText null_unspecified} +// CHECK-CC1-ARC-NEXT: {TypedText nullable} // CHECK-CC1-ARC-NEXT: {TypedText readonly} // CHECK-CC1-ARC-NEXT: {TypedText readwrite} // CHECK-CC1-ARC-NEXT: {TypedText retain} @@ -38,6 +46,10 @@ // RUN: c-index-test -code-completion-at=%s:8:18 %s | FileCheck -check-prefix=CHECK-CC2 %s // CHECK-CC2: {TypedText getter}{Text =}{Placeholder method} // CHECK-CC2-NEXT: {TypedText nonatomic} +// CHECK-CC2-NEXT: {TypedText nonnull} +// CHECK-CC2-NEXT: {TypedText null_resettable} +// CHECK-CC2-NEXT: {TypedText null_unspecified} +// CHECK-CC2-NEXT: {TypedText nullable} // CHECK-CC2-NEXT: {TypedText readonly} // CHECK-CC2-NEXT: {TypedText readwrite} // CHECK-CC2-NEXT: {TypedText setter}{Text =}{Placeholder method} diff --git a/test/Index/complete-stmt.c b/test/Index/complete-stmt.c index 3d31ca2..8bbfe2d 100644 --- a/test/Index/complete-stmt.c +++ b/test/Index/complete-stmt.c @@ -16,6 +16,8 @@ void f(int x) { // CHECK-IF-ELSE-SIMPLE: NotImplemented:{TypedText else}{HorizontalSpace }{Text if}{HorizontalSpace }{LeftParen (}{Placeholder expression}{RightParen )} (40) // RUN: c-index-test -code-completion-at=%s:6:1 %s | FileCheck -check-prefix=CHECK-STMT %s +// CHECK-STMT: NotImplemented:{TypedText __nonnull} (50) +// CHECK-STMT: NotImplemented:{TypedText __nullable} (50) // CHECK-STMT: NotImplemented:{TypedText char} (50) // CHECK-STMT: NotImplemented:{TypedText const} (50) // CHECK-STMT: NotImplemented:{TypedText double} (50) diff --git a/test/Index/pch-depending-on-deleted-module.c b/test/Index/pch-depending-on-deleted-module.c index 4e85ff0..a0fbaf5 100644 --- a/test/Index/pch-depending-on-deleted-module.c +++ b/test/Index/pch-depending-on-deleted-module.c @@ -3,11 +3,11 @@ // RUN: rm -rf %t // RUN: mkdir %t -// RUN: %clang_cc1 -x c-header -fmodules -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -emit-pch -I %S/Inputs/Headers -o %t/use_LibA.pch %s -// RUN: %clang_cc1 -fmodules -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -I %S/Inputs/Headers -verify-pch %t/use_LibA.pch +// RUN: %clang_cc1 -x c-header -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -emit-pch -I %S/Inputs/Headers -o %t/use_LibA.pch %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -I %S/Inputs/Headers -verify-pch %t/use_LibA.pch // RUN: rm -f %t/modules-cache/LibA.pcm -// RUN: not %clang_cc1 -fmodules -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -I %S/Inputs/Headers -verify-pch %t/use_LibA.pch 2>&1 | FileCheck -check-prefix=VERIFY %s -// RUN: not c-index-test -test-load-source all -x c -fmodules -Xclang -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -I %S/Inputs/Headers -include-pch %t/use_LibA.pch %s 2>&1 | FileCheck -check-prefix=INDEX %s +// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -I %S/Inputs/Headers -verify-pch %t/use_LibA.pch 2>&1 | FileCheck -check-prefix=VERIFY %s +// RUN: not c-index-test -test-load-source all -x c -fmodules -fimplicit-module-maps -Xclang -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -I %S/Inputs/Headers -include-pch %t/use_LibA.pch %s 2>&1 | FileCheck -check-prefix=INDEX %s // VERIFY: fatal error: malformed or corrupted AST file: 'Unable to load module // INDEX: {{^}}Failure: AST deserialization error occurred{{$}} diff --git a/test/Lexer/has_feature_address_sanitizer.cpp b/test/Lexer/has_feature_address_sanitizer.cpp index 5c98116..406a2ab 100644 --- a/test/Lexer/has_feature_address_sanitizer.cpp +++ b/test/Lexer/has_feature_address_sanitizer.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -E -fsanitize=address %s -o - | FileCheck --check-prefix=CHECK-ASAN %s +// RUN: %clang_cc1 -E -fsanitize=kernel-address %s -o - | FileCheck --check-prefix=CHECK-ASAN %s // RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-ASAN %s #if __has_feature(address_sanitizer) diff --git a/test/Modules/Inputs/merge-class-definition-visibility/a.h b/test/Modules/Inputs/merge-class-definition-visibility/a.h new file mode 100644 index 0000000..4c5cd94 --- /dev/null +++ b/test/Modules/Inputs/merge-class-definition-visibility/a.h @@ -0,0 +1 @@ +struct A {}; diff --git a/test/Modules/Inputs/merge-class-definition-visibility/b.h b/test/Modules/Inputs/merge-class-definition-visibility/b.h new file mode 100644 index 0000000..2b8f5f8 --- /dev/null +++ b/test/Modules/Inputs/merge-class-definition-visibility/b.h @@ -0,0 +1,2 @@ +// Include definition of A into the same module as c.h +#include "a.h" diff --git a/test/Modules/Inputs/merge-class-definition-visibility/c.h b/test/Modules/Inputs/merge-class-definition-visibility/c.h new file mode 100644 index 0000000..27f503c --- /dev/null +++ b/test/Modules/Inputs/merge-class-definition-visibility/c.h @@ -0,0 +1 @@ +struct A; diff --git a/test/Modules/Inputs/merge-class-definition-visibility/d.h b/test/Modules/Inputs/merge-class-definition-visibility/d.h new file mode 100644 index 0000000..2243de1 --- /dev/null +++ b/test/Modules/Inputs/merge-class-definition-visibility/d.h @@ -0,0 +1 @@ +#include "a.h" diff --git a/test/Modules/Inputs/merge-class-definition-visibility/modmap b/test/Modules/Inputs/merge-class-definition-visibility/modmap new file mode 100644 index 0000000..7d988fb --- /dev/null +++ b/test/Modules/Inputs/merge-class-definition-visibility/modmap @@ -0,0 +1,7 @@ +module Def1 { + module B { header "b.h" } + module C { header "c.h" } +} +module Def2 { + header "d.h" +} diff --git a/test/Modules/Inputs/submodules-merge-defs/defs.h b/test/Modules/Inputs/submodules-merge-defs/defs.h index 68b57a4..247b05c 100644 --- a/test/Modules/Inputs/submodules-merge-defs/defs.h +++ b/test/Modules/Inputs/submodules-merge-defs/defs.h @@ -31,7 +31,7 @@ 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; } +//template<> template<typename U> int F<char>::g() { return 0; } // FIXME: Re-enable this once we support merging member specializations. template<> struct F<void> { int h(); }; inline int F<void>::h() { return 0; } template<typename T> struct F<T *> { int i(); }; @@ -46,3 +46,31 @@ namespace G { template<typename T = int, int N = 3, template<typename> class K = F> int H(int a = 1); template<typename T = int, int N = 3, template<typename> class K = F> using I = decltype(H<T, N, K>()); +template<typename T = int, int N = 3, template<typename> class K = F> struct J {}; + +namespace NS { + struct A {}; + template<typename T> struct B : A {}; + template<typename T> struct B<T*> : B<char> {}; + template<> struct B<int> : B<int*> {}; + inline void f() {} +} + +namespace StaticInline { + struct X {}; + static inline void f(X); + static inline void g(X x) { f(x); } +} + +namespace FriendDefArg { + template<typename = int> struct A; + template<int = 0> struct B; + template<template<typename> class = A> struct C; + template<typename = int, int = 0, template<typename> class = A> struct D {}; + template<typename U> struct Y { + template<typename> friend struct A; + template<int> friend struct B; + template<template<typename> class> friend struct C; + template<typename, int, template<typename> class> friend struct D; + }; +} diff --git a/test/Modules/Inputs/submodules-merge-defs/indirect.h b/test/Modules/Inputs/submodules-merge-defs/indirect.h new file mode 100644 index 0000000..28baa01 --- /dev/null +++ b/test/Modules/Inputs/submodules-merge-defs/indirect.h @@ -0,0 +1 @@ +#include "merged-defs.h" diff --git a/test/Modules/Inputs/submodules-merge-defs/module.modulemap b/test/Modules/Inputs/submodules-merge-defs/module.modulemap index 82abdb0..3b5493e 100644 --- a/test/Modules/Inputs/submodules-merge-defs/module.modulemap +++ b/test/Modules/Inputs/submodules-merge-defs/module.modulemap @@ -2,6 +2,7 @@ module "stuff" { textual header "defs.h" module "empty" { header "empty.h" } module "use" { header "use-defs.h" } + module "use-2" { requires use_defs_twice header "use-defs-2.h" } } module "redef" { @@ -14,3 +15,8 @@ module "merged-defs" { header "merged-defs.h" use "stuff" } + +module "indirect" { + header "indirect.h" + use "merged-defs" +} diff --git a/test/Modules/Inputs/submodules-merge-defs/use-defs-2.h b/test/Modules/Inputs/submodules-merge-defs/use-defs-2.h new file mode 100644 index 0000000..a78f08a --- /dev/null +++ b/test/Modules/Inputs/submodules-merge-defs/use-defs-2.h @@ -0,0 +1,2 @@ +// use-defs-2.h +#include "defs.h" diff --git a/test/Modules/Inputs/submodules-merge-defs/use-defs.h b/test/Modules/Inputs/submodules-merge-defs/use-defs.h index 31c69c6..2e88376 100644 --- a/test/Modules/Inputs/submodules-merge-defs/use-defs.h +++ b/test/Modules/Inputs/submodules-merge-defs/use-defs.h @@ -1 +1,2 @@ +// use-defs.h #include "defs.h" diff --git a/test/Modules/Inputs/template-default-args/a.h b/test/Modules/Inputs/template-default-args/a.h index 1ef1ea5..be760fe 100644 --- a/test/Modules/Inputs/template-default-args/a.h +++ b/test/Modules/Inputs/template-default-args/a.h @@ -2,3 +2,6 @@ template<typename T = int> struct A {}; template<typename T> struct B {}; template<typename T> struct C; template<typename T> struct D; +template<typename T> struct E; +template<typename T = int> struct G; +template<typename T = int> struct H; diff --git a/test/Modules/Inputs/template-default-args/c.h b/test/Modules/Inputs/template-default-args/c.h new file mode 100644 index 0000000..2946013 --- /dev/null +++ b/test/Modules/Inputs/template-default-args/c.h @@ -0,0 +1,2 @@ +template<typename T = int> struct F; +template<typename T, typename U> struct I; diff --git a/test/Modules/Inputs/template-default-args/module.modulemap b/test/Modules/Inputs/template-default-args/module.modulemap index 6182e6b..d54dfc3 100644 --- a/test/Modules/Inputs/template-default-args/module.modulemap +++ b/test/Modules/Inputs/template-default-args/module.modulemap @@ -1 +1,5 @@ -module X { module A { header "a.h" } module B { header "b.h" } } +module X { + module A { header "a.h" } + module B { header "b.h" } + module C { header "c.h" } +} diff --git a/test/Modules/Rmodule-build.m b/test/Modules/Rmodule-build.m index e8f2935..5c27ec6 100644 --- a/test/Modules/Rmodule-build.m +++ b/test/Modules/Rmodule-build.m @@ -7,7 +7,7 @@ // RUN: echo 'module B { header "B.h" }' >> %t/module.modulemap // RUN: echo 'module C { header "C.h" }' >> %t/module.modulemap -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fsyntax-only %s -verify \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fsyntax-only %s -verify \ // RUN: -I %t -Rmodule-build @import A; // expected-remark{{building module 'A' as}} expected-remark {{finished building module 'A'}} @@ -16,19 +16,19 @@ @import B; // no diagnostic // RUN: echo ' ' >> %t/C.h -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fsyntax-only %s -I %t \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fsyntax-only %s -I %t \ // RUN: -Rmodule-build 2>&1 | FileCheck %s // RUN: echo ' ' >> %t/C.h -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fsyntax-only %s -I %t \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fsyntax-only %s -I %t \ // RUN: -Reverything 2>&1 | FileCheck %s // RUN: echo ' ' >> %t/B.h -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fsyntax-only %s -I %t \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fsyntax-only %s -I %t \ // RUN: 2>&1 | FileCheck -allow-empty -check-prefix=NO-REMARKS %s // RUN: echo ' ' >> %t/B.h -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fsyntax-only %s -I %t \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fsyntax-only %s -I %t \ // RUN: -Rmodule-build -Rno-everything 2>&1 | \ // RUN: FileCheck -allow-empty -check-prefix=NO-REMARKS %s diff --git a/test/Modules/Werror-Wsystem-headers.m b/test/Modules/Werror-Wsystem-headers.m index 4391aa0..164c5b2 100644 --- a/test/Modules/Werror-Wsystem-headers.m +++ b/test/Modules/Werror-Wsystem-headers.m @@ -3,17 +3,17 @@ // RUN: mkdir %t-saved // Initial module build -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \ // RUN: -isystem %S/Inputs/System/usr/include -fsyntax-only %s -verify // RUN: cp %t/cstd.pcm %t-saved/cstd.pcm // Even with -Werror don't rebuild a system module -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \ // RUN: -isystem %S/Inputs/System/usr/include -fsyntax-only %s -verify -Werror // RUN: diff %t/cstd.pcm %t-saved/cstd.pcm // Unless -Wsystem-headers is on -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \ // RUN: -isystem %S/Inputs/System/usr/include -fsyntax-only %s -verify \ // RUN: -Werror=unused -Wsystem-headers // RUN: not diff %t/cstd.pcm %t-saved/cstd.pcm diff --git a/test/Modules/Werror.m b/test/Modules/Werror.m index 6444ea5..4c3f3ea 100644 --- a/test/Modules/Werror.m +++ b/test/Modules/Werror.m @@ -3,37 +3,37 @@ // RUN: mkdir -p %t-saved // Initial module build (-Werror=header-guard) -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \ // RUN: -F %S/Inputs -fsyntax-only %s -verify -Wno-incomplete-umbrella \ // RUN: -Werror=header-guard // RUN: cp %t/Module.pcm %t-saved/Module.pcm // Building with looser -Werror options does not rebuild -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \ // RUN: -F %S/Inputs -fsyntax-only %s -verify -Wno-incomplete-umbrella // RUN: diff %t/Module.pcm %t-saved/Module.pcm // Make the build more restricted (-Werror) -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \ // RUN: -F %S/Inputs -fsyntax-only %s -verify -Wno-incomplete-umbrella \ // RUN: -Werror -Wno-incomplete-umbrella // RUN: not diff %t/Module.pcm %t-saved/Module.pcm // RUN: cp %t/Module.pcm %t-saved/Module.pcm // Ensure -Werror=header-guard is less strict than -Werror -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \ // RUN: -F %S/Inputs -fsyntax-only %s -verify -Wno-incomplete-umbrella \ // RUN: -Werror=header-guard -Wno-incomplete-umbrella // RUN: diff %t/Module.pcm %t-saved/Module.pcm // But -Werror=unused is not, because some of its diags are DefaultIgnore -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \ // RUN: -F %S/Inputs -fsyntax-only %s -verify -Wno-incomplete-umbrella \ // RUN: -Werror=unused // RUN: not diff %t/Module.pcm %t-saved/Module.pcm // RUN: cp %t/Module.pcm %t-saved/Module.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \ // RUN: -F %S/Inputs -fsyntax-only %s -verify -Wno-incomplete-umbrella \ // RUN: -Werror -Wno-incomplete-umbrella @@ -42,30 +42,30 @@ // RUN-DISABLED: diff %t/Module.pcm %t-saved/Module.pcm // -Wno-everything, -Werror -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \ // RUN: -F %S/Inputs -fsyntax-only %s -verify -Wno-incomplete-umbrella \ // RUN: -Wno-everything -Wall -Werror // RUN: cp %t/Module.pcm %t-saved/Module.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \ // RUN: -F %S/Inputs -fsyntax-only %s -verify -Wno-incomplete-umbrella \ // RUN: -Wall -Werror // RUN: not diff %t/Module.pcm %t-saved/Module.pcm // -pedantic, -Werror is not compatible with -Wall -Werror -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \ // RUN: -F %S/Inputs -fsyntax-only %s -verify -Wno-incomplete-umbrella \ // RUN: -Werror -pedantic // RUN: not diff %t/Module.pcm %t-saved/Module.pcm // RUN: cp %t/Module.pcm %t-saved/Module.pcm // -pedantic-errors is less strict that -pedantic, -Werror -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \ // RUN: -F %S/Inputs -fsyntax-only %s -verify -Wno-incomplete-umbrella \ // RUN: -pedantic-errors // RUN: diff %t/Module.pcm %t-saved/Module.pcm // -Wsystem-headers does not affect non-system modules -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \ // RUN: -F %S/Inputs -fsyntax-only %s -verify -Wno-incomplete-umbrella \ // RUN: -pedantic-errors -Wsystem-headers // RUN: diff %t/Module.pcm %t-saved/Module.pcm diff --git a/test/Modules/add-remove-private.m b/test/Modules/add-remove-private.m index 49e81e1..dc73a09 100644 --- a/test/Modules/add-remove-private.m +++ b/test/Modules/add-remove-private.m @@ -4,20 +4,20 @@ // RUN: cp -r %S/Inputs/AddRemovePrivate.framework %t/AddRemovePrivate.framework // Build with module.private.modulemap -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t.mcp -fdisable-module-hash -F %t %s -verify -DP +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -fdisable-module-hash -F %t %s -verify -DP // RUN: cp %t.mcp/AddRemovePrivate.pcm %t/with.pcm // Build without module.private.modulemap // RUN: rm %t/AddRemovePrivate.framework/Modules/module.private.modulemap -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t.mcp -fdisable-module-hash -F %t %s -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -fdisable-module-hash -F %t %s -verify // RUN: not diff %t.mcp/AddRemovePrivate.pcm %t/with.pcm // RUN: cp %t.mcp/AddRemovePrivate.pcm %t/without.pcm -// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t.mcp -fdisable-module-hash -F %t %s -DP 2>&1 | FileCheck %s +// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -fdisable-module-hash -F %t %s -DP 2>&1 | FileCheck %s // CHECK: no submodule named 'Private' // Build with module.private.modulemap (again) // RUN: cp %S/Inputs/AddRemovePrivate.framework/Modules/module.private.modulemap %t/AddRemovePrivate.framework/Modules/module.private.modulemap -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t.mcp -fdisable-module-hash -F %t %s -verify -DP +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -fdisable-module-hash -F %t %s -verify -DP // RUN: not diff %t.mcp/AddRemovePrivate.pcm %t/without.pcm // expected-no-diagnostics diff --git a/test/Modules/anon-namespace.cpp b/test/Modules/anon-namespace.cpp index 6c085eb..dc25c91 100644 --- a/test/Modules/anon-namespace.cpp +++ b/test/Modules/anon-namespace.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/anon-namespace -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/anon-namespace -verify %s // expected-no-diagnostics #include "b1.h" #include "c.h" diff --git a/test/Modules/attr-unavailable.m b/test/Modules/attr-unavailable.m index 0188a84..b7954ca 100644 --- a/test/Modules/attr-unavailable.m +++ b/test/Modules/attr-unavailable.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs/attr-unavailable %s -fsyntax-only -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/attr-unavailable %s -fsyntax-only -verify @import two; void f(id x) { diff --git a/test/Modules/auto-module-import.m b/test/Modules/auto-module-import.m index bf99377..de2c355 100644 --- a/test/Modules/auto-module-import.m +++ b/test/Modules/auto-module-import.m @@ -1,6 +1,6 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -F %S/Inputs %s -verify -DERRORS -// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -F %S/Inputs %s -verify +// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify -DERRORS +// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify // // Test both with and without the declarations that refer to unimported // entities. For error recovery, those cases implicitly trigger an import. diff --git a/test/Modules/autolink.m b/test/Modules/autolink.m index e650770..28b9e40 100644 --- a/test/Modules/autolink.m +++ b/test/Modules/autolink.m @@ -1,7 +1,7 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -emit-pch -fmodules-cache-path=%t -fmodules -o %t.pch -I %S/Inputs -x objective-c-header %S/Inputs/autolink-sub3.pch -// RUN: %clang_cc1 -emit-llvm -o - -fmodules-cache-path=%t -fmodules -F %S/Inputs -I %S/Inputs -include-pch %t.pch %s | FileCheck %s -// RUN: %clang_cc1 -emit-llvm -fno-autolink -o - -fmodules-cache-path=%t -fmodules -F %S/Inputs -I %S/Inputs -include-pch %t.pch %s | FileCheck --check-prefix=CHECK-AUTOLINK-DISABLED %s +// RUN: %clang_cc1 -emit-pch -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -o %t.pch -I %S/Inputs -x objective-c-header %S/Inputs/autolink-sub3.pch +// RUN: %clang_cc1 -emit-llvm -o - -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs -I %S/Inputs -include-pch %t.pch %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -fno-autolink -o - -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs -I %S/Inputs -include-pch %t.pch %s | FileCheck --check-prefix=CHECK-AUTOLINK-DISABLED %s @import autolink.sub2; diff --git a/test/Modules/build-fail-notes.m b/test/Modules/build-fail-notes.m index e273411..47bdbc7 100644 --- a/test/Modules/build-fail-notes.m +++ b/test/Modules/build-fail-notes.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: not %clang_cc1 -fmodules-cache-path=%t -fmodules -F %S/Inputs -DgetModuleVersion="epic fail" %s 2>&1 | FileCheck %s +// RUN: not %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs -DgetModuleVersion="epic fail" %s 2>&1 | FileCheck %s @import DependsOnModule; @@ -11,14 +11,14 @@ // CHECK: fatal error: could not build module 'DependsOnModule' // CHECK-NOT: error: -// RUN: not %clang_cc1 -fmodules-cache-path=%t -fmodules -F %S/Inputs %s -fdiagnostics-show-note-include-stack 2>&1 | FileCheck -check-prefix=CHECK-REDEF %s +// RUN: not %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs %s -fdiagnostics-show-note-include-stack 2>&1 | FileCheck -check-prefix=CHECK-REDEF %s extern int Module; // CHECK-REDEF: In module 'DependsOnModule' imported from // CHECK-REDEF: In module 'Module' imported from // CHECK-REDEF: Module.h:15:12: note: previous definition is here -// RUN: not %clang_cc1 -Wincomplete-umbrella -fmodules-cache-path=%t -fmodules -F %S/Inputs -DgetModuleVersion="epic fail" -serialize-diagnostic-file %t/tmp.diag %s 2>&1 +// RUN: not %clang_cc1 -Wincomplete-umbrella -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs -DgetModuleVersion="epic fail" -serialize-diagnostic-file %t/tmp.diag %s 2>&1 // 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 diff --git a/test/Modules/builtins.m b/test/Modules/builtins.m index 40b4f9c..c095f4f 100644 --- a/test/Modules/builtins.m +++ b/test/Modules/builtins.m @@ -12,5 +12,5 @@ int bar() { // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -I %S/Inputs %s -verify +// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs %s -verify // expected-no-diagnostics diff --git a/test/Modules/compiler_builtins.m b/test/Modules/compiler_builtins.m index f120bcf..bffbcc6 100644 --- a/test/Modules/compiler_builtins.m +++ b/test/Modules/compiler_builtins.m @@ -1,6 +1,6 @@ // RUN: rm -rf %t -// RUN: %clang -fsyntax-only -fmodules -fmodules-cache-path=%t -D__need_wint_t %s -I%S/Inputs/System/usr/include -Xclang -verify -// RUN: %clang -fsyntax-only -std=c99 -fmodules -fmodules-cache-path=%t -D__need_wint_t %s -I%S/Inputs/System/usr/include -Xclang -verify +// RUN: %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s -I%S/Inputs/System/usr/include -verify +// RUN: %clang_cc1 -fsyntax-only -std=c99 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s -I%S/Inputs/System/usr/include -verify // expected-no-diagnostics #ifdef __SSE__ diff --git a/test/Modules/compiler_builtins_arm.m b/test/Modules/compiler_builtins_arm.m index 5da6a12..ccfceaa 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 -fmodules-cache-path=%t -D__need_wint_t %s -verify +// 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 @import _Builtin_intrinsics.arm.neon; diff --git a/test/Modules/config_macros.m b/test/Modules/config_macros.m index b147317..5c54ba9 100644 --- a/test/Modules/config_macros.m +++ b/test/Modules/config_macros.m @@ -23,6 +23,6 @@ char *test_bar() { @import config; // expected-warning{{definition of configuration macro 'WANT_BAR' has no effect on the import of 'config'; pass '-DWANT_BAR=...' on the command line to configure the module}} // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -DWANT_FOO=1 -emit-module -fmodule-name=config %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs -DWANT_FOO=1 %s -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -DWANT_FOO=1 -emit-module -fmodule-name=config %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -DWANT_FOO=1 %s -verify diff --git a/test/Modules/conflicts.m b/test/Modules/conflicts.m index 2388e6f..d619721 100644 --- a/test/Modules/conflicts.m +++ b/test/Modules/conflicts.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -I %S/Inputs/Conflicts %s -verify +// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/Conflicts %s -verify @import Conflicts; diff --git a/test/Modules/crashes.m b/test/Modules/crashes.m index edefd37..c785bd1 100644 --- a/test/Modules/crashes.m +++ b/test/Modules/crashes.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t.mcp -// RUN: %clang_cc1 -fmodules-cache-path=%t.mcp -fmodules -F %S/Inputs -fobjc-arc %s -verify +// RUN: %clang_cc1 -fmodules-cache-path=%t.mcp -fmodules -fimplicit-module-maps -F %S/Inputs -fobjc-arc %s -verify @import Module; diff --git a/test/Modules/cstd.m b/test/Modules/cstd.m index 200779a..7df727d 100644 --- a/test/Modules/cstd.m +++ b/test/Modules/cstd.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fsyntax-only -isystem %S/Inputs/System/usr/include -ffreestanding -fmodules -fmodules-cache-path=%t -D__need_wint_t -Werror=implicit-function-declaration %s +// RUN: %clang_cc1 -fsyntax-only -isystem %S/Inputs/System/usr/include -ffreestanding -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -D__need_wint_t -Werror=implicit-function-declaration %s @import uses_other_constants; const double other_value = DBL_MAX; diff --git a/test/Modules/cxx-decls.cpp b/test/Modules/cxx-decls.cpp index 4064040..2e60607 100644 --- a/test/Modules/cxx-decls.cpp +++ b/test/Modules/cxx-decls.cpp @@ -1,6 +1,6 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 -// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -ast-dump -ast-dump-filter merge -std=c++11 | FileCheck %s +// RUN: %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 +// RUN: %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -ast-dump -ast-dump-filter merge -std=c++11 | FileCheck %s // expected-no-diagnostics diff --git a/test/Modules/cxx-dtor.cpp b/test/Modules/cxx-dtor.cpp index ead67ec..63427ee 100644 --- a/test/Modules/cxx-dtor.cpp +++ b/test/Modules/cxx-dtor.cpp @@ -1,3 +1,3 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 -fmodules-cache-path=%t -I %S/Inputs/cxx-dtor -emit-llvm-only %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x c++ -std=c++11 -fmodules-cache-path=%t -I %S/Inputs/cxx-dtor -emit-llvm-only %s #include "b.h" diff --git a/test/Modules/cxx-inline-namespace.cpp b/test/Modules/cxx-inline-namespace.cpp index f67d43b..36b58ee 100644 --- a/test/Modules/cxx-inline-namespace.cpp +++ b/test/Modules/cxx-inline-namespace.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 +// RUN: %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 @import cxx_inline_namespace; @import cxx_inline_namespace_b; diff --git a/test/Modules/cxx-irgen.cpp b/test/Modules/cxx-irgen.cpp index 13902bf..37de23f 100644 --- a/test/Modules/cxx-irgen.cpp +++ b/test/Modules/cxx-irgen.cpp @@ -1,6 +1,6 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c++ -std=c++11 -fmodules-cache-path=%t -I %S/Inputs -triple %itanium_abi_triple -disable-llvm-optzns -emit-llvm -o - %s | FileCheck %s -// RUN: %clang_cc1 -fmodules -x objective-c++ -std=c++11 -fmodules-cache-path=%t -I %S/Inputs -triple %itanium_abi_triple -disable-llvm-optzns -emit-llvm -g -o - %s | FileCheck %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c++ -std=c++11 -fmodules-cache-path=%t -I %S/Inputs -triple %itanium_abi_triple -disable-llvm-optzns -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c++ -std=c++11 -fmodules-cache-path=%t -I %S/Inputs -triple %itanium_abi_triple -disable-llvm-optzns -emit-llvm -g -o - %s | FileCheck %s // FIXME: When we have a syntax for modules in C++, use that. @import cxx_irgen_top; diff --git a/test/Modules/cxx-linkage-cache.cpp b/test/Modules/cxx-linkage-cache.cpp index 296cc80..3ce55b4 100644 --- a/test/Modules/cxx-linkage-cache.cpp +++ b/test/Modules/cxx-linkage-cache.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 +// RUN: %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 @import cxx_linkage_cache; diff --git a/test/Modules/cxx-lookup.cpp b/test/Modules/cxx-lookup.cpp index bd019c7..f3e2720 100644 --- a/test/Modules/cxx-lookup.cpp +++ b/test/Modules/cxx-lookup.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t %s -I%S/Inputs/cxx-lookup -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s -I%S/Inputs/cxx-lookup -verify // expected-no-diagnostics namespace llvm {} #include "c2.h" diff --git a/test/Modules/cxx-many-overloads.cpp b/test/Modules/cxx-many-overloads.cpp index 205a79c..445245f 100644 --- a/test/Modules/cxx-many-overloads.cpp +++ b/test/Modules/cxx-many-overloads.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify +// RUN: %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify // expected-no-diagnostics @import cxx_many_overloads; diff --git a/test/Modules/cxx-templates.cpp b/test/Modules/cxx-templates.cpp index 00fc38b..d0f5a14 100644 --- a/test/Modules/cxx-templates.cpp +++ b/test/Modules/cxx-templates.cpp @@ -1,9 +1,9 @@ // RUN: rm -rf %t -// RUN: not %clang_cc1 -x objective-c++ -fmodules -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -std=c++11 -ast-dump-lookups | FileCheck %s --check-prefix=CHECK-GLOBAL -// RUN: not %clang_cc1 -x objective-c++ -fmodules -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -std=c++11 -ast-dump-lookups -ast-dump-filter N | FileCheck %s --check-prefix=CHECK-NAMESPACE-N -// RUN: not %clang_cc1 -x objective-c++ -fmodules -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -std=c++11 -ast-dump -ast-dump-filter SomeTemplate | FileCheck %s --check-prefix=CHECK-DUMP -// RUN: %clang_cc1 -x objective-c++ -fmodules -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 -// RUN: %clang_cc1 -x objective-c++ -fmodules -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 -DEARLY_IMPORT +// RUN: not %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -std=c++11 -ast-dump-lookups | FileCheck %s --check-prefix=CHECK-GLOBAL +// RUN: not %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -std=c++11 -ast-dump-lookups -ast-dump-filter N | FileCheck %s --check-prefix=CHECK-NAMESPACE-N +// RUN: not %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -std=c++11 -ast-dump -ast-dump-filter SomeTemplate | FileCheck %s --check-prefix=CHECK-DUMP +// RUN: %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 +// RUN: %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 -DEARLY_IMPORT #ifdef EARLY_IMPORT #include "cxx-templates-textual.h" diff --git a/test/Modules/cycles.c b/test/Modules/cycles.c index 47728d8..81495b5 100644 --- a/test/Modules/cycles.c +++ b/test/Modules/cycles.c @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: not %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -F %S/Inputs %s 2>&1 | FileCheck %s +// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -F %S/Inputs %s 2>&1 | FileCheck %s // FIXME: When we have a syntax for modules in C, use that. @import MutuallyRecursive1; diff --git a/test/Modules/declare-use-compatible.cpp b/test/Modules/declare-use-compatible.cpp index 4c3d79b..a2e7f01 100644 --- a/test/Modules/declare-use-compatible.cpp +++ b/test/Modules/declare-use-compatible.cpp @@ -1,33 +1,33 @@ // Used module not built with -decluse. // RUN: rm -rf %t -// RUN: %clang_cc1 -x c++ -fmodules -fmodule-name=XB -emit-module \ +// RUN: %clang_cc1 -x c++ -fmodules -fimplicit-module-maps -fmodule-name=XB -emit-module \ // RUN: -I %S/Inputs/declare-use %S/Inputs/declare-use/module.map -o %t/b.pcm -// RUN: %clang_cc1 -x c++ -fmodules -fmodules-cache-path=%t \ +// RUN: %clang_cc1 -x c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ // RUN: -fmodules-decluse \ // RUN: -fmodule-file=%t/b.pcm -fmodule-name=XE -I %S/Inputs/declare-use %s // // Main module not built with -decluse. // RUN: rm -rf %t -// RUN: %clang_cc1 -x c++ -fmodules -fmodule-name=XB -emit-module \ +// RUN: %clang_cc1 -x c++ -fmodules -fimplicit-module-maps -fmodule-name=XB -emit-module \ // RUN: -fmodules-decluse \ // RUN: -I %S/Inputs/declare-use %S/Inputs/declare-use/module.map -o %t/b.pcm -// RUN: %clang_cc1 -x c++ -fmodules -fmodules-cache-path=%t \ +// RUN: %clang_cc1 -x c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ // RUN: -fmodule-file=%t/b.pcm -fmodule-name=XE -I %S/Inputs/declare-use %s // // Used module not built with -decluse. // RUN: rm -rf %t -// RUN: %clang_cc1 -x c++ -fmodules -fmodule-name=XB -emit-module \ +// RUN: %clang_cc1 -x c++ -fmodules -fimplicit-module-maps -fmodule-name=XB -emit-module \ // RUN: -I %S/Inputs/declare-use %S/Inputs/declare-use/module.map -o %t/b.pcm -// RUN: %clang_cc1 -x c++ -fmodules -fmodules-cache-path=%t \ +// RUN: %clang_cc1 -x c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ // RUN: -fmodules-strict-decluse \ // RUN: -fmodule-file=%t/b.pcm -fmodule-name=XE -I %S/Inputs/declare-use %s // // Main module not built with -decluse. // RUN: rm -rf %t -// RUN: %clang_cc1 -x c++ -fmodules -fmodule-name=XB -emit-module \ +// RUN: %clang_cc1 -x c++ -fmodules -fimplicit-module-maps -fmodule-name=XB -emit-module \ // RUN: -fmodules-strict-decluse \ // RUN: -I %S/Inputs/declare-use %S/Inputs/declare-use/module.map -o %t/b.pcm -// RUN: %clang_cc1 -x c++ -fmodules -fmodules-cache-path=%t \ +// RUN: %clang_cc1 -x c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ // RUN: -fmodule-file=%t/b.pcm -fmodule-name=XE -I %S/Inputs/declare-use %s #include "b.h" diff --git a/test/Modules/declare-use1.cpp b/test/Modules/declare-use1.cpp index adba595..492f97a 100644 --- a/test/Modules/declare-use1.cpp +++ b/test/Modules/declare-use1.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodule-maps -fmodules-cache-path=%t -fmodules-decluse -fmodule-name=XG -I %S/Inputs/declare-use %s -verify +// RUN: %clang_cc1 -fimplicit-module-maps -fmodules-cache-path=%t -fmodules-decluse -fmodule-name=XG -I %S/Inputs/declare-use %s -verify #include "g.h" #include "e.h" diff --git a/test/Modules/declare-use2.cpp b/test/Modules/declare-use2.cpp index 4535289..12689e9 100644 --- a/test/Modules/declare-use2.cpp +++ b/test/Modules/declare-use2.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodule-maps -fmodules-cache-path=%t -fmodules-decluse -fmodule-name=XH -I %S/Inputs/declare-use %s -verify +// RUN: %clang_cc1 -fimplicit-module-maps -fmodules-cache-path=%t -fmodules-decluse -fmodule-name=XH -I %S/Inputs/declare-use %s -verify #include "h.h" #include "e.h" diff --git a/test/Modules/declare-use3.cpp b/test/Modules/declare-use3.cpp index 8b0bbfa..baa6c77 100644 --- a/test/Modules/declare-use3.cpp +++ b/test/Modules/declare-use3.cpp @@ -1,4 +1,4 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -include "g.h" -include "e.h" -include "f.h" -include "i.h" -fmodule-maps -fmodules-cache-path=%t -fmodules-decluse -fmodule-name=XG -I %S/Inputs/declare-use %s -verify +// RUN: %clang_cc1 -include "g.h" -include "e.h" -include "f.h" -include "i.h" -fimplicit-module-maps -fmodules-cache-path=%t -fmodules-decluse -fmodule-name=XG -I %S/Inputs/declare-use %s -verify // expected-error {{module XG does not depend on a module exporting 'f.h'}} const int g2 = g1 + e + f + aux_i; diff --git a/test/Modules/declare-use4.cpp b/test/Modules/declare-use4.cpp index 1d34646..621422f 100644 --- a/test/Modules/declare-use4.cpp +++ b/test/Modules/declare-use4.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodule-maps -fmodules-cache-path=%t -fmodules-decluse -fmodule-name=XG -I %S/Inputs/declare-use %s -verify +// RUN: %clang_cc1 -fimplicit-module-maps -fmodules-cache-path=%t -fmodules-decluse -fmodule-name=XG -I %S/Inputs/declare-use %s -verify #define ALLOWED_INC "b.h" diff --git a/test/Modules/declare-use5.cpp b/test/Modules/declare-use5.cpp index b34be0f..db52f69 100644 --- a/test/Modules/declare-use5.cpp +++ b/test/Modules/declare-use5.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodule-maps -fmodules-cache-path=%t -fmodules-decluse -fmodule-name=XN -I %S/Inputs/declare-use %s -verify +// RUN: %clang_cc1 -fimplicit-module-maps -fmodules-cache-path=%t -fmodules-decluse -fmodule-name=XN -I %S/Inputs/declare-use %s -verify #include "sub.h" diff --git a/test/Modules/decldef.m b/test/Modules/decldef.m index efd2d7c..420c677 100644 --- a/test/Modules/decldef.m +++ b/test/Modules/decldef.m @@ -1,6 +1,6 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_EARLY -// RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_EARLY +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify // expected-note@Inputs/def.h:5 {{previous}} diff --git a/test/Modules/decldef.mm b/test/Modules/decldef.mm index 2e2bd8a..ab271fc 100644 --- a/test/Modules/decldef.mm +++ b/test/Modules/decldef.mm @@ -1,8 +1,8 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_1 -DUSE_2 -DUSE_3 -DUSE_4 -// RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_2 -DUSE_3 -DUSE_4 -// RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_3 -DUSE_4 -// RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_4 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_1 -DUSE_2 -DUSE_3 -DUSE_4 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_2 -DUSE_3 -DUSE_4 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_3 -DUSE_4 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_4 // expected-note@Inputs/def.h:5 0-1{{previous}} // expected-note@Inputs/def.h:16 0-1{{previous}} diff --git a/test/Modules/deferred-lookup.cpp b/test/Modules/deferred-lookup.cpp index aaac389..ac9464a 100644 --- a/test/Modules/deferred-lookup.cpp +++ b/test/Modules/deferred-lookup.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/deferred-lookup -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/deferred-lookup -verify %s // expected-no-diagnostics namespace N { int f(int); } diff --git a/test/Modules/dependency-dump-dependent-module.m b/test/Modules/dependency-dump-dependent-module.m index 3b04435..df7f532 100644 --- a/test/Modules/dependency-dump-dependent-module.m +++ b/test/Modules/dependency-dump-dependent-module.m @@ -2,7 +2,7 @@ // files for both. // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache -module-dependency-dir %t/vfs -F %S/Inputs -I %S/Inputs -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache -module-dependency-dir %t/vfs -F %S/Inputs -I %S/Inputs -verify %s // expected-no-diagnostics // RUN: FileCheck %s -check-prefix=VFS < %t/vfs/vfs.yaml diff --git a/test/Modules/dependency-dump.m b/test/Modules/dependency-dump.m index 630af49..f3a4875 100644 --- a/test/Modules/dependency-dump.m +++ b/test/Modules/dependency-dump.m @@ -2,7 +2,7 @@ // for the same. // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache -module-dependency-dir %t/vfs -F %S/Inputs -I %S/Inputs -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache -module-dependency-dir %t/vfs -F %S/Inputs -I %S/Inputs -verify %s // expected-no-diagnostics // RUN: FileCheck %s -check-prefix=VFS -input-file %t/vfs/vfs.yaml diff --git a/test/Modules/dependency-gen-inferred-map.m b/test/Modules/dependency-gen-inferred-map.m index 11cc872..cebfeea 100644 --- a/test/Modules/dependency-gen-inferred-map.m +++ b/test/Modules/dependency-gen-inferred-map.m @@ -1,7 +1,7 @@ // Test that the virtual file "__inferred_module.map" doesn't show up as dependency. // 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 -fmodules-cache-path=%t-mcp %s +// 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 // CHECK-NOT: __inferred_module diff --git a/test/Modules/dependency-gen-pch.m b/test/Modules/dependency-gen-pch.m index 65e22d4..697b429 100644 --- a/test/Modules/dependency-gen-pch.m +++ b/test/Modules/dependency-gen-pch.m @@ -1,7 +1,7 @@ // RUN: rm -rf %t-mcp // RUN: mkdir -p %t-mcp -// 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 -fdisable-module-hash -fmodules-cache-path=%t-mcp -emit-pch -o %t.pch %s +// 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 // CHECK: dependency-gen-pch.m.o // CHECK-NEXT: dependency-gen-pch.m diff --git a/test/Modules/dependency-gen.m b/test/Modules/dependency-gen.m index d3d66bf..60a7192 100644 --- a/test/Modules/dependency-gen.m +++ b/test/Modules/dependency-gen.m @@ -1,7 +1,7 @@ // RUN: rm -rf %t-mcp // RUN: mkdir -p %t-mcp -// RUN: %clang_cc1 -x objective-c -isystem %S/Inputs/System/usr/include -dependency-file %t.d.1 -MT %s.o -I %S/Inputs -fsyntax-only -fmodules -fmodules-cache-path=%t-mcp %s +// RUN: %clang_cc1 -x objective-c -isystem %S/Inputs/System/usr/include -dependency-file %t.d.1 -MT %s.o -I %S/Inputs -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-mcp %s // RUN: FileCheck %s < %t.d.1 // CHECK: dependency-gen.m // CHECK: Inputs{{.}}diamond_top.h @@ -10,7 +10,7 @@ // CHECK-NOT: stdint.h -// RUN: %clang_cc1 -x objective-c -isystem %S/Inputs/System/usr/include -dependency-file %t.d.2 -MT %s.o -I %S/Inputs -sys-header-deps -fsyntax-only -fmodules -fmodules-cache-path=%t-mcp %s +// RUN: %clang_cc1 -x objective-c -isystem %S/Inputs/System/usr/include -dependency-file %t.d.2 -MT %s.o -I %S/Inputs -sys-header-deps -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-mcp %s // RUN: FileCheck %s -check-prefix=CHECK-SYS < %t.d.2 // CHECK-SYS: dependency-gen.m // CHECK-SYS: Inputs{{.}}diamond_top.h diff --git a/test/Modules/dependency-gen.modulemap b/test/Modules/dependency-gen.modulemap index 6aa2e00..a71bfe9 100644 --- a/test/Modules/dependency-gen.modulemap +++ b/test/Modules/dependency-gen.modulemap @@ -1,7 +1,7 @@ // RUN: cd %S // RUN: rm -f %t.cpm %t-base.pcm %t-base.d %t.d -// RUN: %clang_cc1 -I. -x c++ -fmodule-maps -fmodule-name=test-base -fno-modules-implicit-maps -fmodules -emit-module -fno-validate-pch -fmodules-strict-decluse Inputs/dependency-gen-base.modulemap -dependency-file %t-base.d -MT %t-base.pcm -o %t-base.pcm -fmodule-map-file-home-is-cwd -// RUN: %clang_cc1 -I. -x c++ -fmodule-maps -fmodule-name=test -fno-modules-implicit-maps -fmodules -emit-module -fno-validate-pch -fmodules-strict-decluse -fmodule-file=%t-base.pcm %s -dependency-file %t.d -MT %t.pcm -o %t.pcm -fmodule-map-file-home-is-cwd +// RUN: %clang_cc1 -I. -x c++ -fmodule-name=test-base -fmodules -emit-module -fno-validate-pch -fmodules-strict-decluse Inputs/dependency-gen-base.modulemap -dependency-file %t-base.d -MT %t-base.pcm -o %t-base.pcm -fmodule-map-file-home-is-cwd +// RUN: %clang_cc1 -I. -x c++ -fmodule-name=test -fmodules -emit-module -fno-validate-pch -fmodules-strict-decluse -fmodule-file=%t-base.pcm %s -dependency-file %t.d -MT %t.pcm -o %t.pcm -fmodule-map-file-home-is-cwd // RUN: FileCheck %s < %t.d module "test" { export * diff --git a/test/Modules/diag-pragma.c b/test/Modules/diag-pragma.c index 89435c1..63be4bf 100644 --- a/test/Modules/diag-pragma.c +++ b/test/Modules/diag-pragma.c @@ -1,6 +1,6 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diag_pragma %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -verify -fmodules-cache-path=%t -I %S/Inputs %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diag_pragma %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -verify -fmodules-cache-path=%t -I %S/Inputs %s // FIXME: When we have a syntax for modules in C, use that. @import diag_pragma; diff --git a/test/Modules/diamond-pch.c b/test/Modules/diamond-pch.c index f66ad87..41cfd9c 100644 --- a/test/Modules/diamond-pch.c +++ b/test/Modules/diamond-pch.c @@ -1,10 +1,10 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_top %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_left %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_right %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_bottom %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -emit-pch -fmodules-cache-path=%t -I %S/Inputs -o %t.pch %S/Inputs/diamond.h -// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -include-pch %t.pch %s -I %S/Inputs -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_top %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_left %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_right %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_bottom %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -emit-pch -fmodules-cache-path=%t -I %S/Inputs -o %t.pch %S/Inputs/diamond.h +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -include-pch %t.pch %s -I %S/Inputs -verify // FIXME: When we have a syntax for modules in C, use that. void test_diamond(int i, float f, double d, char c) { diff --git a/test/Modules/diamond.c b/test/Modules/diamond.c index 8b82408..c2e009f 100644 --- a/test/Modules/diamond.c +++ b/test/Modules/diamond.c @@ -1,9 +1,9 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_top %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_left %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_right %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_bottom %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -I %S/Inputs %s -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_top %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_left %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_right %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_bottom %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -I %S/Inputs %s -verify // FIXME: When we have a syntax for modules in C, use that. @import diamond_bottom; diff --git a/test/Modules/direct-module-import.m b/test/Modules/direct-module-import.m index 00c13fa..3216eb9 100644 --- a/test/Modules/direct-module-import.m +++ b/test/Modules/direct-module-import.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -F %S/Inputs -include Module/Module.h %s -emit-llvm -o - | FileCheck %s +// 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 const char* getVer(void) { diff --git a/test/Modules/driver.c b/test/Modules/driver.c index 79d1bbe..34fc163 100644 --- a/test/Modules/driver.c +++ b/test/Modules/driver.c @@ -1,5 +1,5 @@ -// RUN: %clang -fmodules %s -### 2>&1 | FileCheck -check-prefix CHECK-NO_MODULE_CACHE %s -// RUN: %clang -fmodules -fmodules-cache-path=blarg %s -### 2>&1 | FileCheck -check-prefix CHECK-WITH_MODULE_CACHE %s +// RUN: %clang -fmodules -fimplicit-module-maps %s -### 2>&1 | FileCheck -check-prefix CHECK-NO_MODULE_CACHE %s +// RUN: %clang -fmodules -fimplicit-module-maps -fmodules-cache-path=blarg %s -### 2>&1 | FileCheck -check-prefix CHECK-WITH_MODULE_CACHE %s // CHECK-NO_MODULE_CACHE: {{clang.*"-fmodules-cache-path=.*ModuleCache"}} diff --git a/test/Modules/empty.modulemap b/test/Modules/empty.modulemap index ef1d4a8..6350e2f 100644 --- a/test/Modules/empty.modulemap +++ b/test/Modules/empty.modulemap @@ -1,12 +1,12 @@ // RUN: rm -rf %t // // RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -emit-module -fmodule-name=empty -o %t/base.pcm \ // RUN: %s // // RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -emit-module -fmodule-name=empty -o %t/check.pcm \ // RUN: %s // diff --git a/test/Modules/epic-fail.m b/test/Modules/epic-fail.m index 7ce9571..b368cea 100644 --- a/test/Modules/epic-fail.m +++ b/test/Modules/epic-fail.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: not %clang_cc1 -fmodules-cache-path=%t -fmodules -F %S/Inputs -DgetModuleVersion="epic fail" %s 2>&1 | FileCheck %s +// RUN: not %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs -DgetModuleVersion="epic fail" %s 2>&1 | FileCheck %s @import Module; @import DependsOnModule; diff --git a/test/Modules/exclude-header.c b/test/Modules/exclude-header.c index 4134c82..b3e6d8d 100644 --- a/test/Modules/exclude-header.c +++ b/test/Modules/exclude-header.c @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c -fmodules -fmodules-cache-path=%t -I %S/Inputs/exclude-header %s -verify +// RUN: %clang_cc1 -x objective-c -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/exclude-header %s -verify @import x; diff --git a/test/Modules/explicit-build-relpath.cpp b/test/Modules/explicit-build-relpath.cpp index f165566..708c9fd 100644 --- a/test/Modules/explicit-build-relpath.cpp +++ b/test/Modules/explicit-build-relpath.cpp @@ -4,38 +4,38 @@ // ---------------------- // Build modules A and B. -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -fmodule-name=a -emit-module %S/Inputs/explicit-build/module.modulemap -o a.pcm // -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -fmodule-file=a.pcm \ // RUN: -fmodule-name=b -emit-module %S/Inputs/explicit-build/module.modulemap -o b-rel.pcm // -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -fmodule-file=%t/a.pcm \ // RUN: -fmodule-name=b -emit-module %S/Inputs/explicit-build/module.modulemap -o b-abs.pcm // ------------------------------------------ // Mix and match relative and absolute paths. -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -I%S/Inputs/explicit-build \ // RUN: -fmodule-file=%t/a.pcm \ // RUN: -fmodule-file=a.pcm \ // RUN: -verify %s // -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -I%S/Inputs/explicit-build \ // RUN: -fmodule-file=%t/a.pcm \ // RUN: -fmodule-file=b-rel.pcm \ // RUN: -verify %s // -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -I%S/Inputs/explicit-build \ // RUN: -fmodule-file=a.pcm \ // RUN: -fmodule-file=b-abs.pcm \ // RUN: -verify %s // -// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -I%S/Inputs/explicit-build \ // RUN: -fmodule-file=b-rel.pcm \ // RUN: -fmodule-file=b-abs.pcm \ diff --git a/test/Modules/explicit-build.cpp b/test/Modules/explicit-build.cpp index 6fe9f7e..01aa5dc 100644 --- a/test/Modules/explicit-build.cpp +++ b/test/Modules/explicit-build.cpp @@ -2,16 +2,16 @@ // ------------------------------- // Build chained modules A, B, and C -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -fmodule-name=a -emit-module %S/Inputs/explicit-build/module.modulemap -o %t/a.pcm \ // RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-IMPLICIT-BUILD %s --allow-empty // -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -fmodule-file=%t/a.pcm \ // RUN: -fmodule-name=b -emit-module %S/Inputs/explicit-build/module.modulemap -o %t/b.pcm \ // RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-IMPLICIT-BUILD %s --allow-empty // -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -fmodule-file=%t/b.pcm \ // RUN: -fmodule-name=c -emit-module %S/Inputs/explicit-build/module.modulemap -o %t/c.pcm \ // RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-IMPLICIT-BUILD %s --allow-empty @@ -20,7 +20,7 @@ // ------------------------------- // Build B with an implicit build of A -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -fmodule-name=b -emit-module %S/Inputs/explicit-build/module.modulemap -o %t/b-not-a.pcm \ // RUN: 2>&1 | FileCheck --check-prefix=CHECK-B-NO-A %s // @@ -29,36 +29,36 @@ // ------------------------------- // Check that we can use the explicitly-built A, B, and C modules. -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -I%S/Inputs/explicit-build \ // RUN: -fmodule-file=%t/a.pcm \ // RUN: -verify %s -DHAVE_A // -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -I%S/Inputs/explicit-build \ // RUN: -fmodule-map-file=%S/Inputs/explicit-build/module.modulemap \ // RUN: -fmodule-file=%t/a.pcm \ // RUN: -verify %s -DHAVE_A // -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -I%S/Inputs/explicit-build \ // RUN: -fmodule-file=%t/b.pcm \ // RUN: -verify %s -DHAVE_A -DHAVE_B // -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -I%S/Inputs/explicit-build \ // RUN: -fmodule-file=%t/a.pcm \ // RUN: -fmodule-file=%t/b.pcm \ // RUN: -verify %s -DHAVE_A -DHAVE_B // -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -I%S/Inputs/explicit-build \ // RUN: -fmodule-file=%t/a.pcm \ // RUN: -fmodule-file=%t/b.pcm \ // RUN: -fmodule-file=%t/c.pcm \ // RUN: -verify %s -DHAVE_A -DHAVE_B -DHAVE_C // -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -I%S/Inputs/explicit-build \ // RUN: -fmodule-file=%t/a.pcm \ // RUN: -fmodule-file=%t/c.pcm \ @@ -67,12 +67,12 @@ // ------------------------------- // Check that -fmodule-file= in a module build makes the file transitively // available even if it's not used. -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fno-implicit-modules -Rmodule-build -fno-modules-error-recovery \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fno-implicit-modules -Rmodule-build -fno-modules-error-recovery \ // RUN: -fmodule-file=%t/b.pcm \ // RUN: -fmodule-name=d -emit-module %S/Inputs/explicit-build/module.modulemap -o %t/d.pcm \ // RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-IMPLICIT-BUILD %s --allow-empty // -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fno-implicit-modules -Rmodule-build -fno-modules-error-recovery \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fno-implicit-modules -Rmodule-build -fno-modules-error-recovery \ // RUN: -I%S/Inputs/explicit-build \ // RUN: -fmodule-file=%t/d.pcm \ // RUN: -verify %s -DHAVE_A -DHAVE_B @@ -104,35 +104,35 @@ // ------------------------------- // Check that we can use a mixture of implicit and explicit modules. -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -I%S/Inputs/explicit-build \ // RUN: -fmodule-file=%t/b-not-a.pcm \ // RUN: -verify %s -DHAVE_A -DHAVE_B // ------------------------------- // Try to use two different flavors of the 'a' module. -// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -fmodule-file=%t/a.pcm \ // RUN: -fmodule-file=%t/b-not-a.pcm \ // RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-MULTIPLE-AS %s // -// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -fmodule-file=%t/a.pcm \ // RUN: -fmodule-file=%t/b-not-a.pcm \ // RUN: -fmodule-map-file=%S/Inputs/explicit-build/module.modulemap \ // RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-MULTIPLE-AS %s // -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -fmodule-name=a -emit-module %S/Inputs/explicit-build/module.modulemap -o %t/a-alt.pcm \ // RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-IMPLICIT-BUILD %s --allow-empty // -// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -fmodule-file=%t/a.pcm \ // RUN: -fmodule-file=%t/a-alt.pcm \ // RUN: -fmodule-map-file=%S/Inputs/explicit-build/module.modulemap \ // RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-MULTIPLE-AS %s // -// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -fmodule-file=%t/a-alt.pcm \ // RUN: -fmodule-file=%t/a.pcm \ // RUN: -fmodule-map-file=%S/Inputs/explicit-build/module.modulemap \ @@ -142,11 +142,11 @@ // ------------------------------- // Try to import a PCH with -fmodule-file= -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -fmodule-name=a -emit-pch %S/Inputs/explicit-build/a.h -o %t/a.pch \ // RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-IMPLICIT-BUILD %s --allow-empty // -// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -fmodule-file=%t/a.pch \ // RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-A-AS-PCH %s // @@ -157,20 +157,20 @@ // // RUN: touch %t/not.pcm // -// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -fmodule-file=%t/not.pcm \ // RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-BAD-FILE %s // // CHECK-BAD-FILE: fatal error: file '{{.*}}not.pcm' is not a valid precompiled module file -// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -fmodule-file=%t/nonexistent.pcm \ // RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-NO-FILE %s // // CHECK-NO-FILE: fatal error: module file '{{.*}}nonexistent.pcm' not found // RUN: mv %t/a.pcm %t/a-tmp.pcm -// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -I%S/Inputs/explicit-build \ // RUN: -fmodule-file=%t/c.pcm \ // RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-NO-FILE-INDIRECT %s @@ -184,7 +184,7 @@ // Check that we don't get upset if B's timestamp is newer than C's. // RUN: touch %t/b.pcm // -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -I%S/Inputs/explicit-build \ // RUN: -fmodule-file=%t/c.pcm \ // RUN: -verify %s -DHAVE_A -DHAVE_B -DHAVE_C @@ -193,7 +193,7 @@ // // RUN: cp %t/b-not-a.pcm %t/b.pcm // -// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ +// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \ // RUN: -I%S/Inputs/explicit-build \ // RUN: -fmodule-file=%t/c.pcm \ // RUN: %s -DHAVE_A -DHAVE_B -DHAVE_C 2>&1 | FileCheck --check-prefix=CHECK-MISMATCHED-B %s diff --git a/test/Modules/exponential-paths.cpp b/test/Modules/exponential-paths.cpp index 34ab420..b564193 100644 --- a/test/Modules/exponential-paths.cpp +++ b/test/Modules/exponential-paths.cpp @@ -137,51 +137,51 @@ // // Explicitly build all the modules. // -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=a0 -x c++ -emit-module %t/module.modulemap -o %t/a0.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=b0 -x c++ -emit-module %t/module.modulemap -o %t/b0.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=a1 -x c++ -emit-module %t/module.modulemap -o %t/a1.pcm -fmodule-file=%t/a0.pcm -fmodule-file=%t/b0.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=b1 -x c++ -emit-module %t/module.modulemap -o %t/b1.pcm -fmodule-file=%t/a0.pcm -fmodule-file=%t/b0.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=a2 -x c++ -emit-module %t/module.modulemap -o %t/a2.pcm -fmodule-file=%t/a1.pcm -fmodule-file=%t/b1.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=b2 -x c++ -emit-module %t/module.modulemap -o %t/b2.pcm -fmodule-file=%t/a1.pcm -fmodule-file=%t/b1.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=a3 -x c++ -emit-module %t/module.modulemap -o %t/a3.pcm -fmodule-file=%t/a2.pcm -fmodule-file=%t/b2.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=b3 -x c++ -emit-module %t/module.modulemap -o %t/b3.pcm -fmodule-file=%t/a2.pcm -fmodule-file=%t/b2.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=a4 -x c++ -emit-module %t/module.modulemap -o %t/a4.pcm -fmodule-file=%t/a3.pcm -fmodule-file=%t/b3.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=b4 -x c++ -emit-module %t/module.modulemap -o %t/b4.pcm -fmodule-file=%t/a3.pcm -fmodule-file=%t/b3.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=a5 -x c++ -emit-module %t/module.modulemap -o %t/a5.pcm -fmodule-file=%t/a4.pcm -fmodule-file=%t/b4.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=b5 -x c++ -emit-module %t/module.modulemap -o %t/b5.pcm -fmodule-file=%t/a4.pcm -fmodule-file=%t/b4.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=a6 -x c++ -emit-module %t/module.modulemap -o %t/a6.pcm -fmodule-file=%t/a5.pcm -fmodule-file=%t/b5.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=b6 -x c++ -emit-module %t/module.modulemap -o %t/b6.pcm -fmodule-file=%t/a5.pcm -fmodule-file=%t/b5.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=a7 -x c++ -emit-module %t/module.modulemap -o %t/a7.pcm -fmodule-file=%t/a6.pcm -fmodule-file=%t/b6.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=b7 -x c++ -emit-module %t/module.modulemap -o %t/b7.pcm -fmodule-file=%t/a6.pcm -fmodule-file=%t/b6.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=a8 -x c++ -emit-module %t/module.modulemap -o %t/a8.pcm -fmodule-file=%t/a7.pcm -fmodule-file=%t/b7.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=b8 -x c++ -emit-module %t/module.modulemap -o %t/b8.pcm -fmodule-file=%t/a7.pcm -fmodule-file=%t/b7.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=a9 -x c++ -emit-module %t/module.modulemap -o %t/a9.pcm -fmodule-file=%t/a8.pcm -fmodule-file=%t/b8.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=b9 -x c++ -emit-module %t/module.modulemap -o %t/b9.pcm -fmodule-file=%t/a8.pcm -fmodule-file=%t/b8.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=a10 -x c++ -emit-module %t/module.modulemap -o %t/a10.pcm -fmodule-file=%t/a9.pcm -fmodule-file=%t/b9.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=b10 -x c++ -emit-module %t/module.modulemap -o %t/b10.pcm -fmodule-file=%t/a9.pcm -fmodule-file=%t/b9.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=a11 -x c++ -emit-module %t/module.modulemap -o %t/a11.pcm -fmodule-file=%t/a10.pcm -fmodule-file=%t/b10.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=b11 -x c++ -emit-module %t/module.modulemap -o %t/b11.pcm -fmodule-file=%t/a10.pcm -fmodule-file=%t/b10.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=a12 -x c++ -emit-module %t/module.modulemap -o %t/a12.pcm -fmodule-file=%t/a11.pcm -fmodule-file=%t/b11.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=b12 -x c++ -emit-module %t/module.modulemap -o %t/b12.pcm -fmodule-file=%t/a11.pcm -fmodule-file=%t/b11.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=a13 -x c++ -emit-module %t/module.modulemap -o %t/a13.pcm -fmodule-file=%t/a12.pcm -fmodule-file=%t/b12.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=b13 -x c++ -emit-module %t/module.modulemap -o %t/b13.pcm -fmodule-file=%t/a12.pcm -fmodule-file=%t/b12.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=a14 -x c++ -emit-module %t/module.modulemap -o %t/a14.pcm -fmodule-file=%t/a13.pcm -fmodule-file=%t/b13.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=b14 -x c++ -emit-module %t/module.modulemap -o %t/b14.pcm -fmodule-file=%t/a13.pcm -fmodule-file=%t/b13.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=a15 -x c++ -emit-module %t/module.modulemap -o %t/a15.pcm -fmodule-file=%t/a14.pcm -fmodule-file=%t/b14.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=b15 -x c++ -emit-module %t/module.modulemap -o %t/b15.pcm -fmodule-file=%t/a14.pcm -fmodule-file=%t/b14.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=a16 -x c++ -emit-module %t/module.modulemap -o %t/a16.pcm -fmodule-file=%t/a15.pcm -fmodule-file=%t/b15.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=b16 -x c++ -emit-module %t/module.modulemap -o %t/b16.pcm -fmodule-file=%t/a15.pcm -fmodule-file=%t/b15.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=a17 -x c++ -emit-module %t/module.modulemap -o %t/a17.pcm -fmodule-file=%t/a16.pcm -fmodule-file=%t/b16.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=b17 -x c++ -emit-module %t/module.modulemap -o %t/b17.pcm -fmodule-file=%t/a16.pcm -fmodule-file=%t/b16.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=a18 -x c++ -emit-module %t/module.modulemap -o %t/a18.pcm -fmodule-file=%t/a17.pcm -fmodule-file=%t/b17.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=b18 -x c++ -emit-module %t/module.modulemap -o %t/b18.pcm -fmodule-file=%t/a17.pcm -fmodule-file=%t/b17.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=a19 -x c++ -emit-module %t/module.modulemap -o %t/a19.pcm -fmodule-file=%t/a18.pcm -fmodule-file=%t/b18.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=b19 -x c++ -emit-module %t/module.modulemap -o %t/b19.pcm -fmodule-file=%t/a18.pcm -fmodule-file=%t/b18.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=a20 -x c++ -emit-module %t/module.modulemap -o %t/a20.pcm -fmodule-file=%t/a19.pcm -fmodule-file=%t/b19.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fmodule-name=b20 -x c++ -emit-module %t/module.modulemap -o %t/b20.pcm -fmodule-file=%t/a19.pcm -fmodule-file=%t/b19.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a0 -x c++ -emit-module %t/module.modulemap -o %t/a0.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b0 -x c++ -emit-module %t/module.modulemap -o %t/b0.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a1 -x c++ -emit-module %t/module.modulemap -o %t/a1.pcm -fmodule-file=%t/a0.pcm -fmodule-file=%t/b0.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b1 -x c++ -emit-module %t/module.modulemap -o %t/b1.pcm -fmodule-file=%t/a0.pcm -fmodule-file=%t/b0.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a2 -x c++ -emit-module %t/module.modulemap -o %t/a2.pcm -fmodule-file=%t/a1.pcm -fmodule-file=%t/b1.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b2 -x c++ -emit-module %t/module.modulemap -o %t/b2.pcm -fmodule-file=%t/a1.pcm -fmodule-file=%t/b1.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a3 -x c++ -emit-module %t/module.modulemap -o %t/a3.pcm -fmodule-file=%t/a2.pcm -fmodule-file=%t/b2.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b3 -x c++ -emit-module %t/module.modulemap -o %t/b3.pcm -fmodule-file=%t/a2.pcm -fmodule-file=%t/b2.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a4 -x c++ -emit-module %t/module.modulemap -o %t/a4.pcm -fmodule-file=%t/a3.pcm -fmodule-file=%t/b3.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b4 -x c++ -emit-module %t/module.modulemap -o %t/b4.pcm -fmodule-file=%t/a3.pcm -fmodule-file=%t/b3.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a5 -x c++ -emit-module %t/module.modulemap -o %t/a5.pcm -fmodule-file=%t/a4.pcm -fmodule-file=%t/b4.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b5 -x c++ -emit-module %t/module.modulemap -o %t/b5.pcm -fmodule-file=%t/a4.pcm -fmodule-file=%t/b4.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a6 -x c++ -emit-module %t/module.modulemap -o %t/a6.pcm -fmodule-file=%t/a5.pcm -fmodule-file=%t/b5.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b6 -x c++ -emit-module %t/module.modulemap -o %t/b6.pcm -fmodule-file=%t/a5.pcm -fmodule-file=%t/b5.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a7 -x c++ -emit-module %t/module.modulemap -o %t/a7.pcm -fmodule-file=%t/a6.pcm -fmodule-file=%t/b6.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b7 -x c++ -emit-module %t/module.modulemap -o %t/b7.pcm -fmodule-file=%t/a6.pcm -fmodule-file=%t/b6.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a8 -x c++ -emit-module %t/module.modulemap -o %t/a8.pcm -fmodule-file=%t/a7.pcm -fmodule-file=%t/b7.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b8 -x c++ -emit-module %t/module.modulemap -o %t/b8.pcm -fmodule-file=%t/a7.pcm -fmodule-file=%t/b7.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a9 -x c++ -emit-module %t/module.modulemap -o %t/a9.pcm -fmodule-file=%t/a8.pcm -fmodule-file=%t/b8.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b9 -x c++ -emit-module %t/module.modulemap -o %t/b9.pcm -fmodule-file=%t/a8.pcm -fmodule-file=%t/b8.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a10 -x c++ -emit-module %t/module.modulemap -o %t/a10.pcm -fmodule-file=%t/a9.pcm -fmodule-file=%t/b9.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b10 -x c++ -emit-module %t/module.modulemap -o %t/b10.pcm -fmodule-file=%t/a9.pcm -fmodule-file=%t/b9.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a11 -x c++ -emit-module %t/module.modulemap -o %t/a11.pcm -fmodule-file=%t/a10.pcm -fmodule-file=%t/b10.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b11 -x c++ -emit-module %t/module.modulemap -o %t/b11.pcm -fmodule-file=%t/a10.pcm -fmodule-file=%t/b10.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a12 -x c++ -emit-module %t/module.modulemap -o %t/a12.pcm -fmodule-file=%t/a11.pcm -fmodule-file=%t/b11.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b12 -x c++ -emit-module %t/module.modulemap -o %t/b12.pcm -fmodule-file=%t/a11.pcm -fmodule-file=%t/b11.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a13 -x c++ -emit-module %t/module.modulemap -o %t/a13.pcm -fmodule-file=%t/a12.pcm -fmodule-file=%t/b12.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b13 -x c++ -emit-module %t/module.modulemap -o %t/b13.pcm -fmodule-file=%t/a12.pcm -fmodule-file=%t/b12.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a14 -x c++ -emit-module %t/module.modulemap -o %t/a14.pcm -fmodule-file=%t/a13.pcm -fmodule-file=%t/b13.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b14 -x c++ -emit-module %t/module.modulemap -o %t/b14.pcm -fmodule-file=%t/a13.pcm -fmodule-file=%t/b13.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a15 -x c++ -emit-module %t/module.modulemap -o %t/a15.pcm -fmodule-file=%t/a14.pcm -fmodule-file=%t/b14.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b15 -x c++ -emit-module %t/module.modulemap -o %t/b15.pcm -fmodule-file=%t/a14.pcm -fmodule-file=%t/b14.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a16 -x c++ -emit-module %t/module.modulemap -o %t/a16.pcm -fmodule-file=%t/a15.pcm -fmodule-file=%t/b15.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b16 -x c++ -emit-module %t/module.modulemap -o %t/b16.pcm -fmodule-file=%t/a15.pcm -fmodule-file=%t/b15.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a17 -x c++ -emit-module %t/module.modulemap -o %t/a17.pcm -fmodule-file=%t/a16.pcm -fmodule-file=%t/b16.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b17 -x c++ -emit-module %t/module.modulemap -o %t/b17.pcm -fmodule-file=%t/a16.pcm -fmodule-file=%t/b16.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a18 -x c++ -emit-module %t/module.modulemap -o %t/a18.pcm -fmodule-file=%t/a17.pcm -fmodule-file=%t/b17.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b18 -x c++ -emit-module %t/module.modulemap -o %t/b18.pcm -fmodule-file=%t/a17.pcm -fmodule-file=%t/b17.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a19 -x c++ -emit-module %t/module.modulemap -o %t/a19.pcm -fmodule-file=%t/a18.pcm -fmodule-file=%t/b18.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b19 -x c++ -emit-module %t/module.modulemap -o %t/b19.pcm -fmodule-file=%t/a18.pcm -fmodule-file=%t/b18.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a20 -x c++ -emit-module %t/module.modulemap -o %t/a20.pcm -fmodule-file=%t/a19.pcm -fmodule-file=%t/b19.pcm +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b20 -x c++ -emit-module %t/module.modulemap -o %t/b20.pcm -fmodule-file=%t/a19.pcm -fmodule-file=%t/b19.pcm // // Build, using all the modules. -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%t -fsyntax-only %s \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fsyntax-only %s \ // RUN: -fmodule-file=%t/a0.pcm -fmodule-file=%t/b0.pcm \ // RUN: -fmodule-file=%t/a1.pcm -fmodule-file=%t/b1.pcm \ // RUN: -fmodule-file=%t/a2.pcm -fmodule-file=%t/b2.pcm \ diff --git a/test/Modules/extern_c.cpp b/test/Modules/extern_c.cpp index ba466f2..f505c11 100644 --- a/test/Modules/extern_c.cpp +++ b/test/Modules/extern_c.cpp @@ -1,16 +1,16 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -verify -fmodules-cache-path=%t -I %S/Inputs %s -// RUN: %clang_cc1 -fmodules -verify -fmodules-cache-path=%t -I %S/Inputs %s -DEXTERN_C -// RUN: %clang_cc1 -fmodules -verify -fmodules-cache-path=%t -I %S/Inputs %s -DEXTERN_CXX -// RUN: %clang_cc1 -fmodules -verify -fmodules-cache-path=%t -I %S/Inputs %s -DEXTERN_C -DEXTERN_CXX -// RUN: %clang_cc1 -fmodules -verify -fmodules-cache-path=%t -I %S/Inputs %s -DEXTERN_C -DNAMESPACE -// RUN: %clang_cc1 -fmodules -verify -fmodules-cache-path=%t -I %S/Inputs %s -DCXX_HEADER -// RUN: %clang_cc1 -fmodules -verify -fmodules-cache-path=%t -I %S/Inputs %s -DCXX_HEADER -DEXTERN_C -// RUN: %clang_cc1 -fmodules -verify -fmodules-cache-path=%t -I %S/Inputs %s -DCXX_HEADER -DEXTERN_CXX -// RUN: %clang_cc1 -fmodules -verify -fmodules-cache-path=%t -I %S/Inputs %s -DCXX_HEADER -DEXTERN_C -DEXTERN_CXX -// RUN: %clang_cc1 -fmodules -verify -fmodules-cache-path=%t -I %S/Inputs %s -DCXX_HEADER -DEXTERN_C -DNAMESPACE -// RUN: %clang_cc1 -fmodules -verify -fmodules-cache-path=%t -I %S/Inputs -x c %s -// RUN: %clang_cc1 -fmodules -verify -fmodules-cache-path=%t -I %S/Inputs/elsewhere -I %S/Inputs %s -DEXTERN_C -DINDIRECT +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -DEXTERN_C +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -DEXTERN_CXX +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -DEXTERN_C -DEXTERN_CXX +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -DEXTERN_C -DNAMESPACE +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -DCXX_HEADER +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -DCXX_HEADER -DEXTERN_C +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -DCXX_HEADER -DEXTERN_CXX +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -DCXX_HEADER -DEXTERN_C -DEXTERN_CXX +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -DCXX_HEADER -DEXTERN_C -DNAMESPACE +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs -x c %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs/elsewhere -I %S/Inputs %s -DEXTERN_C -DINDIRECT #ifdef INDIRECT #include "c-header-indirect.h" diff --git a/test/Modules/extern_c_bad.cpp b/test/Modules/extern_c_bad.cpp index bafdc04..c34416a 100644 --- a/test/Modules/extern_c_bad.cpp +++ b/test/Modules/extern_c_bad.cpp @@ -1,2 +1,2 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -verify -fmodules -x c++ -emit-module -fmodules-cache-path=%t -fmodule-name=c_library_bad %S/Inputs/module.map +// RUN: %clang_cc1 -verify -fmodules -fimplicit-module-maps -x c++ -emit-module -fmodules-cache-path=%t -fmodule-name=c_library_bad %S/Inputs/module.map diff --git a/test/Modules/fatal-module-loader-error.m b/test/Modules/fatal-module-loader-error.m index 2d8dd24..99a42c2 100644 --- a/test/Modules/fatal-module-loader-error.m +++ b/test/Modules/fatal-module-loader-error.m @@ -1,8 +1,8 @@ // RUN: rm -rf %t // RUN: mkdir %t // RUN: touch %t/Module.pcm -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t %s -fdisable-module-hash -F %S/Inputs -verify -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t %s -fdisable-module-hash -F %S/Inputs -DIMPLICIT -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s -fdisable-module-hash -F %S/Inputs -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s -fdisable-module-hash -F %S/Inputs -DIMPLICIT -verify // This tests that after a fatal module loader error, we do not continue parsing. @@ -21,6 +21,6 @@ #endif // Also check that libclang does not create a PCH with such an error. -// RUN: not c-index-test -write-pch %t.pch -fmodules -fmodules-cache-path=%t \ +// RUN: not c-index-test -write-pch %t.pch -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ // RUN: %s -Xclang -fdisable-module-hash -F %S/Inputs 2>&1 | FileCheck %s // CHECK: {{^}}Failure: AST deserialization error occurred{{$}} diff --git a/test/Modules/filename.cpp b/test/Modules/filename.cpp index 460b6e6..e2b5ad1 100644 --- a/test/Modules/filename.cpp +++ b/test/Modules/filename.cpp @@ -1,5 +1,5 @@ // RUN: cd %S -// RUN: %clang_cc1 -I. -fmodule-maps -fmodule-name=A -fmodule-map-file=%S/Inputs/filename/module.map %s -E | FileCheck %s +// RUN: %clang_cc1 -I. -fmodule-name=A -fmodule-map-file=%S/Inputs/filename/module.map %s -E | FileCheck %s #include "Inputs/filename/a.h" diff --git a/test/Modules/fmodules-validate-once-per-build-session.c b/test/Modules/fmodules-validate-once-per-build-session.c index dcbd0db..dc552ea 100644 --- a/test/Modules/fmodules-validate-once-per-build-session.c +++ b/test/Modules/fmodules-validate-once-per-build-session.c @@ -13,8 +13,8 @@ // === // Compile the module. -// RUN: %clang_cc1 -cc1 -fmodules -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -isystem %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s -// RUN: %clang_cc1 -cc1 -fmodules -fdisable-module-hash -fmodules-cache-path=%t/modules-cache-user -fsyntax-only -I %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s +// RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -isystem %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s +// RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache-user -fsyntax-only -I %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s // RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp // RUN: ls -R %t/modules-cache-user | grep Foo.pcm.timestamp // RUN: cp %t/modules-cache/Foo.pcm %t/modules-to-compare/Foo-before.pcm @@ -22,8 +22,8 @@ // === // Use it, and make sure that we did not recompile it. -// RUN: %clang_cc1 -cc1 -fmodules -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -isystem %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s -// RUN: %clang_cc1 -cc1 -fmodules -fdisable-module-hash -fmodules-cache-path=%t/modules-cache-user -fsyntax-only -I %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s +// RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -isystem %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s +// RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache-user -fsyntax-only -I %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s // RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp // RUN: ls -R %t/modules-cache-user | grep Foo.pcm.timestamp // RUN: cp %t/modules-cache/Foo.pcm %t/modules-to-compare/Foo-after.pcm @@ -39,8 +39,8 @@ // === // Use the module, and make sure that we did not recompile it if foo.h is a // system header, even though the sources changed. -// RUN: %clang_cc1 -cc1 -fmodules -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -isystem %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s -// RUN: %clang_cc1 -cc1 -fmodules -fdisable-module-hash -fmodules-cache-path=%t/modules-cache-user -fsyntax-only -I %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s +// RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -isystem %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s +// RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache-user -fsyntax-only -I %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s // RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp // RUN: ls -R %t/modules-cache-user | grep Foo.pcm.timestamp // RUN: cp %t/modules-cache/Foo.pcm %t/modules-to-compare/Foo-after.pcm @@ -52,7 +52,7 @@ // === // Recompile the module if the today's date is before 01 January 2030. -// RUN: %clang_cc1 -cc1 -fmodules -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -isystem %t/Inputs -fbuild-session-timestamp=1893456000 -fmodules-validate-once-per-build-session %s +// RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -isystem %t/Inputs -fbuild-session-timestamp=1893456000 -fmodules-validate-once-per-build-session %s // RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp // RUN: cp %t/modules-cache/Foo.pcm %t/modules-to-compare/Foo-after.pcm diff --git a/test/Modules/global_index.m b/test/Modules/global_index.m index b255b63..64a70f2 100644 --- a/test/Modules/global_index.m +++ b/test/Modules/global_index.m @@ -1,12 +1,12 @@ // RUN: rm -rf %t // Run without global module index -// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fdisable-module-hash -fmodules -fno-modules-global-index -F %S/Inputs %s -verify +// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fdisable-module-hash -fmodules -fimplicit-module-maps -fno-modules-global-index -F %S/Inputs %s -verify // RUN: ls %t|not grep modules.idx // Run and create the global module index -// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fdisable-module-hash -fmodules -F %S/Inputs %s -verify +// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fdisable-module-hash -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify // RUN: ls %t|grep modules.idx // Run and use the global module index -// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fdisable-module-hash -fmodules -F %S/Inputs %s -verify -print-stats 2>&1 | FileCheck %s +// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fdisable-module-hash -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify -print-stats 2>&1 | FileCheck %s // expected-no-diagnostics @import DependsOnModule; diff --git a/test/Modules/header-import.m b/test/Modules/header-import.m index baeb1d3..f95c3bd 100644 --- a/test/Modules/header-import.m +++ b/test/Modules/header-import.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -F %S/Inputs -I %S/Inputs -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -F %S/Inputs -I %S/Inputs -verify %s // expected-no-diagnostics #import "point.h" diff --git a/test/Modules/ignored_macros.m b/test/Modules/ignored_macros.m index 669db4d..a87a11f 100644 --- a/test/Modules/ignored_macros.m +++ b/test/Modules/ignored_macros.m @@ -1,14 +1,14 @@ // First trial: pass -DIGNORED=1 to both. This should obviously work. // RUN: rm -rf %t.modules -// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify -// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -I %S/Inputs -include-pch %t.pch %s -verify +// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -fimplicit-module-maps -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify +// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -fimplicit-module-maps -I %S/Inputs -include-pch %t.pch %s -verify // Second trial: pass -DIGNORED=1 only to the second invocation. We // should detect the failure. // // RUN: rm -rf %t.modules -// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -fmodules -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify -// RUN: not %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -I %S/Inputs -include-pch %t.pch %s > %t.err 2>&1 +// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -fmodules -fimplicit-module-maps -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify +// RUN: not %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -fimplicit-module-maps -I %S/Inputs -include-pch %t.pch %s > %t.err 2>&1 // RUN: FileCheck -check-prefix=CHECK-CONFLICT %s < %t.err // CHECK-CONFLICT: PCH was compiled with module cache path @@ -16,22 +16,22 @@ // make it ignored. There should be no failure, IGNORED is defined in // the translation unit but not the module. // RUN: rm -rf %t.modules -// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -fmodules -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify -// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -I %S/Inputs -include-pch %t.pch -fmodules-ignore-macro=IGNORED %s -verify +// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -fmodules -fimplicit-module-maps -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify +// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -fimplicit-module-maps -I %S/Inputs -include-pch %t.pch -fmodules-ignore-macro=IGNORED %s -verify // Fourth trial: pass -DIGNORED=1 and -fmodules-ignore-macro=IGNORED // to both invocations, so modules will be built without the IGNORED // macro. // RUN: rm -rf %t.modules -// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules-ignore-macro=IGNORED -fmodules -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify -// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -I %S/Inputs -include-pch %t.pch -fmodules-ignore-macro=IGNORED -DNO_IGNORED_ANYWHERE -fmodules-ignore-macro=NO_IGNORED_ANYWHERE %s -verify +// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules-ignore-macro=IGNORED -fmodules -fimplicit-module-maps -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify +// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -fimplicit-module-maps -I %S/Inputs -include-pch %t.pch -fmodules-ignore-macro=IGNORED -DNO_IGNORED_ANYWHERE -fmodules-ignore-macro=NO_IGNORED_ANYWHERE %s -verify // Fifth trial: pass -DIGNORED=1 and -fmodules-ignore-macro=IGNORED=1 // to both invocations, so modules will be built without the IGNORED // macro. // RUN: rm -rf %t.modules -// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules-ignore-macro=IGNORED=1 -fmodules -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify -// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -I %S/Inputs -include-pch %t.pch -fmodules-ignore-macro=IGNORED=1 -DNO_IGNORED_ANYWHERE -fmodules-ignore-macro=NO_IGNORED_ANYWHERE %s -verify +// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules-ignore-macro=IGNORED=1 -fmodules -fimplicit-module-maps -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify +// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -fimplicit-module-maps -I %S/Inputs -include-pch %t.pch -fmodules-ignore-macro=IGNORED=1 -DNO_IGNORED_ANYWHERE -fmodules-ignore-macro=NO_IGNORED_ANYWHERE %s -verify // expected-no-diagnostics diff --git a/test/Modules/implementation-of-module.m b/test/Modules/implementation-of-module.m index 818cce8..37e2cfb 100644 --- a/test/Modules/implementation-of-module.m +++ b/test/Modules/implementation-of-module.m @@ -3,19 +3,19 @@ // CHECK-IMPL-OF-ERR: conflicting module names specified: '-fmodule-name=Bar' and '-fmodule-implementation-of Foo' // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -w -Werror=auto-import %s -I %S/Inputs \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -w -Werror=auto-import %s -I %S/Inputs \ // RUN: -fmodule-implementation-of category_right -fsyntax-only -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -w -Werror=auto-import %s -I %S/Inputs \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -w -Werror=auto-import %s -I %S/Inputs \ // RUN: -fmodule-implementation-of category_right -dM -E -o - 2>&1 | FileCheck %s // CHECK-NOT: __building_module -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -w -Werror=auto-import %s -I %S/Inputs \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -w -Werror=auto-import %s -I %S/Inputs \ // RUN: -fmodule-implementation-of category_left -verify -// RUN: %clang_cc1 -x objective-c-header -fmodules -fmodules-cache-path=%t -w -Werror=auto-import %s -I %S/Inputs \ +// RUN: %clang_cc1 -x objective-c-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -w -Werror=auto-import %s -I %S/Inputs \ // RUN: -fmodule-implementation-of category_right -emit-pch -o %t.pch -// RUN: %clang_cc1 -x objective-c-header -fmodules -fmodules-cache-path=%t -w -Werror=auto-import %s -I %S/Inputs \ +// RUN: %clang_cc1 -x objective-c-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -w -Werror=auto-import %s -I %S/Inputs \ // RUN: -DWITH_PREFIX -fmodules-ignore-macro=WITH_PREFIX -include-pch %t.pch -fmodule-implementation-of category_right #ifndef WITH_PREFIX diff --git a/test/Modules/import-self.m b/test/Modules/import-self.m index 68be565..aa74371 100644 --- a/test/Modules/import-self.m +++ b/test/Modules/import-self.m @@ -1,9 +1,9 @@ // RUN: rm -rf %t -// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t \ +// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ // RUN: -I %S/Inputs/submodules %s 2>&1 | FileCheck %s // CHECK: import of module 'import_self.c' appears within same top-level module 'import_self' -// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t \ +// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ // RUN: -I %S/Inputs/submodules -fmodule-name=import_self %s \ // RUN: 2>&1 | FileCheck -check-prefix=CHECK-fmodule-name %s // CHECK-fmodule-name: import of module 'import_self.b' appears within same top-level module 'import_self' diff --git a/test/Modules/include-relative.c b/test/Modules/include-relative.c index 264df5f..84d44cb 100644 --- a/test/Modules/include-relative.c +++ b/test/Modules/include-relative.c @@ -2,7 +2,7 @@ // RUN: mkdir %t // RUN: cp -r %S/Inputs/include-relative %t/include-relative // RUN: cd %t -// RUN: %clang_cc1 -fmodules -x c -verify -fmodules-cache-path=%t -I include-relative %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x c -verify -fmodules-cache-path=%t -I include-relative %s // expected-no-diagnostics diff --git a/test/Modules/include_next.c b/test/Modules/include_next.c index f2dafb4..15658cb 100644 --- a/test/Modules/include_next.c +++ b/test/Modules/include_next.c @@ -1,6 +1,6 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -I%S/Inputs/include_next/x -I%S/Inputs/include_next/y -verify %s -// RUN: %clang_cc1 -I%S/Inputs/include_next/x -I%S/Inputs/include_next/y -verify %s -fmodules -fmodules-cache-path=%t +// RUN: %clang_cc1 -I%S/Inputs/include_next/x -I%S/Inputs/include_next/y -verify %s -fmodules -fimplicit-module-maps -fmodules-cache-path=%t // expected-no-diagnostics #include "a.h" diff --git a/test/Modules/incomplete-module.m b/test/Modules/incomplete-module.m index 8181ae8..e338a40 100644 --- a/test/Modules/incomplete-module.m +++ b/test/Modules/incomplete-module.m @@ -1,9 +1,9 @@ @import incomplete_mod; // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules-cache-path=%t -Wincomplete-module -fmodules -I %S/Inputs %s 2>&1 | FileCheck %s +// RUN: %clang_cc1 -fmodules-cache-path=%t -Wincomplete-module -fmodules -fimplicit-module-maps -I %S/Inputs %s 2>&1 | FileCheck %s // CHECK: warning: include of non-modular header inside module 'incomplete_mod' // RUN: rm -rf %t -// RUN: not %clang_cc1 -fmodules-cache-path=%t -fmodules-strict-decluse -fmodules -I %S/Inputs %s 2>&1 | FileCheck %s -check-prefix=DECLUSE +// RUN: not %clang_cc1 -fmodules-cache-path=%t -fmodules-strict-decluse -fmodules -fimplicit-module-maps -I %S/Inputs %s 2>&1 | FileCheck %s -check-prefix=DECLUSE // DECLUSE: error: module incomplete_mod does not depend on a module exporting {{'.*incomplete_mod_missing.h'}} diff --git a/test/Modules/inferred-attributes.mm b/test/Modules/inferred-attributes.mm index 5fc1d62..b1bcd93 100644 --- a/test/Modules/inferred-attributes.mm +++ b/test/Modules/inferred-attributes.mm @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -F %S/Inputs/inferred-attr -fsyntax-only -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -F %S/Inputs/inferred-attr -fsyntax-only -verify %s // expected-no-diagnostics extern "C" { @import InferredExternC; diff --git a/test/Modules/inferred-framework-case.m b/test/Modules/inferred-framework-case.m index e511155..2ed443f 100644 --- a/test/Modules/inferred-framework-case.m +++ b/test/Modules/inferred-framework-case.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -F %S/Inputs %s -verify -DA +// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify -DA // FIXME: PR20299 - getCanonicalName() is not implemented on Windows. // REQUIRES: shell diff --git a/test/Modules/inferred-frameworks.m b/test/Modules/inferred-frameworks.m index 372e4f2..838237d 100644 --- a/test/Modules/inferred-frameworks.m +++ b/test/Modules/inferred-frameworks.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c -Wauto-import -fmodules-cache-path=%t -fmodules -F %S/Inputs %s -verify +// RUN: %clang_cc1 -x objective-c -Wauto-import -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify #include <NotAModule/NotAModule.h> diff --git a/test/Modules/inferred-submodules.m b/test/Modules/inferred-submodules.m index f801d04..a0b7d98 100644 --- a/test/Modules/inferred-submodules.m +++ b/test/Modules/inferred-submodules.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c -Wauto-import -fmodules-cache-path=%t -fmodules -F %S/Inputs %s -verify +// RUN: %clang_cc1 -x objective-c -Wauto-import -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify // expected-no-diagnostics @import Module.Sub; diff --git a/test/Modules/invalidate-identifiers.c b/test/Modules/invalidate-identifiers.c index de3aa10..c679813 100644 --- a/test/Modules/invalidate-identifiers.c +++ b/test/Modules/invalidate-identifiers.c @@ -1,4 +1,4 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/invalidate-identifiers -emit-llvm-only %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/invalidate-identifiers -emit-llvm-only %s #include "b.h" diff --git a/test/Modules/irgen.c b/test/Modules/irgen.c index c44afb1..f09cc7b 100644 --- a/test/Modules/irgen.c +++ b/test/Modules/irgen.c @@ -1,6 +1,6 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -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 -x objective-c -fmodules-cache-path=%t -I %S/Inputs -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// 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 // FIXME: When we have a syntax for modules in C, use that. @import irgen; diff --git a/test/Modules/linkage-merge.cpp b/test/Modules/linkage-merge.cpp index 3ac8053..005206a 100644 --- a/test/Modules/linkage-merge.cpp +++ b/test/Modules/linkage-merge.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -verify -fmodules -fmodules-cache-path=%t -I %S/Inputs %s +// RUN: %clang_cc1 -verify -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s #include "linkage-merge-bar.h" diff --git a/test/Modules/linkage-merge.m b/test/Modules/linkage-merge.m index 12ad32f..955eb1a 100644 --- a/test/Modules/linkage-merge.m +++ b/test/Modules/linkage-merge.m @@ -1,6 +1,6 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=linkage_merge_left %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs -w %s -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=linkage_merge_left %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -w %s -verify // Test redeclarations of functions where the original declaration is // still hidden. diff --git a/test/Modules/load-after-failure.m b/test/Modules/load-after-failure.m index 38d4a36..73ed0e7 100644 --- a/test/Modules/load-after-failure.m +++ b/test/Modules/load-after-failure.m @@ -11,9 +11,9 @@ // RUN: echo 'module C { header "C.h" }' >> %t/module.modulemap // RUN: echo 'module D { header "D.h" }' >> %t/module.modulemap -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %t %s -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %t %s -verify // RUN: echo " " >> %t/D.h -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %t %s -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %t %s -verify // expected-no-diagnostics diff --git a/test/Modules/load_failure.c b/test/Modules/load_failure.c index 8b0d202..6e63ba2 100644 --- a/test/Modules/load_failure.c +++ b/test/Modules/load_failure.c @@ -7,11 +7,11 @@ #endif // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodules-cache-path=%t -fdisable-module-hash -emit-module -fmodule-name=load_failure %S/Inputs/module.map -// RUN: not %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -I %S/Inputs -fdisable-module-hash %s -DNONEXISTENT 2>&1 | FileCheck -check-prefix=CHECK-NONEXISTENT %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c++ -fmodules-cache-path=%t -fdisable-module-hash -emit-module -fmodule-name=load_failure %S/Inputs/module.map +// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -I %S/Inputs -fdisable-module-hash %s -DNONEXISTENT 2>&1 | FileCheck -check-prefix=CHECK-NONEXISTENT %s // CHECK-NONEXISTENT: load_failure.c:2:9: fatal error: module 'load_nonexistent' not found -// RUN: not %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -I %S/Inputs -fdisable-module-hash %s -DFAILURE 2> %t.out +// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -I %S/Inputs -fdisable-module-hash %s -DFAILURE 2> %t.out // RUN: FileCheck -check-prefix=CHECK-FAILURE %s < %t.out // FIXME: Clean up diagnostic text below and give it a location diff --git a/test/Modules/lookup.cpp b/test/Modules/lookup.cpp index bfe0307..e847d78 100644 --- a/test/Modules/lookup.cpp +++ b/test/Modules/lookup.cpp @@ -24,10 +24,10 @@ void f() { } // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c++ -emit-module -fmodules-cache-path=%t -fmodule-name=lookup_left_cxx %S/Inputs/module.map -verify -// RUN: %clang_cc1 -fmodules -x objective-c++ -emit-module -fmodules-cache-path=%t -fmodule-name=lookup_right_cxx %S/Inputs/module.map -verify -// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodules-cache-path=%t -I %S/Inputs %s -verify -// RUN: %clang_cc1 -fmodules -ast-print -x objective-c++ -fmodules-cache-path=%t -I %S/Inputs %s | FileCheck -check-prefix=CHECK-PRINT %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c++ -emit-module -fmodules-cache-path=%t -fmodule-name=lookup_left_cxx %S/Inputs/module.map -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c++ -emit-module -fmodules-cache-path=%t -fmodule-name=lookup_right_cxx %S/Inputs/module.map -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c++ -fmodules-cache-path=%t -I %S/Inputs %s -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -ast-print -x objective-c++ -fmodules-cache-path=%t -I %S/Inputs %s | FileCheck -check-prefix=CHECK-PRINT %s // FIXME: When we have a syntax for modules in C++, use that. // CHECK-PRINT: int *f0(int *); diff --git a/test/Modules/lookup.m b/test/Modules/lookup.m index 187e876..edf7063 100644 --- a/test/Modules/lookup.m +++ b/test/Modules/lookup.m @@ -1,8 +1,8 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -emit-module -x objective-c -fmodule-name=lookup_left_objc %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -emit-module -x objective-c -fmodule-name=lookup_right_objc %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -I %S/Inputs -verify %s -// RUN: %clang_cc1 -fmodules -ast-print -x objective-c -fmodules-cache-path=%t -I %S/Inputs %s | FileCheck -check-prefix=CHECK-PRINT %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -emit-module -x objective-c -fmodule-name=lookup_left_objc %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -emit-module -x objective-c -fmodule-name=lookup_right_objc %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -I %S/Inputs -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -ast-print -x objective-c -fmodules-cache-path=%t -I %S/Inputs %s | FileCheck -check-prefix=CHECK-PRINT %s @import lookup_left_objc; @import lookup_right_objc; diff --git a/test/Modules/macro-ambiguity.cpp b/test/Modules/macro-ambiguity.cpp index af43b35..747a80b 100644 --- a/test/Modules/macro-ambiguity.cpp +++ b/test/Modules/macro-ambiguity.cpp @@ -5,7 +5,7 @@ // RUN: -v \ // RUN: -iquote Inputs/macro-ambiguity/a/quote \ // RUN: -isystem Inputs/macro-ambiguity/a/system \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -fmodule-map-file-home-is-cwd \ // RUN: -emit-module -fmodule-name=a -o %t/a.pcm \ // RUN: Inputs/macro-ambiguity/module.modulemap @@ -14,7 +14,7 @@ // RUN: -v \ // RUN: -iquote Inputs/macro-ambiguity/b/quote \ // RUN: -isystem Inputs/macro-ambiguity/b/system \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -fmodule-map-file-home-is-cwd \ // RUN: -emit-module -fmodule-name=b -o %t/b.pcm \ // RUN: Inputs/macro-ambiguity/module.modulemap @@ -23,7 +23,7 @@ // RUN: -v \ // RUN: -iquote Inputs/macro-ambiguity/c/quote \ // RUN: -isystem Inputs/macro-ambiguity/c/system \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -fmodule-map-file-home-is-cwd \ // RUN: -emit-module -fmodule-name=c -o %t/c.pcm \ // RUN: Inputs/macro-ambiguity/module.modulemap @@ -32,7 +32,7 @@ // RUN: -v \ // RUN: -iquote Inputs/macro-ambiguity/d/quote \ // RUN: -isystem Inputs/macro-ambiguity/d/system \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -fmodule-map-file-home-is-cwd \ // RUN: -emit-module -fmodule-name=d -o %t/d.pcm \ // RUN: Inputs/macro-ambiguity/module.modulemap @@ -49,7 +49,7 @@ // RUN: -isystem Inputs/macro-ambiguity/d/system \ // RUN: -iquote Inputs/macro-ambiguity/e/quote \ // RUN: -isystem Inputs/macro-ambiguity/e/system \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -fmodule-map-file-home-is-cwd \ // RUN: -fmodule-map-file=Inputs/macro-ambiguity/module.modulemap \ // RUN: -fmodule-file=%t/a.pcm \ @@ -70,7 +70,7 @@ // RUN: -isystem Inputs/macro-ambiguity/d/system \ // RUN: -iquote Inputs/macro-ambiguity/e/quote \ // RUN: -isystem Inputs/macro-ambiguity/e/system \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -fmodule-map-file-home-is-cwd \ // RUN: -fmodule-map-file=Inputs/macro-ambiguity/module.modulemap \ // RUN: -fmodule-file=%t/a.pcm \ diff --git a/test/Modules/macro-hiding.cpp b/test/Modules/macro-hiding.cpp index b166f4b..37402ad 100644 --- a/test/Modules/macro-hiding.cpp +++ b/test/Modules/macro-hiding.cpp @@ -1,69 +1,69 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DC1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DC1 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB2 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB2 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB2 -DC1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB2 -DC1 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB1 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB1 -DC1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB1 -DC1 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB1 -DB2 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB1 -DB2 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB1 -DB2 -DC1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB1 -DB2 -DC1 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DC1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DC1 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB2 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB2 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB2 -DC1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB2 -DC1 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB1 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB1 -DC1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB1 -DC1 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB1 -DB2 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB1 -DB2 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB1 -DB2 -DC1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB1 -DB2 -DC1 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DC1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DC1 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB2 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB2 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB2 -DC1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB2 -DC1 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB1 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB1 -DC1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB1 -DC1 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB1 -DB2 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB1 -DB2 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB1 -DB2 -DC1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB1 -DB2 -DC1 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DC1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DC1 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB2 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB2 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB2 -DC1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB2 -DC1 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB1 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB1 -DC1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB1 -DC1 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB1 -DB2 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB1 -DB2 -DD1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB1 -DB2 -DC1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB1 -DB2 -DC1 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DC1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DC1 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB2 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB2 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB2 -DC1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB2 -DC1 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB1 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB1 -DC1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB1 -DC1 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB1 -DB2 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB1 -DB2 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB1 -DB2 -DC1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DB1 -DB2 -DC1 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DC1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DC1 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB2 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB2 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB2 -DC1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB2 -DC1 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB1 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB1 -DC1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB1 -DC1 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB1 -DB2 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB1 -DB2 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB1 -DB2 -DC1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA2 -DB1 -DB2 -DC1 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DC1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DC1 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB2 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB2 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB2 -DC1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB2 -DC1 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB1 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB1 -DC1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB1 -DC1 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB1 -DB2 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB1 -DB2 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB1 -DB2 -DC1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DB1 -DB2 -DC1 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DC1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DC1 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB2 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB2 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB2 -DC1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB2 -DC1 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB1 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB1 -DC1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB1 -DC1 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB1 -DB2 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB1 -DB2 -DD1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB1 -DB2 -DC1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DA1 -DA2 -DB1 -DB2 -DC1 -DD1 // -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DE1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s -DE1 #ifdef A1 #include "a1.h" diff --git a/test/Modules/macro-masking.cpp b/test/Modules/macro-masking.cpp index 3d4e8e0..cd97c07 100644 --- a/test/Modules/macro-masking.cpp +++ b/test/Modules/macro-masking.cpp @@ -1,6 +1,6 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fsyntax-only -fmodules %s -fmodules-cache-path=%t -verify -I%S/Inputs/macro-masking -// RxN: %clang_cc1 -fsyntax-only -fmodules -fmodules-local-submodule-visibility %s -fmodules-cache-path=%t -verify -I%S/Inputs/macro-masking -DLOCAL_VISIBILITY +// RUN: %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps %s -fmodules-cache-path=%t -verify -I%S/Inputs/macro-masking +// RxN: %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-local-submodule-visibility %s -fmodules-cache-path=%t -verify -I%S/Inputs/macro-masking -DLOCAL_VISIBILITY // expected-no-diagnostics #include "a.h" diff --git a/test/Modules/macro-reexport.cpp b/test/Modules/macro-reexport.cpp index 2be6f15..4e825a0 100644 --- a/test/Modules/macro-reexport.cpp +++ b/test/Modules/macro-reexport.cpp @@ -1,21 +1,21 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -fsyntax-only -DC1 -I%S/Inputs/macro-reexport %s -fmodules-cache-path=%t -verify -// RUN: %clang_cc1 -fsyntax-only -DC1 -I%S/Inputs/macro-reexport -fmodules %s -fmodules-cache-path=%t -verify +// RUN: %clang_cc1 -fsyntax-only -DC1 -I%S/Inputs/macro-reexport -fmodules -fimplicit-module-maps %s -fmodules-cache-path=%t -verify // RUN: %clang_cc1 -fsyntax-only -DD1 -I%S/Inputs/macro-reexport %s -fmodules-cache-path=%t -verify -// RUN: %clang_cc1 -fsyntax-only -DD1 -I%S/Inputs/macro-reexport -fmodules %s -fmodules-cache-path=%t -verify +// RUN: %clang_cc1 -fsyntax-only -DD1 -I%S/Inputs/macro-reexport -fmodules -fimplicit-module-maps %s -fmodules-cache-path=%t -verify // RUN: %clang_cc1 -fsyntax-only -DD2 -I%S/Inputs/macro-reexport %s -fmodules-cache-path=%t -verify -// RUN: %clang_cc1 -fsyntax-only -DD2 -I%S/Inputs/macro-reexport -fmodules %s -fmodules-cache-path=%t -verify +// RUN: %clang_cc1 -fsyntax-only -DD2 -I%S/Inputs/macro-reexport -fmodules -fimplicit-module-maps %s -fmodules-cache-path=%t -verify // RUN: %clang_cc1 -fsyntax-only -DF1 -I%S/Inputs/macro-reexport %s -fmodules-cache-path=%t -verify -// RUN: %clang_cc1 -fsyntax-only -DF1 -I%S/Inputs/macro-reexport -fmodules %s -fmodules-cache-path=%t -verify +// RUN: %clang_cc1 -fsyntax-only -DF1 -I%S/Inputs/macro-reexport -fmodules -fimplicit-module-maps %s -fmodules-cache-path=%t -verify // // RUN: %clang_cc1 -fmodules-local-submodule-visibility -fsyntax-only -DC1 -I%S/Inputs/macro-reexport %s -fmodules-cache-path=%t -verify -// RUN: %clang_cc1 -fmodules-local-submodule-visibility -fsyntax-only -DC1 -I%S/Inputs/macro-reexport -fmodules %s -fmodules-cache-path=%t -verify +// RUN: %clang_cc1 -fmodules-local-submodule-visibility -fsyntax-only -DC1 -I%S/Inputs/macro-reexport -fmodules -fimplicit-module-maps %s -fmodules-cache-path=%t -verify // RUN: %clang_cc1 -fmodules-local-submodule-visibility -fsyntax-only -DD1 -I%S/Inputs/macro-reexport %s -fmodules-cache-path=%t -verify -// RUN: %clang_cc1 -fmodules-local-submodule-visibility -fsyntax-only -DD1 -I%S/Inputs/macro-reexport -fmodules %s -fmodules-cache-path=%t -verify +// RUN: %clang_cc1 -fmodules-local-submodule-visibility -fsyntax-only -DD1 -I%S/Inputs/macro-reexport -fmodules -fimplicit-module-maps %s -fmodules-cache-path=%t -verify // RUN: %clang_cc1 -fmodules-local-submodule-visibility -fsyntax-only -DD2 -I%S/Inputs/macro-reexport %s -fmodules-cache-path=%t -verify -// RUN: %clang_cc1 -fmodules-local-submodule-visibility -fsyntax-only -DD2 -I%S/Inputs/macro-reexport -fmodules %s -fmodules-cache-path=%t -verify +// RUN: %clang_cc1 -fmodules-local-submodule-visibility -fsyntax-only -DD2 -I%S/Inputs/macro-reexport -fmodules -fimplicit-module-maps %s -fmodules-cache-path=%t -verify // RUN: %clang_cc1 -fmodules-local-submodule-visibility -fsyntax-only -DF1 -I%S/Inputs/macro-reexport %s -fmodules-cache-path=%t -verify -// RUN: %clang_cc1 -fmodules-local-submodule-visibility -fsyntax-only -DF1 -I%S/Inputs/macro-reexport -fmodules %s -fmodules-cache-path=%t -verify +// RUN: %clang_cc1 -fmodules-local-submodule-visibility -fsyntax-only -DF1 -I%S/Inputs/macro-reexport -fmodules -fimplicit-module-maps %s -fmodules-cache-path=%t -verify #if defined(F1) #include "f1.h" diff --git a/test/Modules/macro-undef-through-pch.m b/test/Modules/macro-undef-through-pch.m index 0e5e99f..fc32229 100644 --- a/test/Modules/macro-undef-through-pch.m +++ b/test/Modules/macro-undef-through-pch.m @@ -1,8 +1,8 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c-header -fmodules -fmodules-cache-path=%t \ +// RUN: %clang_cc1 -x objective-c-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ // RUN: -I%S/Inputs/macro-undef-through-pch -emit-pch \ // RUN: %S/Inputs/macro-undef-through-pch/foo.h -o %t.pch -// RUN: %clang_cc1 -x objective-c -fmodules -fmodules-cache-path=%t \ +// RUN: %clang_cc1 -x objective-c -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ // RUN: -I%S/Inputs/macro-undef-through-pch -emit-pch \ // RUN: -include-pch %t.pch %s diff --git a/test/Modules/macros.c b/test/Modules/macros.c index 538d4a8..54dca19 100644 --- a/test/Modules/macros.c +++ b/test/Modules/macros.c @@ -1,8 +1,8 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c -verify -fmodules-cache-path=%t -I %S/Inputs %s -// RUN: %clang_cc1 -fmodules -x objective-c -verify -fmodules-cache-path=%t -I %S/Inputs %s -detailed-preprocessing-record -// RUN: %clang_cc1 -fmodules -DLOCAL_VISIBILITY -fmodules-local-submodule-visibility -x objective-c++ -verify -fmodules-cache-path=%t -I %S/Inputs %s -// RUN: not %clang_cc1 -E -fmodules -x objective-c -fmodules-cache-path=%t -I %S/Inputs %s | FileCheck -check-prefix CHECK-PREPROCESSED %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -verify -fmodules-cache-path=%t -I %S/Inputs %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -verify -fmodules-cache-path=%t -I %S/Inputs %s -detailed-preprocessing-record +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -DLOCAL_VISIBILITY -fmodules-local-submodule-visibility -x objective-c++ -verify -fmodules-cache-path=%t -I %S/Inputs %s +// RUN: not %clang_cc1 -E -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -I %S/Inputs %s | FileCheck -check-prefix CHECK-PREPROCESSED %s // FIXME: When we have a syntax for modules in C, use that. // These notes come from headers in modules, and are bogus. diff --git a/test/Modules/macros2.c b/test/Modules/macros2.c index 0bb801e..7d669d1 100644 --- a/test/Modules/macros2.c +++ b/test/Modules/macros2.c @@ -1,6 +1,6 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c -verify -fmodules-cache-path=%t -I %S/Inputs %s -// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -x objective-c++ -verify -fmodules-cache-path=%t -I %S/Inputs %s -DLOCAL_VISIBILITY +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -verify -fmodules-cache-path=%t -I %S/Inputs %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-local-submodule-visibility -x objective-c++ -verify -fmodules-cache-path=%t -I %S/Inputs %s -DLOCAL_VISIBILITY // This test checks some of the same things as macros.c, but imports modules in // a different order. diff --git a/test/Modules/malformed.cpp b/test/Modules/malformed.cpp index 2d07c4c..7d5bcc8 100644 --- a/test/Modules/malformed.cpp +++ b/test/Modules/malformed.cpp @@ -3,9 +3,9 @@ // // RUN: rm -rf %t // RUN: cd %S -// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t -I Inputs/malformed -DHEADER="a1.h" %s 2>&1 | FileCheck %s --check-prefix=CHECK-A -// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t -I Inputs/malformed -DHEADER="b1.h" %s 2>&1 | FileCheck %s --check-prefix=CHECK-B -// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t -I Inputs/malformed -DHEADER="c.h" malformed.cpp 2>&1 | FileCheck %s --check-prefix=CHECK-C +// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I Inputs/malformed -DHEADER="a1.h" %s 2>&1 | FileCheck %s --check-prefix=CHECK-A +// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I Inputs/malformed -DHEADER="b1.h" %s 2>&1 | FileCheck %s --check-prefix=CHECK-B +// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I Inputs/malformed -DHEADER="c.h" malformed.cpp 2>&1 | FileCheck %s --check-prefix=CHECK-C #define STR2(x) #x #define STR(x) STR2(x) diff --git a/test/Modules/merge-anon-in-template.cpp b/test/Modules/merge-anon-in-template.cpp index 6e4e6e0..3d0db37 100644 --- a/test/Modules/merge-anon-in-template.cpp +++ b/test/Modules/merge-anon-in-template.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/merge-anon-in-template -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/merge-anon-in-template -verify %s // expected-no-diagnostics #include "a.h" #include "c.h" diff --git a/test/Modules/merge-class-definition-visibility.cpp b/test/Modules/merge-class-definition-visibility.cpp new file mode 100644 index 0000000..e8602c0 --- /dev/null +++ b/test/Modules/merge-class-definition-visibility.cpp @@ -0,0 +1,15 @@ +// 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 +// expected-no-diagnostics + +#include "c.h" +template<typename T> struct X { T t; }; +typedef X<A> XA; + +#include "d.h" +// Ensure that this triggers the import of the second definition from d.h, +// which is necessary to make the definition of A visible in the template +// instantiation. +XA xa; diff --git a/test/Modules/merge-decl-context.cpp b/test/Modules/merge-decl-context.cpp index 208ba92..55219ed 100644 --- a/test/Modules/merge-decl-context.cpp +++ b/test/Modules/merge-decl-context.cpp @@ -1,19 +1,19 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodule-name=b -o %t/b.pcm -fmodule-maps \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-name=b -o %t/b.pcm \ // RUN: -emit-module %S/Inputs/merge-decl-context/merge-decl-context.modulemap -I%S/Inputs \ // RUN: -I %S/Inputs/merge-decl-context -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodule-name=c -o %t/c.pcm -fmodule-maps \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-name=c -o %t/c.pcm \ // RUN: -fmodule-file=%t/b.pcm -fno-implicit-modules \ // RUN: -emit-module %S/Inputs/merge-decl-context/merge-decl-context.modulemap -I%S/Inputs \ // RUN: -I %S/Inputs/merge-decl-context -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodule-name=d -o %t/d.pcm -fmodule-maps \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-name=d -o %t/d.pcm \ // RUN: -fmodule-file=%t/b.pcm -fno-implicit-modules \ // RUN: -emit-module %S/Inputs/merge-decl-context/merge-decl-context.modulemap -I%S/Inputs \ // RUN: -I %S/Inputs/merge-decl-context // Use the two modules in a single compile. -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodule-file=%t/c.pcm -fmodule-file=%t/b.pcm \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-file=%t/c.pcm -fmodule-file=%t/b.pcm \ // RUN: -fmodule-file=%t/d.pcm -fno-implicit-modules \ // RUN: -fmodule-map-file=%S/Inputs/merge-decl-context/merge-decl-context.modulemap -I%S/Inputs \ // RUN: -emit-llvm -o %t/test.o %s diff --git a/test/Modules/merge-decl-order.cpp b/test/Modules/merge-decl-order.cpp index d3b21fd..91ec048 100644 --- a/test/Modules/merge-decl-order.cpp +++ b/test/Modules/merge-decl-order.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/merge-decl-order -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/merge-decl-order -verify %s // expected-no-diagnostics // Check that we include all decls from 'a' before the decls from 'b' in foo's diff --git a/test/Modules/merge-dependent-friends.cpp b/test/Modules/merge-dependent-friends.cpp index 0b0c903..9dfcb19 100644 --- a/test/Modules/merge-dependent-friends.cpp +++ b/test/Modules/merge-dependent-friends.cpp @@ -1,4 +1,4 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/merge-dependent-friends -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/merge-dependent-friends -verify %s // expected-no-diagnostics #include "d.h" diff --git a/test/Modules/merge-enumerators.cpp b/test/Modules/merge-enumerators.cpp new file mode 100644 index 0000000..34a4ec9 --- /dev/null +++ b/test/Modules/merge-enumerators.cpp @@ -0,0 +1,11 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo 'namespace N { enum E { A }; }' > %t/a.h +// RUN: echo '#include "a.h"' > %t/b.h +// RUN: touch %t/x.h +// RUN: echo 'module B { module b { header "b.h" } module x { header "x.h" } }' > %t/b.modulemap +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x c++ -fmodule-map-file=%t/b.modulemap %s -I%t -verify +// expected-no-diagnostics +#include "a.h" +#include "x.h" +N::E e = N::A; diff --git a/test/Modules/merge-friends.cpp b/test/Modules/merge-friends.cpp index 8284bfe..0aff929 100644 --- a/test/Modules/merge-friends.cpp +++ b/test/Modules/merge-friends.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/merge-friends -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/merge-friends -verify %s // expected-no-diagnostics #include "friend.h" N::foo *use; diff --git a/test/Modules/merge-implicit-special-members.cpp b/test/Modules/merge-implicit-special-members.cpp index a8b917c..eb1fccd 100644 --- a/test/Modules/merge-implicit-special-members.cpp +++ b/test/Modules/merge-implicit-special-members.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/merge-implicit-special-members -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/merge-implicit-special-members -verify %s // expected-no-diagnostics #include "c.h" int n = pthread_mutex_t().lock; diff --git a/test/Modules/merge-name-for-linkage.cpp b/test/Modules/merge-name-for-linkage.cpp index 1700b61..da1664c 100644 --- a/test/Modules/merge-name-for-linkage.cpp +++ b/test/Modules/merge-name-for-linkage.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/merge-name-for-linkage -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/merge-name-for-linkage -verify %s // expected-no-diagnostics typedef union {} pthread_mutex_t; #include "a.h" diff --git a/test/Modules/merge-nested-templates.cpp b/test/Modules/merge-nested-templates.cpp index 42764ea..3abb2bb 100644 --- a/test/Modules/merge-nested-templates.cpp +++ b/test/Modules/merge-nested-templates.cpp @@ -1,4 +1,4 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/merge-nested-templates -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/merge-nested-templates -verify %s // expected-no-diagnostics #include "c.h" diff --git a/test/Modules/merge-target-features.cpp b/test/Modules/merge-target-features.cpp index ccf3aab..8b82c8a 100644 --- a/test/Modules/merge-target-features.cpp +++ b/test/Modules/merge-target-features.cpp @@ -3,7 +3,7 @@ // // RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \ // RUN: -iquote Inputs/merge-target-features \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -fmodule-map-file-home-is-cwd \ // RUN: -emit-module -fmodule-name=foo -o %t/foo.pcm \ // RUN: -triple i386-unknown-unknown \ @@ -12,7 +12,7 @@ // // RUN: not %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \ // RUN: -iquote Inputs/merge-target-features \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -fmodule-map-file-home-is-cwd \ // RUN: -fmodule-map-file=Inputs/merge-target-features/module.modulemap \ // RUN: -fmodule-file=%t/foo.pcm \ @@ -24,7 +24,7 @@ // // RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \ // RUN: -iquote Inputs/merge-target-features \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -fmodule-map-file-home-is-cwd \ // RUN: -fmodule-map-file=Inputs/merge-target-features/module.modulemap \ // RUN: -fmodule-file=%t/foo.pcm \ @@ -36,7 +36,7 @@ // // RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \ // RUN: -iquote Inputs/merge-target-features \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -fmodule-map-file-home-is-cwd \ // RUN: -fmodule-map-file=Inputs/merge-target-features/module.modulemap \ // RUN: -fmodule-file=%t/foo.pcm \ @@ -48,7 +48,7 @@ // // RUN: not %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \ // RUN: -iquote Inputs/merge-target-features \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -fmodule-map-file-home-is-cwd \ // RUN: -fmodule-map-file=Inputs/merge-target-features/module.modulemap \ // RUN: -fmodule-file=%t/foo.pcm \ diff --git a/test/Modules/merge-template-friend.cpp b/test/Modules/merge-template-friend.cpp index 8a1910d..37508a6 100644 --- a/test/Modules/merge-template-friend.cpp +++ b/test/Modules/merge-template-friend.cpp @@ -1,14 +1,14 @@ // RUN: rm -rf %t // -// RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x c++ -fmodules-cache-path=%t \ // RUN: -emit-module -fmodule-name=a -o %t/a.pcm \ // RUN: %S/Inputs/merge-template-friend/module.modulemap // -// RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x c++ -fmodules-cache-path=%t \ // RUN: -emit-module -fmodule-name=b -o %t/b.pcm \ // RUN: %S/Inputs/merge-template-friend/module.modulemap // -// RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x c++ -fmodules-cache-path=%t \ // RUN: -I%S/Inputs/merge-template-friend \ // RUN: -fmodule-file=%t/a.pcm \ // RUN: -fmodule-file=%t/b.pcm \ diff --git a/test/Modules/merge-template-members.cpp b/test/Modules/merge-template-members.cpp index 1fdaa9c..88f5fc6 100644 --- a/test/Modules/merge-template-members.cpp +++ b/test/Modules/merge-template-members.cpp @@ -1,7 +1,7 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/merge-template-members -verify -emit-llvm-only %s -DTEST=1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/merge-template-members -verify -emit-llvm-only %s -DTEST=2 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/merge-template-members -verify -emit-llvm-only %s -DTEST=3 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/merge-template-members -verify -emit-llvm-only %s -DTEST=1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/merge-template-members -verify -emit-llvm-only %s -DTEST=2 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/merge-template-members -verify -emit-llvm-only %s -DTEST=3 // expected-no-diagnostics #if TEST == 1 diff --git a/test/Modules/merge-typedefs.cpp b/test/Modules/merge-typedefs.cpp index 607f8c5..da92a09 100644 --- a/test/Modules/merge-typedefs.cpp +++ b/test/Modules/merge-typedefs.cpp @@ -1,6 +1,6 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -x c++ -I%S/Inputs/merge-typedefs -verify %s -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-typedefs -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-typedefs -verify %s #include "b2.h" #include "a1.h" diff --git a/test/Modules/merge-using-decls.cpp b/test/Modules/merge-using-decls.cpp index 3b84d0e..789f75b 100644 --- a/test/Modules/merge-using-decls.cpp +++ b/test/Modules/merge-using-decls.cpp @@ -1,6 +1,6 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify %s -DORDER=1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify %s -DORDER=2 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify %s -DORDER=1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify %s -DORDER=2 #if ORDER == 1 #include "a.h" diff --git a/test/Modules/merge-vtable-codegen.cpp b/test/Modules/merge-vtable-codegen.cpp index 7372073..3c9299c 100644 --- a/test/Modules/merge-vtable-codegen.cpp +++ b/test/Modules/merge-vtable-codegen.cpp @@ -1,15 +1,15 @@ // RUN: rm -rf %t // First, build two modules that both re-export the same header. -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodule-name=b -o %t/b.pcm -fmodule-maps \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-name=b -o %t/b.pcm \ // RUN: -emit-module %S/Inputs/merge-vtable-codegen/merge-vtable-codegen.modulemap \ // RUN: -I %S/Inputs/merge-vtable-codegen -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodule-name=c -o %t/c.pcm -fmodule-maps \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-name=c -o %t/c.pcm \ // RUN: -emit-module %S/Inputs/merge-vtable-codegen/merge-vtable-codegen.modulemap \ // RUN: -I %S/Inputs/merge-vtable-codegen // Use the two modules in a single compile. -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodule-file=%t/b.pcm -fmodule-file=%t/c.pcm \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-file=%t/b.pcm -fmodule-file=%t/c.pcm \ // RUN: -fmodule-map-file=%S/Inputs/merge-vtable-codegen/merge-vtable-codegen.modulemap \ // RUN: -emit-llvm -o %t/test.o %s diff --git a/test/Modules/method_pool.m b/test/Modules/method_pool.m index f7d5ae7..1d76a84 100644 --- a/test/Modules/method_pool.m +++ b/test/Modules/method_pool.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -I %S/Inputs %s -verify +// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs %s -verify @import MethodPoolA; diff --git a/test/Modules/missing-header.m b/test/Modules/missing-header.m index c2c1673..d865078 100644 --- a/test/Modules/missing-header.m +++ b/test/Modules/missing-header.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: not %clang_cc1 -x objective-c -fmodules-cache-path=%t -fmodules -I %S/Inputs/submodules %s 2>&1 | FileCheck %s +// RUN: not %clang_cc1 -x objective-c -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/submodules %s 2>&1 | FileCheck %s // FIXME: cannot use -verify, because the error from inside the module build has // a different source manager than the verifier. diff --git a/test/Modules/missing-submodule.m b/test/Modules/missing-submodule.m index 4f3553c..4586ce6 100644 --- a/test/Modules/missing-submodule.m +++ b/test/Modules/missing-submodule.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -F %S/Inputs %s -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -F %S/Inputs %s -verify #include <Module/NotInModule.h> // expected-warning{{missing submodule 'Module.NotInModule'}} int getNotInModule() { diff --git a/test/Modules/modify-module.m b/test/Modules/modify-module.m index 953c917..f9a70b2 100644 --- a/test/Modules/modify-module.m +++ b/test/Modules/modify-module.m @@ -6,15 +6,15 @@ // RUN: cp %S/Inputs/Modified/A.h %t/include // RUN: cp %S/Inputs/Modified/B.h %t/include // RUN: cp %S/Inputs/Modified/module.map %t/include -// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/cache -fmodules -I %t/include %s -verify +// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/cache -fmodules -fimplicit-module-maps -I %t/include %s -verify // RUN: echo '' >> %t/include/B.h -// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/cache -fmodules -I %t/include %s -verify +// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/cache -fmodules -fimplicit-module-maps -I %t/include %s -verify // RUN: echo 'int getA(); int getA2();' > %t/include/A.h -// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/cache -fmodules -I %t/include %s -verify +// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/cache -fmodules -fimplicit-module-maps -I %t/include %s -verify // RUN: rm %t/cache/ModA.pcm -// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/cache -fmodules -I %t/include %s -verify +// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/cache -fmodules -fimplicit-module-maps -I %t/include %s -verify // RUN: touch %t/cache/ModA.pcm -// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/cache -fmodules -I %t/include %s -verify +// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/cache -fmodules -fimplicit-module-maps -I %t/include %s -verify // expected-no-diagnostics diff --git a/test/Modules/modular_maps.cpp b/test/Modules/modular_maps.cpp index bedf2e0..3b6afc7 100644 --- a/test/Modules/modular_maps.cpp +++ b/test/Modules/modular_maps.cpp @@ -1,15 +1,15 @@ // RUN: rm -rf %t // -// RxN: %clang_cc1 -x objective-c++ -fmodules-cache-path=%t -fmodules -fmodule-map-file=%S/Inputs/modular_maps/modulea.map -fmodule-map-file=%S/Inputs/modular_maps/modulec.map -I %S/Inputs/modular_maps %s -verify -// RxN: %clang_cc1 -x objective-c++ -fmodules-cache-path=%t -fmodules -fmodule-map-file=%S/Inputs/modular_maps/modulec.map -fmodule-map-file=%S/Inputs/modular_maps/modulea.map -I %S/Inputs/modular_maps %s -verify +// RUN: %clang_cc1 -x objective-c++ -fmodules-cache-path=%t -fmodules -fmodule-map-file=%S/Inputs/modular_maps/modulea.map -fmodule-map-file=%S/Inputs/modular_maps/modulec.map -I %S/Inputs/modular_maps %s -verify +// RUN: %clang_cc1 -x objective-c++ -fmodules-cache-path=%t -fmodules -fmodule-map-file=%S/Inputs/modular_maps/modulec.map -fmodule-map-file=%S/Inputs/modular_maps/modulea.map -I %S/Inputs/modular_maps %s -verify // -// RxN: cd %S -// RxN: %clang_cc1 -x objective-c++ -fmodules-cache-path=%t -fmodules -fmodule-map-file=Inputs/modular_maps/modulea.map -fmodule-map-file=Inputs/modular_maps/modulec.map -I Inputs/modular_maps %s -verify -// RxN: %clang_cc1 -x objective-c++ -fmodules-cache-path=%t -fmodules -fmodule-map-file=Inputs/modular_maps/modulec.map -fmodule-map-file=Inputs/modular_maps/modulea.map -I Inputs/modular_maps %s -verify +// RUN: cd %S +// RUN: %clang_cc1 -x objective-c++ -fmodules-cache-path=%t -fmodules -fmodule-map-file=Inputs/modular_maps/modulea.map -fmodule-map-file=Inputs/modular_maps/modulec.map -I Inputs/modular_maps %s -verify +// RUN: %clang_cc1 -x objective-c++ -fmodules-cache-path=%t -fmodules -fmodule-map-file=Inputs/modular_maps/modulec.map -fmodule-map-file=Inputs/modular_maps/modulea.map -I Inputs/modular_maps %s -verify // // RUN: cd %S // RUN: %clang_cc1 -x objective-c++ -fmodules-cache-path=%t -fmodules -fmodule-map-file=Inputs/modular_maps/modulea-cwd.map -fmodule-map-file=Inputs/modular_maps/modulec-cwd.map -I Inputs/modular_maps %s -verify -fmodule-map-file-home-is-cwd -// RxN: %clang_cc1 -x objective-c++ -fmodules-cache-path=%t -fmodules -fmodule-map-file=Inputs/modular_maps/modulec-cwd.map -fmodule-map-file=Inputs/modular_maps/modulea-cwd.map -I Inputs/modular_maps %s -verify -fmodule-map-file-home-is-cwd +// RUN: %clang_cc1 -x objective-c++ -fmodules-cache-path=%t -fmodules -fmodule-map-file=Inputs/modular_maps/modulec-cwd.map -fmodule-map-file=Inputs/modular_maps/modulea-cwd.map -I Inputs/modular_maps %s -verify -fmodule-map-file-home-is-cwd #include "common.h" #include "a.h" diff --git a/test/Modules/module-private.cpp b/test/Modules/module-private.cpp index 9213a0f..6e723c8 100644 --- a/test/Modules/module-private.cpp +++ b/test/Modules/module-private.cpp @@ -1,7 +1,7 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodules-cache-path=%t -fmodule-name=module_private_left -emit-module %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodules-cache-path=%t -fmodule-name=module_private_right -emit-module %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodules-cache-path=%t -I %S/Inputs %s -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c++ -fmodules-cache-path=%t -fmodule-name=module_private_left -emit-module %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c++ -fmodules-cache-path=%t -fmodule-name=module_private_right -emit-module %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c++ -fmodules-cache-path=%t -I %S/Inputs %s -verify // FIXME: When we have a syntax for modules in C++, use that. @import module_private_left; @@ -14,7 +14,7 @@ void test() { int test_broken() { HiddenStruct hidden; // \ // expected-error{{must use 'struct' tag to refer to type 'HiddenStruct' in this scope}} \ - // expected-error{{definition of 'struct HiddenStruct' must be imported}} + // expected-error{{definition of 'HiddenStruct' must be imported}} // expected-note@Inputs/module_private_left.h:3 {{previous definition is here}} Integer i; // expected-error{{unknown type name 'Integer'}} diff --git a/test/Modules/module_file_info.m b/test/Modules/module_file_info.m index 1b0a838..01d5073 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 -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 %s // RUN: %clang_cc1 -module-file-info %t/DependsOnModule.pcm | FileCheck %s // CHECK: Generated by this Clang: diff --git a/test/Modules/modulemap-locations.m b/test/Modules/modulemap-locations.m index 949c478..3c80db5 100644 --- a/test/Modules/modulemap-locations.m +++ b/test/Modules/modulemap-locations.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs/ModuleMapLocations/Module_ModuleMap -I %S/Inputs/ModuleMapLocations/Both -F %S/Inputs/ModuleMapLocations -I %S/Inputs/ModuleMapLocations -F %S/Inputs -x objective-c -fsyntax-only %s -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/ModuleMapLocations/Module_ModuleMap -I %S/Inputs/ModuleMapLocations/Both -F %S/Inputs/ModuleMapLocations -I %S/Inputs/ModuleMapLocations -F %S/Inputs -x objective-c -fsyntax-only %s -verify // regular @import module_modulemap; diff --git a/test/Modules/modules-with-same-name.m b/test/Modules/modules-with-same-name.m index d362f75..b5cb6fa 100644 --- a/test/Modules/modules-with-same-name.m +++ b/test/Modules/modules-with-same-name.m @@ -1,22 +1,22 @@ // RUN: rm -rf %t // A from path 1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodules-ignore-macro=EXPECTED_PATH -fmodules-ignore-macro=DIRECT -fsyntax-only %s -verify -I %S/Inputs/modules-with-same-name/path1/A -DDIRECT -DEXPECTED_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/path1/A -DDIRECT -DEXPECTED_PATH=1 // A from path 2 -// RUN: %clang_cc1 -fmodules -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 +// 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 // DependsOnA, using A from path 1 -// RUN: %clang_cc1 -fmodules -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 +// 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 // DependsOnA, using A from path 2 -// RUN: %clang_cc1 -fmodules -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 +// 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 diff --git a/test/Modules/namespaces.cpp b/test/Modules/namespaces.cpp index a6f4c25..5c0e183 100644 --- a/test/Modules/namespaces.cpp +++ b/test/Modules/namespaces.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify +// RUN: %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify int &global(int); int &global2(int); diff --git a/test/Modules/no-implicit-builds.cpp b/test/Modules/no-implicit-builds.cpp index d9e8fa1..bfc3562 100644 --- a/test/Modules/no-implicit-builds.cpp +++ b/test/Modules/no-implicit-builds.cpp @@ -1,12 +1,12 @@ // RUN: rm -rf %t // Produce an error if a module is needed, but not found. -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ // RUN: -fmodule-map-file=%S/Inputs/no-implicit-builds/b.modulemap \ // RUN: -fno-implicit-modules %s -verify // Compile the module and put it into the cache. -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ // RUN: -fmodule-map-file=%S/Inputs/no-implicit-builds/b.modulemap \ // RUN: %s -Rmodule-build 2>&1 | FileCheck --check-prefix=CHECK-CACHE-BUILD %s // CHECK-CACHE-BUILD: {{building module 'b'}} @@ -14,19 +14,19 @@ // Produce an error if a module is found in the cache but implicit modules is off. // Note that the command line must match the command line for the first check, otherwise // this check might not find the module in the cache and trivially succeed. -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ // RUN: -fmodule-map-file=%S/Inputs/no-implicit-builds/b.modulemap \ // RUN: %s -Rmodule-build -fno-implicit-modules -verify // Verify that we can still pass the module via -fmodule-file when implicit modules // are switched off: // - First, explicitly compile the module: -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodule-name=b -o %t/b.pcm \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-name=b -o %t/b.pcm \ // RUN: -emit-module %S/Inputs/no-implicit-builds/b.modulemap \ // RUN: -fno-implicit-modules // // - Next, verify that we can load it: -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodule-file=%t/b.pcm \ +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-file=%t/b.pcm \ // RUN: -fmodule-map-file=%S/Inputs/no-implicit-builds/b.modulemap \ // RUN: -fno-implicit-modules %s diff --git a/test/Modules/no-implicit-maps.cpp b/test/Modules/no-implicit-maps.cpp index cb270a0..ddcad5d 100644 --- a/test/Modules/no-implicit-maps.cpp +++ b/test/Modules/no-implicit-maps.cpp @@ -1,3 +1,3 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c -fno-modules-implicit-maps -fmodules-cache-path=%t -fmodules -I %S/Inputs/private %s -verify +// RUN: %clang_cc1 -x objective-c -fmodules-cache-path=%t -fmodules -I %S/Inputs/private %s -verify @import libPrivate1; // expected-error {{not found}} diff --git a/test/Modules/no-stale-modtime.m b/test/Modules/no-stale-modtime.m index 5351212..b90daf1 100644 --- a/test/Modules/no-stale-modtime.m +++ b/test/Modules/no-stale-modtime.m @@ -11,18 +11,18 @@ // RUN: echo 'module b { header "b.h" } module l { header "l.h" }' > %t/module.map // RUN: echo 'module r { header "r.h" } module t { header "t.h" }' >> %t/module.map -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \ // RUN: -I %t -fsyntax-only %s -Rmodule-build 2>&1 \ // RUN: | FileCheck -check-prefix=REBUILD-ALL %s -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \ // RUN: -I %t -fsyntax-only %s -Rmodule-build -verify // Add an identifier to ensure everything depending on t is out of date // RUN: echo 'extern int a;' >> %t/t.h -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \ // RUN: -I %t -fsyntax-only %s -Rmodule-build 2>&1 \ // RUN: | FileCheck -check-prefix=REBUILD-ALL %s -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \ // RUN: -I %t -fsyntax-only %s -Rmodule-build -verify // REBUILD-ALL: building module 'b' diff --git a/test/Modules/normal-module-map.cpp b/test/Modules/normal-module-map.cpp index 70fed60..5db1f3f 100644 --- a/test/Modules/normal-module-map.cpp +++ b/test/Modules/normal-module-map.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c -fmodules-cache-path=%t -fmodules -I %S/Inputs/normal-module-map %s -verify +// RUN: %clang_cc1 -x objective-c -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/normal-module-map %s -verify #include "Umbrella/umbrella_sub.h" int getUmbrella() { diff --git a/test/Modules/objc-categories.m b/test/Modules/objc-categories.m index a66ab8d..e8549fa 100644 --- a/test/Modules/objc-categories.m +++ b/test/Modules/objc-categories.m @@ -1,10 +1,10 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x objective-c -fmodule-name=category_top -emit-module %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x objective-c -fmodule-name=category_left -emit-module %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x objective-c -fmodule-name=category_right -emit-module %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x objective-c -fmodule-name=category_bottom -emit-module %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x objective-c -fmodule-name=category_other -emit-module %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x objective-c -fmodule-name=category_top -emit-module %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x objective-c -fmodule-name=category_left -emit-module %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x objective-c -fmodule-name=category_right -emit-module %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x objective-c -fmodule-name=category_bottom -emit-module %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x objective-c -fmodule-name=category_other -emit-module %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify @import category_bottom; diff --git a/test/Modules/objc_redef.m b/test/Modules/objc_redef.m index 28e4766..2e57f41 100644 --- a/test/Modules/objc_redef.m +++ b/test/Modules/objc_redef.m @@ -6,8 +6,8 @@ int test(id x) { } // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=redeclarations_left %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=weird_objc %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=redeclarations_left %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=weird_objc %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify // expected-no-diagnostics diff --git a/test/Modules/odr.cpp b/test/Modules/odr.cpp index 4ac257c..3014396 100644 --- a/test/Modules/odr.cpp +++ b/test/Modules/odr.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs/odr %s -verify -std=c++11 +// RUN: %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/odr %s -verify -std=c++11 // expected-error@a.h:8 {{'X::n' from module 'a' is not present in definition of 'X' provided earlier}} struct X { // expected-note {{definition has no member 'n'}} diff --git a/test/Modules/on-demand-build.m b/test/Modules/on-demand-build.m index e958759..f84245c 100644 --- a/test/Modules/on-demand-build.m +++ b/test/Modules/on-demand-build.m @@ -1,7 +1,7 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fno-objc-infer-related-result-type -Werror -Wno-error=incomplete-umbrella -fmodules-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 -x objective-c++ -fmodules-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 -fmodules-cache-path=%t -F %S/Inputs -I %S/Inputs -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fno-objc-infer-related-result-type -Werror -Wno-error=incomplete-umbrella -fmodules-cache-path=%t -F %S/Inputs -I %S/Inputs -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fno-objc-infer-related-result-type -Werror -Wno-error=incomplete-umbrella -x objective-c++ -fmodules-cache-path=%t -F %S/Inputs -I %S/Inputs -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fno-objc-infer-related-result-type -Werror -Wno-error=incomplete-umbrella -fmodules-cache-path=%t -F %S/Inputs -I %S/Inputs -verify %s #define FOO @import Module; @interface OtherClass diff --git a/test/Modules/on-demand-macros.m b/test/Modules/on-demand-macros.m index 3c16fa7..d179122 100644 --- a/test/Modules/on-demand-macros.m +++ b/test/Modules/on-demand-macros.m @@ -1,6 +1,6 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -F %S/Inputs -DFOO_RETURNS_INT_PTR -verify %s -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -F %S/Inputs -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -F %S/Inputs -DFOO_RETURNS_INT_PTR -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -F %S/Inputs -verify %s // expected-no-diagnostics @import CmdLine; diff --git a/test/Modules/pch-used.m b/test/Modules/pch-used.m index 74f21f5..cdfadb2 100644 --- a/test/Modules/pch-used.m +++ b/test/Modules/pch-used.m @@ -1,7 +1,7 @@ // RUN: rm -rf %t // RUN: mkdir %t -// RUN: %clang_cc1 -x objective-c-header -emit-pch %S/Inputs/pch-used.h -o %t/pch-used.h.pch -fmodules -fmodules-cache-path=%t/cache -O0 -isystem %S/Inputs/System/usr/include -// RUN: %clang_cc1 %s -include-pch %t/pch-used.h.pch -fmodules -fmodules-cache-path=%t/cache -O0 -isystem %S/Inputs/System/usr/include -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -x objective-c-header -emit-pch %S/Inputs/pch-used.h -o %t/pch-used.h.pch -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache -O0 -isystem %S/Inputs/System/usr/include +// RUN: %clang_cc1 %s -include-pch %t/pch-used.h.pch -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache -O0 -isystem %S/Inputs/System/usr/include -emit-llvm -o - | FileCheck %s void f() { SPXTrace(); } void g() { double x = DBL_MAX; } diff --git a/test/Modules/pr19692.cpp b/test/Modules/pr19692.cpp index 6cc5153..72829ad 100644 --- a/test/Modules/pr19692.cpp +++ b/test/Modules/pr19692.cpp @@ -1,6 +1,6 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -I%S/Inputs/pr19692 -verify %s -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/pr19692 -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/pr19692 -verify %s #include "TFoo.h" #include "stdint.h" diff --git a/test/Modules/pr20399.cpp b/test/Modules/pr20399.cpp index 4f4a025..4195f50 100644 --- a/test/Modules/pr20399.cpp +++ b/test/Modules/pr20399.cpp @@ -1,2 +1,2 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodule-name=libGdml -emit-module -x c++ -std=c++11 %S/Inputs/PR20399/module.modulemap +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fmodule-name=libGdml -emit-module -x c++ -std=c++11 %S/Inputs/PR20399/module.modulemap diff --git a/test/Modules/pr20786.cpp b/test/Modules/pr20786.cpp index 4c0426e..47e5b6c 100644 --- a/test/Modules/pr20786.cpp +++ b/test/Modules/pr20786.cpp @@ -1,2 +1,2 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodule-name=TBranchProxy -emit-module -x c++ %S/Inputs/PR20786/module.modulemap +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fmodule-name=TBranchProxy -emit-module -x c++ %S/Inputs/PR20786/module.modulemap diff --git a/test/Modules/pr21687.cpp b/test/Modules/pr21687.cpp index ad67489..51eb47d 100644 --- a/test/Modules/pr21687.cpp +++ b/test/Modules/pr21687.cpp @@ -1,3 +1,3 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/PR21687 -emit-llvm-only %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/PR21687 -emit-llvm-only %s #include "c.h" diff --git a/test/Modules/preprocess.m b/test/Modules/preprocess.m index 9b563fe..8d740d1 100644 --- a/test/Modules/preprocess.m +++ b/test/Modules/preprocess.m @@ -1,11 +1,11 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs -I %S/Inputs/preprocess -include %S/Inputs/preprocess-prefix.h -E %s | FileCheck -strict-whitespace %s -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs -I %S/Inputs/preprocess -x objective-c-header -emit-pch %S/Inputs/preprocess-prefix.h -o %t.pch -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs -I %S/Inputs/preprocess -include-pch %t.pch -E %s | FileCheck -strict-whitespace %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -I %S/Inputs/preprocess -include %S/Inputs/preprocess-prefix.h -E %s | FileCheck -strict-whitespace %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -I %S/Inputs/preprocess -x objective-c-header -emit-pch %S/Inputs/preprocess-prefix.h -o %t.pch +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -I %S/Inputs/preprocess -include-pch %t.pch -E %s | FileCheck -strict-whitespace %s // -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs -I %S/Inputs/preprocess -x objective-c++ -include %S/Inputs/preprocess-prefix.h -E %s | FileCheck -strict-whitespace %s -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs -I %S/Inputs/preprocess -x objective-c++-header -emit-pch %S/Inputs/preprocess-prefix.h -o %t.pch -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs -I %S/Inputs/preprocess -x objective-c++ -include-pch %t.pch -E %s | FileCheck -strict-whitespace %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -I %S/Inputs/preprocess -x objective-c++ -include %S/Inputs/preprocess-prefix.h -E %s | FileCheck -strict-whitespace %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -I %S/Inputs/preprocess -x objective-c++-header -emit-pch %S/Inputs/preprocess-prefix.h -o %t.pch +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -I %S/Inputs/preprocess -x objective-c++ -include-pch %t.pch -E %s | FileCheck -strict-whitespace %s #import "diamond_right.h" #import "diamond_right.h" // to check that imports get their own line #include "file.h" diff --git a/test/Modules/private.cpp b/test/Modules/private.cpp index 31e60e4..52812b3 100644 --- a/test/Modules/private.cpp +++ b/test/Modules/private.cpp @@ -1,6 +1,6 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c -fmodules-cache-path=%t -fmodules -I %S/Inputs/private %s -verify -// RUN: %clang_cc1 -x objective-c -fmodules-cache-path=%t -fmodules -I %S/Inputs/private %s -fsyntax-only -Wno-private-header +// RUN: %clang_cc1 -x objective-c -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/private %s -verify +// RUN: %clang_cc1 -x objective-c -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/private %s -fsyntax-only -Wno-private-header #include "common.h" @import libPrivate1; diff --git a/test/Modules/private1.cpp b/test/Modules/private1.cpp index 811a233..f3be826 100644 --- a/test/Modules/private1.cpp +++ b/test/Modules/private1.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c -fmodules-cache-path=%t -fmodules -I %S/Inputs/private0 -I %S/Inputs/private1 -I %S/Inputs/private2 %s -verify +// RUN: %clang_cc1 -x objective-c -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/private0 -I %S/Inputs/private1 -I %S/Inputs/private2 %s -verify #include "common.h" @import libPrivateN2; diff --git a/test/Modules/prune.m b/test/Modules/prune.m index 7bc771f..6676407 100644 --- a/test/Modules/prune.m +++ b/test/Modules/prune.m @@ -11,8 +11,8 @@ // Clear out the module cache // RUN: rm -rf %t // Run Clang twice so we end up creating the timestamp file (the second time). -// RUN: %clang_cc1 -DIMPORT_DEPENDS_ON_MODULE -fmodules-ignore-macro=DIMPORT_DEPENDS_ON_MODULE -fmodules -F %S/Inputs -fmodules-cache-path=%t %s -verify -// RUN: %clang_cc1 -DIMPORT_DEPENDS_ON_MODULE -fmodules-ignore-macro=DIMPORT_DEPENDS_ON_MODULE -fmodules -F %S/Inputs -fmodules-cache-path=%t %s -verify +// RUN: %clang_cc1 -DIMPORT_DEPENDS_ON_MODULE -fmodules-ignore-macro=DIMPORT_DEPENDS_ON_MODULE -fmodules -fimplicit-module-maps -F %S/Inputs -fmodules-cache-path=%t %s -verify +// RUN: %clang_cc1 -DIMPORT_DEPENDS_ON_MODULE -fmodules-ignore-macro=DIMPORT_DEPENDS_ON_MODULE -fmodules -fimplicit-module-maps -F %S/Inputs -fmodules-cache-path=%t %s -verify // RUN: ls %t | grep modules.timestamp // RUN: ls -R %t | grep ^Module.*pcm // RUN: ls -R %t | grep DependsOnModule.*pcm @@ -20,7 +20,7 @@ // Set the timestamp back more than two days. We should try to prune, // but nothing gets pruned because the module files are new enough. // RUN: touch -m -a -t 201101010000 %t/modules.timestamp -// RUN: %clang_cc1 -fmodules -F %S/Inputs -fmodules-cache-path=%t -fmodules -fmodules-prune-interval=172800 -fmodules-prune-after=345600 %s -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -F %S/Inputs -fmodules-cache-path=%t -fmodules -fmodules-prune-interval=172800 -fmodules-prune-after=345600 %s -verify // RUN: ls %t | grep modules.timestamp // RUN: ls -R %t | grep ^Module.*pcm // RUN: ls -R %t | grep DependsOnModule.*pcm @@ -29,7 +29,7 @@ // This shouldn't prune anything, because the timestamp has been updated, so // the pruning mechanism won't fire. // RUN: find %t -name DependsOnModule*.pcm | xargs touch -a -t 201101010000 -// RUN: %clang_cc1 -fmodules -F %S/Inputs -fmodules-cache-path=%t -fmodules -fmodules-prune-interval=172800 -fmodules-prune-after=345600 %s -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -F %S/Inputs -fmodules-cache-path=%t -fmodules -fmodules-prune-interval=172800 -fmodules-prune-after=345600 %s -verify // RUN: ls %t | grep modules.timestamp // RUN: ls -R %t | grep ^Module.*pcm // RUN: ls -R %t | grep DependsOnModule.*pcm @@ -38,7 +38,7 @@ // This should trigger pruning, which will remove DependsOnModule but not Module. // RUN: touch -m -a -t 201101010000 %t/modules.timestamp // RUN: find %t -name DependsOnModule*.pcm | xargs touch -a -t 201101010000 -// RUN: %clang_cc1 -fmodules -F %S/Inputs -fmodules-cache-path=%t -fmodules -fmodules-prune-interval=172800 -fmodules-prune-after=345600 %s -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -F %S/Inputs -fmodules-cache-path=%t -fmodules -fmodules-prune-interval=172800 -fmodules-prune-after=345600 %s -verify // RUN: ls %t | grep modules.timestamp // RUN: ls -R %t | grep ^Module.*pcm // RUN: ls -R %t | not grep DependsOnModule.*pcm diff --git a/test/Modules/rebuild.m b/test/Modules/rebuild.m index 4d4d055..40f2d47 100644 --- a/test/Modules/rebuild.m +++ b/test/Modules/rebuild.m @@ -1,19 +1,19 @@ // RUN: rm -rf %t // Build Module and set its timestamp -// RUN: echo '@import Module;' | %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash -fsyntax-only -F %S/Inputs -x objective-c - +// RUN: echo '@import Module;' | %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash -fsyntax-only -F %S/Inputs -x objective-c - // RUN: touch -m -a -t 201101010000 %t/Module.pcm // RUN: cp %t/Module.pcm %t/Module.pcm.saved // RUN: wc -c %t/Module.pcm > %t/Module.size.saved // Build DependsOnModule -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash -fsyntax-only -F %S/Inputs %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash -fsyntax-only -F %S/Inputs %s // RUN: diff %t/Module.pcm %t/Module.pcm.saved // RUN: cp %t/DependsOnModule.pcm %t/DependsOnModule.pcm.saved // Rebuild Module, reset its timestamp, and verify its size hasn't changed // RUN: rm %t/Module.pcm -// RUN: echo '@import Module;' | %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash -fsyntax-only -F %S/Inputs -x objective-c - +// RUN: echo '@import Module;' | %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash -fsyntax-only -F %S/Inputs -x objective-c - // RUN: touch -m -a -t 201101010000 %t/Module.pcm // RUN: wc -c %t/Module.pcm > %t/Module.size // RUN: diff %t/Module.size %t/Module.size.saved @@ -21,13 +21,13 @@ // But the signature at least is expected to change, so we rebuild DependsOnModule. // NOTE: if we change how the signature is created, this test may need updating. -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash -fsyntax-only -F %S/Inputs %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash -fsyntax-only -F %S/Inputs %s // RUN: diff %t/Module.pcm %t/Module.pcm.saved.2 // RUN: not diff %t/DependsOnModule.pcm %t/DependsOnModule.pcm.saved // Rebuild Module, reset its timestamp, and verify its size hasn't changed // RUN: rm %t/Module.pcm -// RUN: echo '@import Module;' | %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash -fsyntax-only -F %S/Inputs -x objective-c - +// RUN: echo '@import Module;' | %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash -fsyntax-only -F %S/Inputs -x objective-c - // RUN: touch -m -a -t 201101010000 %t/Module.pcm // RUN: wc -c %t/Module.pcm > %t/Module.size // RUN: diff %t/Module.size %t/Module.size.saved @@ -35,7 +35,7 @@ // Verify again with Module pre-imported. // NOTE: if we change how the signature is created, this test may need updating. -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash -fsyntax-only -F %S/Inputs %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash -fsyntax-only -F %S/Inputs %s // RUN: diff %t/Module.pcm %t/Module.pcm.saved.2 // RUN: not diff %t/DependsOnModule.pcm %t/DependsOnModule.pcm.saved diff --git a/test/Modules/recursive.c b/test/Modules/recursive.c index 5315b10..9c03a6a 100644 --- a/test/Modules/recursive.c +++ b/test/Modules/recursive.c @@ -1,9 +1,9 @@ // RUN: rm -rf %t -// RUN: not %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -I %S/Inputs %s 2>&1 | FileCheck %s +// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -I %S/Inputs %s 2>&1 | FileCheck %s #include "recursive1.h" // RUN: rm -rf %t -// RUN: not %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=recursive1 %S/Inputs/module.map 2>&1 | FileCheck %s +// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=recursive1 %S/Inputs/module.map 2>&1 | FileCheck %s // CHECK: While building module 'recursive1'{{( imported from .*[/\]recursive.c:3)?}}: // CHECK-NEXT: While building module 'recursive2' imported from {{.*Inputs[/\]}}recursive1.h:1: diff --git a/test/Modules/recursive_visibility.mm b/test/Modules/recursive_visibility.mm index f37410a..12894f3 100644 --- a/test/Modules/recursive_visibility.mm +++ b/test/Modules/recursive_visibility.mm @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 +// RUN: %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 // expected-no-diagnostics diff --git a/test/Modules/redecl-add-after-load.cpp b/test/Modules/redecl-add-after-load.cpp index 8ca70ad..f888460 100644 --- a/test/Modules/redecl-add-after-load.cpp +++ b/test/Modules/redecl-add-after-load.cpp @@ -1,6 +1,6 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c++ -fmodules -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 -// RUN: %clang_cc1 -x objective-c++ -fmodules -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 -DIMPORT_DECLS +// RUN: %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 +// RUN: %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 -DIMPORT_DECLS // expected-no-diagnostics diff --git a/test/Modules/redecl-found-building-chains.cpp b/test/Modules/redecl-found-building-chains.cpp index 1173863..91524fb 100644 --- a/test/Modules/redecl-found-building-chains.cpp +++ b/test/Modules/redecl-found-building-chains.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/redecl-found-building-chains -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/redecl-found-building-chains -verify %s // expected-no-diagnostics int n, m; #include "d.h" diff --git a/test/Modules/redecl-merge.m b/test/Modules/redecl-merge.m index 37e5967..59a19af 100644 --- a/test/Modules/redecl-merge.m +++ b/test/Modules/redecl-merge.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -Wreturn-type -fmodules-cache-path=%t -I %S/Inputs %s -verify -Wno-objc-root-class +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -Wreturn-type -fmodules-cache-path=%t -I %S/Inputs %s -verify -Wno-objc-root-class @class C2; @class C3; diff --git a/test/Modules/redecl-merge2.m b/test/Modules/redecl-merge2.m index 3431ecc..dfa9c12 100644 --- a/test/Modules/redecl-merge2.m +++ b/test/Modules/redecl-merge2.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify -Wno-objc-root-class +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify -Wno-objc-root-class // expected-no-diagnostics @import redecl_merge_bottom.prefix; diff --git a/test/Modules/redecl-namespaces.mm b/test/Modules/redecl-namespaces.mm index 203daa9..e17af86 100644 --- a/test/Modules/redecl-namespaces.mm +++ b/test/Modules/redecl-namespaces.mm @@ -8,6 +8,6 @@ void test() { } // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodules-cache-path=%t -emit-module -fmodule-name=redecl_namespaces_left %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodules-cache-path=%t -emit-module -fmodule-name=redecl_namespaces_right %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs -w %s -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c++ -fmodules-cache-path=%t -emit-module -fmodule-name=redecl_namespaces_left %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c++ -fmodules-cache-path=%t -emit-module -fmodule-name=redecl_namespaces_right %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -w %s -verify diff --git a/test/Modules/redecl-templates.cpp b/test/Modules/redecl-templates.cpp index 6bbec02..ee42dc9 100644 --- a/test/Modules/redecl-templates.cpp +++ b/test/Modules/redecl-templates.cpp @@ -1,6 +1,6 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -x c++ -I %S/Inputs/redecl-templates %s -verify -std=c++14 -// RUN: %clang_cc1 -x c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs/redecl-templates %s -verify -std=c++14 +// RUN: %clang_cc1 -x c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/redecl-templates %s -verify -std=c++14 // expected-no-diagnostics template<int N> struct A {}; diff --git a/test/Modules/redeclarations.m b/test/Modules/redeclarations.m index 11aca75..e3f78f2 100644 --- a/test/Modules/redeclarations.m +++ b/test/Modules/redeclarations.m @@ -5,8 +5,8 @@ @end // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=redeclarations_left %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=redeclarations_right %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=redeclarations_left %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=redeclarations_right %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify // expected-no-diagnostics diff --git a/test/Modules/redecls.m b/test/Modules/redecls.m index fa643b9..d6ad22e 100644 --- a/test/Modules/redecls.m +++ b/test/Modules/redecls.m @@ -1,7 +1,7 @@ // RUN: rm -rf %t.mcp -// RUN: %clang_cc1 -fmodules %s -emit-pch -o %t1.pch -fmodules-cache-path=%t.mcp -I %S/Inputs/redecls -// RUN: %clang_cc1 -fmodules %s -emit-pch -o %t2.pch -include-pch %t1.pch -fmodules-cache-path=%t.mcp -I %S/Inputs/redecls -// RUN: %clang_cc1 -fmodules %s -fsyntax-only -include-pch %t2.pch -I %S/Inputs/redecls -fmodules-cache-path=%t.mcp -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps %s -emit-pch -o %t1.pch -fmodules-cache-path=%t.mcp -I %S/Inputs/redecls +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps %s -emit-pch -o %t2.pch -include-pch %t1.pch -fmodules-cache-path=%t.mcp -I %S/Inputs/redecls +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps %s -fsyntax-only -include-pch %t2.pch -I %S/Inputs/redecls -fmodules-cache-path=%t.mcp -verify #ifndef HEADER1 #define HEADER1 diff --git a/test/Modules/renamed.m b/test/Modules/renamed.m index ec2616e..46a8f94 100644 --- a/test/Modules/renamed.m +++ b/test/Modules/renamed.m @@ -3,6 +3,6 @@ int f() { return same_api; } // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -I %S/Inputs/oldname -fmodules-cache-path=%t %s -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -I %S/Inputs/oldname -fmodules-cache-path=%t %s -verify // expected-no-diagnostics diff --git a/test/Modules/require-modular-includes.m b/test/Modules/require-modular-includes.m index 302e4cd..0254444 100644 --- a/test/Modules/require-modular-includes.m +++ b/test/Modules/require-modular-includes.m @@ -2,80 +2,80 @@ // Including a header from the imported module // RUN: echo '@import FromImportedModuleOK;' | \ -// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \ +// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules -fimplicit-module-maps \ // RUN: -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \ // RUN: -Werror -fsyntax-only -x objective-c - // Including a non-modular header // RUN: echo '@import FromImportedModuleFail;' | \ -// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \ +// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules -fimplicit-module-maps \ // RUN: -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \ // RUN: -I %S/Inputs/require-modular-includes \ // RUN: -fsyntax-only -x objective-c - 2>&1 | FileCheck %s // Including a header from a subframework // RUN: echo '@import FromSubframework;' | \ -// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \ +// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules -fimplicit-module-maps \ // RUN: -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \ // RUN: -Werror -fsyntax-only -x objective-c - // Including a header from a subframework (fail) // RUN: echo '@import FromNonModularSubframework;' | \ -// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \ +// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules -fimplicit-module-maps \ // RUN: -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \ // RUN: -I %S/Inputs/require-modular-includes \ // RUN: -fsyntax-only -x objective-c - 2>&1 | FileCheck %s // Including a non-modular header from a submodule // RUN: echo '@import FromImportedSubModule;' | \ -// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \ +// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules -fimplicit-module-maps \ // RUN: -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \ // RUN: -I %S/Inputs/require-modular-includes \ // RUN: -fsyntax-only -x objective-c - 2>&1 | FileCheck %s // Including a non-modular header (directly) with -fmodule-name set // RUN: echo '#include "NotInModule.h"' | \ -// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \ +// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules -fimplicit-module-maps \ // RUN: -fmodules-cache-path=%t -I %S/Inputs/require-modular-includes \ // RUN: -Werror -fmodule-name=A -fsyntax-only -x objective-c - // Including an excluded header // RUN: echo '@import IncludeExcluded;' | \ -// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \ +// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules -fimplicit-module-maps \ // RUN: -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \ // RUN: -Werror -fsyntax-only -x objective-c - // Including a header from another module // RUN: echo '@import FromAnotherModule;' | \ -// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \ +// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules -fimplicit-module-maps \ // RUN: -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \ // RUN: -I %S/Inputs/require-modular-includes \ // RUN: -Werror -fsyntax-only -x objective-c - // Including an excluded header from another module // RUN: echo '@import ExcludedFromAnotherModule;' | \ -// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \ +// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules -fimplicit-module-maps \ // RUN: -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \ // RUN: -I %S/Inputs/require-modular-includes \ // RUN: -Werror -fsyntax-only -x objective-c - // Including a header from an umbrella directory // RUN: echo '@import FromUmbrella;' | \ -// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \ +// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules -fimplicit-module-maps \ // RUN: -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \ // RUN: -I %S/Inputs/require-modular-includes \ // RUN: -Werror -fsyntax-only -x objective-c - // A includes B includes non-modular C // RUN: echo '@import A;' | \ -// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \ +// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules -fimplicit-module-maps \ // RUN: -fmodules-cache-path=%t -F %S/Inputs/require-modular-includes \ // RUN: -I %S/Inputs/require-modular-includes \ // RUN: -fsyntax-only -x objective-c - 2>&1 | FileCheck %s // Non-framework module (pass) // RUN: echo '@import NotFramework;' | \ -// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules \ +// RUN: %clang_cc1 -Wnon-modular-include-in-framework-module -fmodules -fimplicit-module-maps \ // RUN: -fmodules-cache-path=%t -I %S/Inputs/require-modular-includes \ // RUN: -Werror -fsyntax-only -x objective-c - diff --git a/test/Modules/requires.m b/test/Modules/requires.m index ff0ddfe..155c6ae 100644 --- a/test/Modules/requires.m +++ b/test/Modules/requires.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -F %S/Inputs %s -verify -fmodule-feature custom_req1 +// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify -fmodule-feature custom_req1 @import DependsOnModule.CXX; // expected-error{{module 'DependsOnModule.CXX' requires feature 'cplusplus'}} @import DependsOnModule.NotCXX; diff --git a/test/Modules/requires.mm b/test/Modules/requires.mm index 736f2fa..cc64a50 100644 --- a/test/Modules/requires.mm +++ b/test/Modules/requires.mm @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -F %S/Inputs %s -verify +// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify @import DependsOnModule.CXX; @import DependsOnModule.NotCXX; // expected-error{{module 'DependsOnModule.NotCXX' is incompatible with feature 'cplusplus'}} diff --git a/test/Modules/resolution-change.m b/test/Modules/resolution-change.m index 6882fe4..bf95104 100644 --- a/test/Modules/resolution-change.m +++ b/test/Modules/resolution-change.m @@ -1,24 +1,24 @@ // RUN: rm -rf %t // Build PCH using A from path 1 -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path1/A -emit-pch -o %t-A.pch %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path1/A -emit-pch -o %t-A.pch %s // Use the PCH with the same header search options; should be fine -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path1/A -include-pch %t-A.pch %s -fsyntax-only -Werror +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path1/A -include-pch %t-A.pch %s -fsyntax-only -Werror // Different -W options are ok -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path1/A -include-pch %t-A.pch %s -fsyntax-only -Werror -Wauto-import +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path1/A -include-pch %t-A.pch %s -fsyntax-only -Werror -Wauto-import // Use the PCH with no way to resolve DependsOnA -// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t -include-pch %t-A.pch %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-NODOA %s +// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -include-pch %t-A.pch %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-NODOA %s // CHECK-NODOA: module 'DependsOnA' in AST file '{{.*DependsOnA.*pcm}}' (imported by AST file '{{.*A.pch}}') is not defined in any loaded module map // Use the PCH with no way to resolve A -// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -include-pch %t-A.pch %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-NOA %s +// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -include-pch %t-A.pch %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-NOA %s // CHECK-NOA: module 'A' in AST file '{{.*A.*pcm}}' (imported by AST file '{{.*DependsOnA.*pcm}}') is not defined in any loaded module map // Use the PCH and have it resolve to the other A -// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path2/A -include-pch %t-A.pch %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-WRONGA %s +// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path2/A -include-pch %t-A.pch %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-WRONGA %s // CHECK-WRONGA: module 'A' was built in directory '{{.*Inputs.modules-with-same-name.path1.A}}' but now resides in directory '{{.*Inputs.modules-with-same-name.path2.A}}' #ifndef HEADER diff --git a/test/Modules/stddef.c b/test/Modules/stddef.c index aefc90f..16de854 100644 --- a/test/Modules/stddef.c +++ b/test/Modules/stddef.c @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/StdDef %s -verify -fno-modules-error-recovery +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/StdDef %s -verify -fno-modules-error-recovery #include "ptrdiff_t.h" diff --git a/test/Modules/stddef.m b/test/Modules/stddef.m index 83f73f9..9af526e 100644 --- a/test/Modules/stddef.m +++ b/test/Modules/stddef.m @@ -3,5 +3,5 @@ size_t getSize(); // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs/StdDef %s -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/StdDef %s -verify // expected-no-diagnostics diff --git a/test/Modules/stress1.cpp b/test/Modules/stress1.cpp index df690aa..4f3c34a 100644 --- a/test/Modules/stress1.cpp +++ b/test/Modules/stress1.cpp @@ -3,14 +3,14 @@ // // RUN: %clang_cc1 -fmodules -x c++ -std=c++11 \ // RUN: -I Inputs/stress1 \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -fmodule-map-file-home-is-cwd \ // RUN: -emit-module -fmodule-name=m00 -o %t/m00.pcm \ // RUN: Inputs/stress1/module.modulemap // // RUN: %clang_cc1 -fmodules -x c++ -std=c++11 \ // RUN: -I Inputs/stress1 \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -fmodule-map-file-home-is-cwd \ // RUN: -emit-module -fmodule-name=m00 -o %t/m00_check.pcm \ // RUN: Inputs/stress1/module.modulemap @@ -19,14 +19,14 @@ // // RUN: %clang_cc1 -fmodules -x c++ -std=c++11 -fdelayed-template-parsing \ // RUN: -I Inputs/stress1 \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -fmodule-map-file-home-is-cwd \ // RUN: -emit-module -fmodule-name=m01 -o %t/m01.pcm \ // RUN: Inputs/stress1/module.modulemap // // RUN: %clang_cc1 -fmodules -x c++ -std=c++11 -fdelayed-template-parsing \ // RUN: -I Inputs/stress1 \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -fmodule-map-file-home-is-cwd \ // RUN: -emit-module -fmodule-name=m01 -o %t/m01_check.pcm \ // RUN: Inputs/stress1/module.modulemap @@ -35,21 +35,21 @@ // // RUN: %clang_cc1 -fmodules -x c++ -std=c++11 \ // RUN: -I Inputs/stress1 \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -fmodule-map-file-home-is-cwd \ // RUN: -emit-module -fmodule-name=m02 -o %t/m02.pcm \ // RUN: Inputs/stress1/module.modulemap // // RUN: %clang_cc1 -fmodules -x c++ -std=c++11 \ // RUN: -I Inputs/stress1 \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -fmodule-map-file-home-is-cwd \ // RUN: -emit-module -fmodule-name=m03 -o %t/m03.pcm \ // RUN: Inputs/stress1/module.modulemap // // RUN: %clang_cc1 -fmodules -x c++ -std=c++11 \ // RUN: -I Inputs/stress1 \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -fmodule-map-file-home-is-cwd \ // RUN: -fmodule-file=%t/m00.pcm \ // RUN: -fmodule-file=%t/m01.pcm \ @@ -60,7 +60,7 @@ // // RUN: %clang_cc1 -fmodules -x c++ -std=c++11 \ // RUN: -I Inputs/stress1 \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -fmodule-map-file-home-is-cwd \ // RUN: -fmodule-file=%t/m00.pcm \ // RUN: -fmodule-file=%t/m01.pcm \ @@ -73,7 +73,7 @@ // // RUN: %clang_cc1 -fmodules -x c++ -std=c++11 \ // RUN: -I Inputs/stress1 \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -fmodule-map-file-home-is-cwd \ // RUN: -fmodule-map-file=Inputs/stress1/module.modulemap \ // RUN: -fmodule-file=%t/m00.pcm \ @@ -85,7 +85,7 @@ // // RUN: %clang_cc1 -fmodules -x c++ -std=c++11 \ // RUN: -I Inputs/stress1 \ -// RUN: -fno-implicit-modules -fno-modules-implicit-maps \ +// RUN: -fno-implicit-modules \ // RUN: -fmodule-map-file-home-is-cwd \ // RUN: -fmodule-map-file=Inputs/stress1/module.modulemap \ // RUN: -fmodule-file=%t/m00.pcm \ diff --git a/test/Modules/strict-decluse.cpp b/test/Modules/strict-decluse.cpp index fa6955a..a8b5248 100644 --- a/test/Modules/strict-decluse.cpp +++ b/test/Modules/strict-decluse.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodule-maps -fmodules-cache-path=%t -fmodules-strict-decluse -fmodule-name=XG -I %S/Inputs/declare-use %s -verify +// RUN: %clang_cc1 -fimplicit-module-maps -fmodules-cache-path=%t -fmodules-strict-decluse -fmodule-name=XG -I %S/Inputs/declare-use %s -verify #include "g.h" #include "e.h" diff --git a/test/Modules/string_names.cpp b/test/Modules/string_names.cpp index ed65aa8..43068f1 100644 --- a/test/Modules/string_names.cpp +++ b/test/Modules/string_names.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fmodules-decluse -I %S/Inputs/string_names %s -fmodule-name="my/module-a" -verify +// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -fmodules-decluse -I %S/Inputs/string_names %s -fmodule-name="my/module-a" -verify #include "a.h" #include "b.h" // expected-error {{does not depend on a module exporting}} diff --git a/test/Modules/subframework-from-intermediate-path.m b/test/Modules/subframework-from-intermediate-path.m index ae0bd64..394cc45 100644 --- a/test/Modules/subframework-from-intermediate-path.m +++ b/test/Modules/subframework-from-intermediate-path.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -F %S/Inputs -F %S/Inputs/DependsOnModule.framework/Frameworks %s -verify +// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs -F %S/Inputs/DependsOnModule.framework/Frameworks %s -verify @import DependsOnModule; @import SubFramework; // expected-error{{module 'SubFramework' not found}} diff --git a/test/Modules/subframeworks.m b/test/Modules/subframeworks.m index 5d70bc0..2108184 100644 --- a/test/Modules/subframeworks.m +++ b/test/Modules/subframeworks.m @@ -1,6 +1,6 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -F %S/Inputs -F %S/Inputs/DependsOnModule.framework/Frameworks %s -verify -// RUN: %clang_cc1 -x objective-c++ -Wauto-import -fmodules-cache-path=%t -fmodules -F %S/Inputs -F %S/Inputs/DependsOnModule.framework/Frameworks %s -verify +// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs -F %S/Inputs/DependsOnModule.framework/Frameworks %s -verify +// RUN: %clang_cc1 -x objective-c++ -Wauto-import -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs -F %S/Inputs/DependsOnModule.framework/Frameworks %s -verify @import DependsOnModule; diff --git a/test/Modules/submodule-visibility-cycles.cpp b/test/Modules/submodule-visibility-cycles.cpp index fca8df9..f26f6f2 100644 --- a/test/Modules/submodule-visibility-cycles.cpp +++ b/test/Modules/submodule-visibility-cycles.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fno-modules-error-recovery -fmodules-local-submodule-visibility -fmodules-cache-path=%t -I%S/Inputs/submodule-visibility -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fno-modules-error-recovery -fmodules-local-submodule-visibility -fmodules-cache-path=%t -I%S/Inputs/submodule-visibility -verify %s #include "cycle1.h" C1 c1; diff --git a/test/Modules/submodule-visibility.cpp b/test/Modules/submodule-visibility.cpp index 07be1c2..084f811 100644 --- a/test/Modules/submodule-visibility.cpp +++ b/test/Modules/submodule-visibility.cpp @@ -1,8 +1,8 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/submodule-visibility -verify %s -DALLOW_NAME_LEAKAGE -// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fmodules-cache-path=%t -I%S/Inputs/submodule-visibility -verify %s -DIMPORT -// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fmodules-cache-path=%t -fmodule-name=x -I%S/Inputs/submodule-visibility -verify %s -// RUN: %clang_cc1 -fmodule-maps -fmodules-local-submodule-visibility -fmodules-cache-path=%t -I%S/Inputs/submodule-visibility -verify %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/submodule-visibility -verify %s -DALLOW_NAME_LEAKAGE +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-local-submodule-visibility -fmodules-cache-path=%t -I%S/Inputs/submodule-visibility -verify %s -DIMPORT +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-local-submodule-visibility -fmodules-cache-path=%t -fmodule-name=x -I%S/Inputs/submodule-visibility -verify %s +// RUN: %clang_cc1 -fimplicit-module-maps -fmodules-local-submodule-visibility -fmodules-cache-path=%t -I%S/Inputs/submodule-visibility -verify %s #include "a.h" #include "b.h" diff --git a/test/Modules/submodules-merge-defs.cpp b/test/Modules/submodules-merge-defs.cpp index 0e2f5d9..94c0fd3 100644 --- a/test/Modules/submodules-merge-defs.cpp +++ b/test/Modules/submodules-merge-defs.cpp @@ -1,16 +1,28 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -DTEXTUAL -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -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 -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 -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 -fmodules -fimplicit-module-maps -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -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 +// 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 -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. #include "empty.h" +#ifdef EARLY_INDIRECT_INCLUDE +#include "indirect.h" +#endif -A pre_a; // expected-error {{must be imported}} expected-error {{must use 'struct'}} +A pre_a; // expected-error {{must use 'struct'}} +#ifdef IMPORT_USE_2 +// expected-error-re@-2 {{must be imported from one of {{.*}}stuff.use{{.*}}stuff.use-2}} +#elif EARLY_INDIRECT_INCLUDE +// expected-error@-4 {{must be imported from module 'merged-defs'}} +#else +// expected-error@-6 {{must be imported from module 'stuff.use'}} +#endif // expected-note@defs.h:1 +{{here}} -// FIXME: We should warn that use_a is being used without being imported. -int pre_use_a = use_a(pre_a); // expected-error {{'A' must be imported}} +// expected-note@defs.h:2 +{{here}} +int pre_use_a = use_a(pre_a); // expected-error {{'A' must be imported}} expected-error {{'use_a' must be imported}} B::Inner2 pre_bi; // expected-error +{{must be imported}} // expected-note@defs.h:4 +{{here}} @@ -36,9 +48,28 @@ 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}} +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}} + +J<> pre_j; // expected-error {{declaration of 'J' must be imported}} +#ifdef IMPORT_USE_2 +// expected-error-re@-2 {{default argument of 'J' must be imported from one of {{.*}}stuff.use{{.*}}stuff.use-2}} +#elif EARLY_INDIRECT_INCLUDE +// expected-error@-4 {{default argument of 'J' must be imported from module 'merged-defs'}} +#else +// expected-error@-6 {{default argument of 'J' must be imported from module 'stuff.use'}} +#endif +// expected-note@defs.h:49 +{{here}} + // Make definitions from second module visible. #ifdef TEXTUAL #include "import-and-redefine.h" +#elif defined IMPORT_USE_2 +#include "use-defs-2.h" #else #include "merged-defs.h" #endif @@ -54,3 +85,10 @@ int post_use_dx = use_dx(post_dx); int post_e = E(0); int post_ff = F<char>().f(); int post_fg = F<char>().g<int>(); +G::A post_ga = G::a; +decltype(G::h) post_gh = G::h; +J<> post_j; +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; diff --git a/test/Modules/submodules-preprocess.cpp b/test/Modules/submodules-preprocess.cpp index 7040b51..c9fad10 100644 --- a/test/Modules/submodules-preprocess.cpp +++ b/test/Modules/submodules-preprocess.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c++ -Eonly -fmodules-cache-path=%t -I %S/Inputs/submodules %s -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c++ -Eonly -fmodules-cache-path=%t -I %S/Inputs/submodules %s -verify // FIXME: When we have a syntax for modules in C++, use that. @import std.vector; diff --git a/test/Modules/submodules.cpp b/test/Modules/submodules.cpp index c3b2623..a3dde23 100644 --- a/test/Modules/submodules.cpp +++ b/test/Modules/submodules.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c++ -fmodules-cache-path=%t -fmodules -I %S/Inputs/submodules %s -verify +// RUN: %clang_cc1 -x objective-c++ -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/submodules %s -verify // FIXME: When we have a syntax for modules in C++, use that. @import std.vector; diff --git a/test/Modules/submodules.m b/test/Modules/submodules.m index 7187e75..04e758d 100644 --- a/test/Modules/submodules.m +++ b/test/Modules/submodules.m @@ -1,6 +1,6 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -F %S/Inputs %s -verify +// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify // expected-no-diagnostics // Note: transitively imports Module.Sub2. diff --git a/test/Modules/system_headers.m b/test/Modules/system_headers.m index 8adc7e8..165e8e8 100644 --- a/test/Modules/system_headers.m +++ b/test/Modules/system_headers.m @@ -1,7 +1,7 @@ // Test that system-headerness works for building modules. // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache -isystem %S/Inputs -pedantic -Werror %s -verify -std=c11 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache -isystem %S/Inputs -pedantic -Werror %s -verify -std=c11 // expected-no-diagnostics @import warning; diff --git a/test/Modules/system_version.m b/test/Modules/system_version.m index 55174ef..b1bc360 100644 --- a/test/Modules/system_version.m +++ b/test/Modules/system_version.m @@ -9,21 +9,21 @@ // RUN: cp %S/Inputs/Modified/module.map %t/usr/include // Run once with no system version file. We should end up with one module. -// RUN: %clang_cc1 -fmodules-cache-path=%t/cache -fmodules -isysroot %t -I %t/usr/include %s -verify +// RUN: %clang_cc1 -fmodules-cache-path=%t/cache -fmodules -fimplicit-module-maps -isysroot %t -I %t/usr/include %s -verify // RUN: ls -R %t | grep -c "ModA.*pcm" | grep 1 // Add a system version file and run again. We should now have two // module variants. // RUN: mkdir -p %t/System/Library/CoreServices // RUN: echo "hello" > %t/System/Library/CoreServices/SystemVersion.plist -// RUN: %clang_cc1 -fmodules-cache-path=%t/cache -fmodules -isysroot %t -I %t/usr/include %s -verify +// RUN: %clang_cc1 -fmodules-cache-path=%t/cache -fmodules -fimplicit-module-maps -isysroot %t -I %t/usr/include %s -verify // RUN: ls -R %t | grep -c "ModA.*pcm" | grep 2 // Change the system version file and run again. We should now have three // module variants. // RUN: mkdir -p %t/System/Library/CoreServices // RUN: echo "modules" > %t/System/Library/CoreServices/SystemVersion.plist -// RUN: %clang_cc1 -fmodules-cache-path=%t/cache -fmodules -isysroot %t -I %t/usr/include %s -verify +// RUN: %clang_cc1 -fmodules-cache-path=%t/cache -fmodules -fimplicit-module-maps -isysroot %t -I %t/usr/include %s -verify // RUN: ls -R %t | grep -c "ModA.*pcm" | grep 3 // expected-no-diagnostics diff --git a/test/Modules/template-default-args.cpp b/test/Modules/template-default-args.cpp index 63187b8..dc44534 100644 --- a/test/Modules/template-default-args.cpp +++ b/test/Modules/template-default-args.cpp @@ -1,12 +1,13 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -verify -fmodules-cache-path=%t -I %S/Inputs/template-default-args -std=c++11 %s -// -// expected-no-diagnostics +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -fno-modules-error-recovery -I %S/Inputs/template-default-args -std=c++11 %s template<typename T> struct A; template<typename T> struct B; template<typename T> struct C; template<typename T = int> struct D; +template<typename T = int> struct E {}; +template<typename T> struct H {}; +template<typename T = int, typename U = int> struct I {}; #include "b.h" @@ -15,8 +16,19 @@ template<typename T> struct B {}; template<typename T = int> struct B; template<typename T = int> struct C; template<typename T> struct D {}; +template<typename T> struct F {}; +template<typename T> struct G {}; + +#include "c.h" A<> a; B<> b; extern C<> c; D<> d; +E<> e; +F<> f; +G<> g; // expected-error {{default argument of 'G' must be imported from module 'X.A' before it is required}} +// expected-note@a.h:6 {{default argument declared here}} +H<> h; // expected-error {{default argument of 'H' must be imported from module 'X.A' before it is required}} +// expected-note@a.h:7 {{default argument declared here}} +I<> i; diff --git a/test/Modules/template-specialization-visibility.cpp b/test/Modules/template-specialization-visibility.cpp index efcfd93..6f4f6ef 100644 --- a/test/Modules/template-specialization-visibility.cpp +++ b/test/Modules/template-specialization-visibility.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -verify -fmodules-cache-path=%t -I %S/Inputs/template-specialization-visibility -std=c++11 %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs/template-specialization-visibility -std=c++11 %s // // expected-no-diagnostics diff --git a/test/Modules/templates-2.mm b/test/Modules/templates-2.mm index 8a752f7..78d203a 100644 --- a/test/Modules/templates-2.mm +++ b/test/Modules/templates-2.mm @@ -1,6 +1,6 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++11 -x objective-c++ -fmodules -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 -fmodules-cache-path=%t -I %S/Inputs -emit-llvm %s -o - -Wno-objc-root-class | FileCheck %s +// 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 @import templates_top; diff --git a/test/Modules/templates.mm b/test/Modules/templates.mm index aafe018..503f4bb 100644 --- a/test/Modules/templates.mm +++ b/test/Modules/templates.mm @@ -1,6 +1,6 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++11 -x objective-c++ -fmodules -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 -fmodules-cache-path=%t -I %S/Inputs -emit-llvm %s -o - -Wno-objc-root-class | FileCheck %s +// 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 @import templates_left; diff --git a/test/Modules/textual-headers.cpp b/test/Modules/textual-headers.cpp index cab9991..4df741c 100644 --- a/test/Modules/textual-headers.cpp +++ b/test/Modules/textual-headers.cpp @@ -1,6 +1,6 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodule-maps -fmodules-cache-path=%t -fmodules-strict-decluse -fmodule-name=XG -I %S/Inputs/declare-use %s -verify -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodules-strict-decluse -fmodule-name=XG -I %S/Inputs/declare-use %s -verify -fno-modules-error-recovery +// RUN: %clang_cc1 -fimplicit-module-maps -fmodules-cache-path=%t -fmodules-strict-decluse -fmodule-name=XG -I %S/Inputs/declare-use %s -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fmodules-strict-decluse -fmodule-name=XG -I %S/Inputs/declare-use %s -verify -fno-modules-error-recovery #define GIMME_A_K #include "k.h" diff --git a/test/Modules/undefined-type-fixit1.cpp b/test/Modules/undefined-type-fixit1.cpp index 78ce174..3b73457 100644 --- a/test/Modules/undefined-type-fixit1.cpp +++ b/test/Modules/undefined-type-fixit1.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fmodules-search-all -I %S/Inputs/undefined-type-fixit %s -verify +// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -fmodules-search-all -I %S/Inputs/undefined-type-fixit %s -verify //#include "public1.h" #include "public2.h" diff --git a/test/Modules/unnecessary-module-map-parsing.c b/test/Modules/unnecessary-module-map-parsing.c index 4c83448..9dfd36c 100644 --- a/test/Modules/unnecessary-module-map-parsing.c +++ b/test/Modules/unnecessary-module-map-parsing.c @@ -1,6 +1,6 @@ // This checks that we are not parsing module maps if modules are not enabled. -// RUN: not %clang_cc1 -fmodules -I %S/Inputs/unnecessary-module-map-parsing -fsyntax-only %s 2>&1 | FileCheck %s +// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -I %S/Inputs/unnecessary-module-map-parsing -fsyntax-only %s 2>&1 | FileCheck %s // RUN: %clang_cc1 -I %S/Inputs/unnecessary-module-map-parsing -fsyntax-only %s // CHECK: error: expected umbrella, header, submodule, or module export diff --git a/test/Modules/update-after-load.cpp b/test/Modules/update-after-load.cpp index f497ea4..621674c 100644 --- a/test/Modules/update-after-load.cpp +++ b/test/Modules/update-after-load.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -I %S/Inputs/update-after-load -verify -fmodules-cache-path=%t %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -I %S/Inputs/update-after-load -verify -fmodules-cache-path=%t %s // expected-no-diagnostics #include "a.h" diff --git a/test/Modules/update-exception-spec.cpp b/test/Modules/update-exception-spec.cpp index bccdddc..f678f6e 100644 --- a/test/Modules/update-exception-spec.cpp +++ b/test/Modules/update-exception-spec.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fexceptions -fcxx-exceptions -fmodules -fmodules-cache-path=%t -I%S/Inputs/update-exception-spec -emit-llvm-only %s +// RUN: %clang_cc1 -fexceptions -fcxx-exceptions -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/update-exception-spec -emit-llvm-only %s #include "a.h" void use(B *p); #include "c.h" diff --git a/test/Modules/using-decl.cpp b/test/Modules/using-decl.cpp index 4432738..a388a5b 100644 --- a/test/Modules/using-decl.cpp +++ b/test/Modules/using-decl.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify +// RUN: %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify @import using_decl.a; diff --git a/test/Modules/va_list.m b/test/Modules/va_list.m index 5a30518..d13b39b 100644 --- a/test/Modules/va_list.m +++ b/test/Modules/va_list.m @@ -1,22 +1,22 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -triple x86_64-apple-macosx10 -fmodules -fmodules-cache-path=%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 \ // RUN: -x objective-c-header %s -o %t.pch -emit-pch // Include the pch, as a sanity check. -// RUN: %clang_cc1 -triple x86_64-apple-macosx10 -fmodules -fmodules-cache-path=%t \ +// RUN: %clang_cc1 -triple x86_64-apple-macosx10 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ // RUN: -fmodules-ignore-macro=PREFIX -I %S/Inputs/va_list -include-pch %t.pch \ // RUN: -x objective-c %s -fsyntax-only // Repeat the previous emit-pch, but not we will have a global module index. // For some reason, this results in an identifier for __va_list_tag being // emitted into the pch. -// RUN: %clang_cc1 -triple x86_64-apple-macosx10 -fmodules -fmodules-cache-path=%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 \ // RUN: -x objective-c-header %s -o %t.pch -emit-pch // Include the pch, which now has __va_list_tag in it, which needs to be merged. -// RUN: %clang_cc1 -triple x86_64-apple-macosx10 -fmodules -fmodules-cache-path=%t \ +// RUN: %clang_cc1 -triple x86_64-apple-macosx10 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ // RUN: -fmodules-ignore-macro=PREFIX -I %S/Inputs/va_list -include-pch %t.pch \ // RUN: -x objective-c %s -fsyntax-only diff --git a/test/Modules/validate-system-headers.m b/test/Modules/validate-system-headers.m index 8cdc886..d05fae7 100644 --- a/test/Modules/validate-system-headers.m +++ b/test/Modules/validate-system-headers.m @@ -5,37 +5,37 @@ //// // Build a module using a system header -// RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s +// RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s // RUN: cp %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved //// // Modify the system header, and confirm that we don't notice without -fmodules-validate-system-headers. // The pcm file in the cache should fail to validate. // RUN: echo ' ' >> %t/Inputs/usr/include/foo.h -// RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s +// RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s // RUN: diff %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved //// // Now make sure we rebuild the module when -fmodules-validate-system-headers is set. -// RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -fmodules-validate-system-headers -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s +// RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -fimplicit-module-maps -fmodules-validate-system-headers -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s // RUN: not diff %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved //// // This should override -fmodules-validate-once-per-build-session // RUN: cp %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved -// RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session +// RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session // RUN: diff %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved // Modify the system header... // RUN: echo ' ' >> %t/Inputs/usr/include/foo.h // Don't recompile due to -fmodules-validate-once-per-build-session -// RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session +// RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session // RUN: diff %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved // Now add -fmodules-validate-system-headers and rebuild -// RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -fmodules-validate-system-headers -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session +// RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -fimplicit-module-maps -fmodules-validate-system-headers -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session // RUN: not diff %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved @import Foo; diff --git a/test/Modules/warn-unused-local-typedef.cpp b/test/Modules/warn-unused-local-typedef.cpp index 030a52d..14cfcc3 100644 --- a/test/Modules/warn-unused-local-typedef.cpp +++ b/test/Modules/warn-unused-local-typedef.cpp @@ -1,7 +1,6 @@ -// XFAIL: hexagon // RUN: rm -rf %t -// RUN: %clang -Wunused-local-typedef -c -x objective-c++ -fcxx-modules -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -o /dev/null 2>&1 | FileCheck %s -check-prefix=CHECK_1 -// RUN: %clang -Wunused-local-typedef -c -x objective-c++ -fcxx-modules -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -o /dev/null 2>&1 | FileCheck %s -check-prefix=CHECK_2 -allow-empty +// RUN: %clang_cc1 -Wunused-local-typedef -x objective-c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -fsyntax-only 2>&1 | FileCheck %s -check-prefix=CHECK_1 +// RUN: %clang_cc1 -Wunused-local-typedef -x objective-c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -fsyntax-only 2>&1 | FileCheck %s -check-prefix=CHECK_2 --allow-empty // For modules, the warning should only fire the first time, when the module is // built. diff --git a/test/Modules/wildcard-submodule-exports.cpp b/test/Modules/wildcard-submodule-exports.cpp index f377dbe..321d930 100644 --- a/test/Modules/wildcard-submodule-exports.cpp +++ b/test/Modules/wildcard-submodule-exports.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c++ -fmodules-cache-path=%t -fmodules -I %S/Inputs/wildcard-submodule-exports %s -verify +// RUN: %clang_cc1 -x objective-c++ -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/wildcard-submodule-exports %s -verify // FIXME: When we have a syntax for modules in C++, use that. @import C.One; diff --git a/test/OpenMP/for_simd_codegen.cpp b/test/OpenMP/for_simd_codegen.cpp new file mode 100644 index 0000000..00ec6cb --- /dev/null +++ b/test/OpenMP/for_simd_codegen.cpp @@ -0,0 +1,686 @@ +// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s +// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -g -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -gline-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG +// +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +long long get_val() { return 0; } +double *g_ptr; + +// CHECK-LABEL: define {{.*void}} @{{.*}}simple{{.*}}(float* {{.+}}, float* {{.+}}, float* {{.+}}, float* {{.+}}) +void simple(float *a, float *b, float *c, float *d) { + #pragma omp for simd +// CHECK: call void @__kmpc_for_static_init_4(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i32* [[LB:%[^,]+]], i32* [[UB:%[^,]+]], i32* [[STRIDE:%[^,]+]], i32 1, i32 1) +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]], +// CHECK: [[CMP:%.+]] = icmp sgt i32 [[UB_VAL]], 5 +// CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] +// CHECK: [[TRUE]] +// CHECK: br label %[[SWITCH:[^,]+]] +// CHECK: [[FALSE]] +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]], +// CHECK: br label %[[SWITCH]] +// CHECK: [[SWITCH]] +// CHECK: [[UP:%.+]] = phi i32 [ 5, %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] +// CHECK: store i32 [[UP]], i32* [[UB]], +// CHECK: [[LB_VAL:%.+]] = load i32, i32* [[LB]], +// CHECK: store i32 [[LB_VAL]], i32* [[OMP_IV:%[^,]+]], + +// CHECK: [[IV:%.+]] = load i32, i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID:[0-9]+]] +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID]] +// CHECK-NEXT: [[CMP:%.+]] = icmp sle i32 [[IV]], [[UB_VAL]] +// CHECK-NEXT: br i1 [[CMP]], label %[[SIMPLE_LOOP1_BODY:.+]], label %[[SIMPLE_LOOP1_END:[^,]+]] + for (int i = 3; i < 32; i += 5) { +// CHECK: [[SIMPLE_LOOP1_BODY]] +// Start of body: calculate i from IV: +// CHECK: [[IV1_1:%.+]] = load i32, i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID]] +// CHECK: [[CALC_I_1:%.+]] = mul nsw i32 [[IV1_1]], 5 +// CHECK-NEXT: [[CALC_I_2:%.+]] = add nsw i32 3, [[CALC_I_1]] +// CHECK-NEXT: store i32 [[CALC_I_2]], i32* [[LC_I:.+]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID]] +// ... loop body ... +// End of body: store into a[i]: +// CHECK: store float [[RESULT:%.+]], float* {{%.+}}{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID]] + a[i] = b[i] * c[i] * d[i]; +// CHECK: [[IV1_2:%.+]] = load i32, i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID]] +// CHECK-NEXT: [[ADD1_2:%.+]] = add nsw i32 [[IV1_2]], 1 +// CHECK-NEXT: store i32 [[ADD1_2]], i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID]] +// br label %{{.+}}, !llvm.loop !{{.+}} + } +// CHECK: [[SIMPLE_LOOP1_END]] +// CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) + + long long k = get_val(); + + #pragma omp for simd linear(k : 3) schedule(dynamic) +// CHECK: [[K0:%.+]] = call {{.*}}i64 @{{.*}}get_val +// CHECK-NEXT: store i64 [[K0]], i64* [[K_VAR:%[^,]+]] +// CHECK: [[K0LOAD:%.+]] = load i64, i64* [[K_VAR]] +// CHECK-NEXT: store i64 [[K0LOAD]], i64* [[LIN0:%[^,]+]] + +// CHECK: call void @__kmpc_dispatch_init_4(%ident_t* {{.+}}, i32 %{{.+}}, i32 35, i32 0, i32 8, i32 1, i32 1) +// CHECK: [[NEXT:%.+]] = call i32 @__kmpc_dispatch_next_4(%ident_t* {{.+}}, i32 %{{.+}}, i32* %{{.+}}, i32* [[LB:%.+]], i32* [[UB:%.+]], i32* %{{.+}}) +// CHECK: [[COND:%.+]] = icmp ne i32 [[NEXT]], 0 +// CHECK: br i1 [[COND]], label %[[CONT:.+]], label %[[END:.+]] +// CHECK: [[CONT]] +// CHECK: [[LB_VAL:%.+]] = load i32, i32* [[LB]], +// CHECK: store i32 [[LB_VAL]], i32* [[OMP_IV2:%[^,]+]], + +// CHECK: [[IV2:%.+]] = load i32, i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID:[0-9]+]] +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]] +// CHECK-NEXT: [[CMP2:%.+]] = icmp sle i32 [[IV2]], [[UB_VAL]] +// CHECK-NEXT: br i1 [[CMP2]], label %[[SIMPLE_LOOP2_BODY:.+]], label %[[SIMPLE_LOOP2_END:[^,]+]] + for (int i = 10; i > 1; i--) { +// CHECK: [[SIMPLE_LOOP2_BODY]] +// Start of body: calculate i from IV: +// CHECK: [[IV2_0:%.+]] = load i32, i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]] +// FIXME: It is interesting, why the following "mul 1" was not constant folded? +// CHECK-NEXT: [[IV2_1:%.+]] = mul nsw i32 [[IV2_0]], 1 +// CHECK-NEXT: [[LC_I_1:%.+]] = sub nsw i32 10, [[IV2_1]] +// CHECK-NEXT: store i32 [[LC_I_1]], i32* {{.+}}, !llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]] +// +// CHECK-NEXT: [[LIN0_1:%.+]] = load i64, i64* [[LIN0]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]] +// CHECK-NEXT: [[IV2_2:%.+]] = load i32, i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]] +// CHECK-NEXT: [[LIN_MUL1:%.+]] = mul nsw i32 [[IV2_2]], 3 +// CHECK-NEXT: [[LIN_EXT1:%.+]] = sext i32 [[LIN_MUL1]] to i64 +// CHECK-NEXT: [[LIN_ADD1:%.+]] = add nsw i64 [[LIN0_1]], [[LIN_EXT1]] +// Update of the privatized version of linear variable! +// CHECK-NEXT: store i64 [[LIN_ADD1]], i64* [[K_PRIVATIZED:%[^,]+]] + a[k]++; + k = k + 3; +// CHECK: [[IV2_2:%.+]] = load i32, i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]] +// CHECK-NEXT: [[ADD2_2:%.+]] = add nsw i32 [[IV2_2]], 1 +// CHECK-NEXT: store i32 [[ADD2_2]], i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]] +// br label {{.+}}, !llvm.loop ![[SIMPLE_LOOP2_ID]] + } +// CHECK: [[SIMPLE_LOOP2_END]] +// +// Update linear vars after loop, as the loop was operating on a private version. +// CHECK: [[LIN0_2:%.+]] = load i64, i64* [[LIN0]] +// CHECK-NEXT: [[LIN_ADD2:%.+]] = add nsw i64 [[LIN0_2]], 27 +// CHECK-NEXT: store i64 [[LIN_ADD2]], i64* [[K_VAR]] +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) + + int lin = 12; + #pragma omp for simd linear(lin : get_val()), linear(g_ptr) + +// Init linear private var. +// CHECK: store i32 12, i32* [[LIN_VAR:%[^,]+]] +// CHECK: [[LIN_LOAD:%.+]] = load i32, i32* [[LIN_VAR]] +// CHECK-NEXT: store i32 [[LIN_LOAD]], i32* [[LIN_START:%[^,]+]] +// Remember linear step. +// CHECK: [[CALL_VAL:%.+]] = invoke +// CHECK: store i64 [[CALL_VAL]], i64* [[LIN_STEP:%[^,]+]] + +// CHECK: [[GLIN_LOAD:%.+]] = load double*, double** [[GLIN_VAR:@[^,]+]] +// CHECK-NEXT: store double* [[GLIN_LOAD]], double** [[GLIN_START:%[^,]+]] + +// CHECK: call void @__kmpc_for_static_init_8u(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i64* [[LB:%[^,]+]], i64* [[UB:%[^,]+]], i64* [[STRIDE:%[^,]+]], i64 1, i64 1) +// CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]], +// CHECK: [[CMP:%.+]] = icmp ugt i64 [[UB_VAL]], 3 +// CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] +// CHECK: [[TRUE]] +// CHECK: br label %[[SWITCH:[^,]+]] +// CHECK: [[FALSE]] +// CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]], +// CHECK: br label %[[SWITCH]] +// CHECK: [[SWITCH]] +// CHECK: [[UP:%.+]] = phi i64 [ 3, %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] +// CHECK: store i64 [[UP]], i64* [[UB]], +// CHECK: [[LB_VAL:%.+]] = load i64, i64* [[LB]], +// CHECK: store i64 [[LB_VAL]], i64* [[OMP_IV3:%[^,]+]], + +// CHECK: [[IV3:%.+]] = load i64, i64* [[OMP_IV3]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID:[0-9]+]] +// CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] +// CHECK-NEXT: [[CMP3:%.+]] = icmp ule i64 [[IV3]], [[UB_VAL]] +// CHECK-NEXT: br i1 [[CMP3]], label %[[SIMPLE_LOOP3_BODY:.+]], label %[[SIMPLE_LOOP3_END:[^,]+]] + for (unsigned long long it = 2000; it >= 600; it-=400) { +// CHECK: [[SIMPLE_LOOP3_BODY]] +// Start of body: calculate it from IV: +// CHECK: [[IV3_0:%.+]] = load i64, i64* [[OMP_IV3]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] +// CHECK-NEXT: [[LC_IT_1:%.+]] = mul i64 [[IV3_0]], 400 +// CHECK-NEXT: [[LC_IT_2:%.+]] = sub i64 2000, [[LC_IT_1]] +// CHECK-NEXT: store i64 [[LC_IT_2]], i64* {{.+}}, !llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] +// +// Linear start and step are used to calculate current value of the linear variable. +// CHECK: [[LINSTART:.+]] = load i32, i32* [[LIN_START]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] +// CHECK: [[LINSTEP:.+]] = load i64, i64* [[LIN_STEP]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] +// CHECK-NOT: store i32 {{.+}}, i32* [[LIN_VAR]],{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] +// CHECK: [[GLINSTART:.+]] = load double*, double** [[GLIN_START]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] +// CHECK-NEXT: [[IV3_1:%.+]] = load i64, i64* [[OMP_IV3]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] +// CHECK-NEXT: [[MUL:%.+]] = mul i64 [[IV3_1]], 1 +// CHECK: [[GEP:%.+]] = getelementptr{{.*}}[[GLINSTART]] +// CHECK-NEXT: store double* [[GEP]], double** [[G_PTR_CUR:%[^,]+]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] + *g_ptr++ = 0.0; +// CHECK: [[GEP_VAL:%.+]] = load double{{.*}}[[G_PTR_CUR]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] +// CHECK: store double{{.*}}[[GEP_VAL]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] + a[it + lin]++; +// CHECK: [[FLT_INC:%.+]] = fadd float +// CHECK-NEXT: store float [[FLT_INC]],{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] +// CHECK: [[IV3_2:%.+]] = load i64, i64* [[OMP_IV3]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] +// CHECK-NEXT: [[ADD3_2:%.+]] = add i64 [[IV3_2]], 1 +// CHECK-NEXT: store i64 [[ADD3_2]], i64* [[OMP_IV3]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] + } +// CHECK: [[SIMPLE_LOOP3_END]] +// CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) +// +// Linear start and step are used to calculate final value of the linear variables. +// CHECK: [[LINSTART:.+]] = load i32, i32* [[LIN_START]] +// CHECK: [[LINSTEP:.+]] = load i64, i64* [[LIN_STEP]] +// CHECK: store i32 {{.+}}, i32* [[LIN_VAR]], +// CHECK: [[GLINSTART:.+]] = load double*, double** [[GLIN_START]] +// CHECK: store double* {{.*}}[[GLIN_VAR]] +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) + + #pragma omp for simd +// CHECK: call void @__kmpc_for_static_init_4(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i32* [[LB:%[^,]+]], i32* [[UB:%[^,]+]], i32* [[STRIDE:%[^,]+]], i32 1, i32 1) +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]], +// CHECK: [[CMP:%.+]] = icmp sgt i32 [[UB_VAL]], 3 +// CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] +// CHECK: [[TRUE]] +// CHECK: br label %[[SWITCH:[^,]+]] +// CHECK: [[FALSE]] +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]], +// CHECK: br label %[[SWITCH]] +// CHECK: [[SWITCH]] +// CHECK: [[UP:%.+]] = phi i32 [ 3, %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] +// CHECK: store i32 [[UP]], i32* [[UB]], +// CHECK: [[LB_VAL:%.+]] = load i32, i32* [[LB]], +// CHECK: store i32 [[LB_VAL]], i32* [[OMP_IV4:%[^,]+]], + +// CHECK: [[IV4:%.+]] = load i32, i32* [[OMP_IV4]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP4_ID:[0-9]+]] +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP4_ID]] +// CHECK-NEXT: [[CMP4:%.+]] = icmp sle i32 [[IV4]], [[UB_VAL]] +// CHECK-NEXT: br i1 [[CMP4]], label %[[SIMPLE_LOOP4_BODY:.+]], label %[[SIMPLE_LOOP4_END:[^,]+]] + for (short it = 6; it <= 20; it-=-4) { +// CHECK: [[SIMPLE_LOOP4_BODY]] +// Start of body: calculate it from IV: +// CHECK: [[IV4_0:%.+]] = load i32, i32* [[OMP_IV4]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP4_ID]] +// CHECK-NEXT: [[LC_IT_1:%.+]] = mul nsw i32 [[IV4_0]], 4 +// CHECK-NEXT: [[LC_IT_2:%.+]] = add nsw i32 6, [[LC_IT_1]] +// CHECK-NEXT: [[LC_IT_3:%.+]] = trunc i32 [[LC_IT_2]] to i16 +// CHECK-NEXT: store i16 [[LC_IT_3]], i16* {{.+}}, !llvm.mem.parallel_loop_access ![[SIMPLE_LOOP4_ID]] + +// CHECK: [[IV4_2:%.+]] = load i32, i32* [[OMP_IV4]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP4_ID]] +// CHECK-NEXT: [[ADD4_2:%.+]] = add nsw i32 [[IV4_2]], 1 +// CHECK-NEXT: store i32 [[ADD4_2]], i32* [[OMP_IV4]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP4_ID]] + } +// CHECK: [[SIMPLE_LOOP4_END]] +// CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) + + #pragma omp for simd +// CHECK: call void @__kmpc_for_static_init_4(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i32* [[LB:%[^,]+]], i32* [[UB:%[^,]+]], i32* [[STRIDE:%[^,]+]], i32 1, i32 1) +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]], +// CHECK: [[CMP:%.+]] = icmp sgt i32 [[UB_VAL]], 25 +// CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] +// CHECK: [[TRUE]] +// CHECK: br label %[[SWITCH:[^,]+]] +// CHECK: [[FALSE]] +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]], +// CHECK: br label %[[SWITCH]] +// CHECK: [[SWITCH]] +// CHECK: [[UP:%.+]] = phi i32 [ 25, %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] +// CHECK: store i32 [[UP]], i32* [[UB]], +// CHECK: [[LB_VAL:%.+]] = load i32, i32* [[LB]], +// CHECK: store i32 [[LB_VAL]], i32* [[OMP_IV5:%[^,]+]], + +// CHECK: [[IV5:%.+]] = load i32, i32* [[OMP_IV5]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP5_ID:[0-9]+]] +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP5_ID]] +// CHECK-NEXT: [[CMP5:%.+]] = icmp sle i32 [[IV5]], [[UB_VAL]] +// CHECK-NEXT: br i1 [[CMP5]], label %[[SIMPLE_LOOP5_BODY:.+]], label %[[SIMPLE_LOOP5_END:[^,]+]] + for (unsigned char it = 'z'; it >= 'a'; it+=-1) { +// CHECK: [[SIMPLE_LOOP5_BODY]] +// Start of body: calculate it from IV: +// CHECK: [[IV5_0:%.+]] = load i32, i32* [[OMP_IV5]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP5_ID]] +// CHECK-NEXT: [[IV5_1:%.+]] = mul nsw i32 [[IV5_0]], 1 +// CHECK-NEXT: [[LC_IT_1:%.+]] = sub nsw i32 122, [[IV5_1]] +// CHECK-NEXT: [[LC_IT_2:%.+]] = trunc i32 [[LC_IT_1]] to i8 +// CHECK-NEXT: store i8 [[LC_IT_2]], i8* {{.+}}, !llvm.mem.parallel_loop_access ![[SIMPLE_LOOP5_ID]] + +// CHECK: [[IV5_2:%.+]] = load i32, i32* [[OMP_IV5]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP5_ID]] +// CHECK-NEXT: [[ADD5_2:%.+]] = add nsw i32 [[IV5_2]], 1 +// CHECK-NEXT: store i32 [[ADD5_2]], i32* [[OMP_IV5]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP5_ID]] + } +// CHECK: [[SIMPLE_LOOP5_END]] +// CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) + +// CHECK-NOT: mul i32 %{{.+}}, 10 + #pragma omp for simd + for (unsigned i=100; i<10; i+=10) { + } + + int A; + #pragma omp parallel + { + // CHECK: store i32 -1, i32* [[A:%.+]], + A = -1; + #pragma omp for simd lastprivate(A) +// CHECK: call void @__kmpc_for_static_init_8(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i64* [[LB:%[^,]+]], i64* [[UB:%[^,]+]], i64* [[STRIDE:%[^,]+]], i64 1, i64 1) +// CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]], +// CHECK: [[CMP:%.+]] = icmp sgt i64 [[UB_VAL]], 6 +// CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] +// CHECK: [[TRUE]] +// CHECK: br label %[[SWITCH:[^,]+]] +// CHECK: [[FALSE]] +// CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]], +// CHECK: br label %[[SWITCH]] +// CHECK: [[SWITCH]] +// CHECK: [[UP:%.+]] = phi i64 [ 6, %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] +// CHECK: store i64 [[UP]], i64* [[UB]], +// CHECK: [[LB_VAL:%.+]] = load i64, i64* [[LB]], +// CHECK: store i64 [[LB_VAL]], i64* [[OMP_IV7:%[^,]+]], + +// CHECK: br label %[[SIMD_LOOP7_COND:[^,]+]] +// CHECK: [[SIMD_LOOP7_COND]] +// CHECK-NEXT: [[IV7:%.+]] = load i64, i64* [[OMP_IV7]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID:[0-9]+]] +// CHECK-NEXT: [[UB_VAL:%.+]] = load i64, i64* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]] +// CHECK-NEXT: [[CMP7:%.+]] = icmp sle i64 [[IV7]], [[UB_VAL]] +// CHECK-NEXT: br i1 [[CMP7]], label %[[SIMPLE_LOOP7_BODY:.+]], label %[[SIMPLE_LOOP7_END:[^,]+]] + for (long long i = -10; i < 10; i += 3) { +// CHECK: [[SIMPLE_LOOP7_BODY]] +// Start of body: calculate i from IV: +// CHECK: [[IV7_0:%.+]] = load i64, i64* [[OMP_IV7]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]] +// CHECK-NEXT: [[LC_IT_1:%.+]] = mul nsw i64 [[IV7_0]], 3 +// CHECK-NEXT: [[LC_IT_2:%.+]] = add nsw i64 -10, [[LC_IT_1]] +// CHECK-NEXT: store i64 [[LC_IT_2]], i64* [[LC:%[^,]+]],{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]] +// CHECK-NEXT: [[LC_VAL:%.+]] = load i64, i64* [[LC]]{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]] +// CHECK-NEXT: [[CONV:%.+]] = trunc i64 [[LC_VAL]] to i32 +// CHECK-NEXT: store i32 [[CONV]], i32* [[A_PRIV:%[^,]+]],{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]] + A = i; +// CHECK: [[IV7_2:%.+]] = load i64, i64* [[OMP_IV7]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]] +// CHECK-NEXT: [[ADD7_2:%.+]] = add nsw i64 [[IV7_2]], 1 +// CHECK-NEXT: store i64 [[ADD7_2]], i64* [[OMP_IV7]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]] + } +// CHECK: [[SIMPLE_LOOP7_END]] +// CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: load i32, i32* +// CHECK: icmp ne i32 %{{.+}}, 0 +// CHECK: br i1 %{{.+}}, label +// CHECK: [[A_PRIV_VAL:%.+]] = load i32, i32* [[A_PRIV]], +// CHECK-NEXT: store i32 [[A_PRIV_VAL]], i32* %{{.+}}, +// CHECK-NEXT: br label +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) + } + int R; + #pragma omp parallel + { + // CHECK: store i32 -1, i32* [[R:%[^,]+]], + R = -1; +// CHECK: store i32 1, i32* [[R_PRIV:%[^,]+]], + #pragma omp for simd reduction(*:R) +// CHECK: call void @__kmpc_for_static_init_8(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i64* [[LB:%[^,]+]], i64* [[UB:%[^,]+]], i64* [[STRIDE:%[^,]+]], i64 1, i64 1) +// CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]], +// CHECK: [[CMP:%.+]] = icmp sgt i64 [[UB_VAL]], 6 +// CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] +// CHECK: [[TRUE]] +// CHECK: br label %[[SWITCH:[^,]+]] +// CHECK: [[FALSE]] +// CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]], +// CHECK: br label %[[SWITCH]] +// CHECK: [[SWITCH]] +// CHECK: [[UP:%.+]] = phi i64 [ 6, %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] +// CHECK: store i64 [[UP]], i64* [[UB]], +// CHECK: [[LB_VAL:%.+]] = load i64, i64* [[LB]], +// CHECK: store i64 [[LB_VAL]], i64* [[OMP_IV8:%[^,]+]], + +// CHECK: br label %[[SIMD_LOOP8_COND:[^,]+]] +// CHECK: [[SIMD_LOOP8_COND]] +// CHECK-NEXT: [[IV8:%.+]] = load i64, i64* [[OMP_IV8]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID:[0-9]+]] +// CHECK-NEXT: [[UB_VAL:%.+]] = load i64, i64* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]] +// CHECK-NEXT: [[CMP8:%.+]] = icmp sle i64 [[IV8]], [[UB_VAL]] +// CHECK-NEXT: br i1 [[CMP8]], label %[[SIMPLE_LOOP8_BODY:.+]], label %[[SIMPLE_LOOP8_END:[^,]+]] + for (long long i = -10; i < 10; i += 3) { +// CHECK: [[SIMPLE_LOOP8_BODY]] +// Start of body: calculate i from IV: +// CHECK: [[IV8_0:%.+]] = load i64, i64* [[OMP_IV8]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]] +// CHECK-NEXT: [[LC_IT_1:%.+]] = mul nsw i64 [[IV8_0]], 3 +// CHECK-NEXT: [[LC_IT_2:%.+]] = add nsw i64 -10, [[LC_IT_1]] +// CHECK-NEXT: store i64 [[LC_IT_2]], i64* [[LC:%[^,]+]],{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]] +// CHECK-NEXT: [[LC_VAL:%.+]] = load i64, i64* [[LC]]{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]] +// CHECK: store i32 %{{.+}}, i32* [[R_PRIV]],{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]] + R *= i; +// CHECK: [[IV8_2:%.+]] = load i64, i64* [[OMP_IV8]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]] +// CHECK-NEXT: [[ADD8_2:%.+]] = add nsw i64 [[IV8_2]], 1 +// CHECK-NEXT: store i64 [[ADD8_2]], i64* [[OMP_IV8]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]] + } +// CHECK: [[SIMPLE_LOOP8_END]] +// CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call i32 @__kmpc_reduce( +// CHECK: [[R_PRIV_VAL:%.+]] = load i32, i32* [[R_PRIV]], +// CHECK: [[RED:%.+]] = mul nsw i32 %{{.+}}, [[R_PRIV_VAL]] +// CHECK-NEXT: store i32 [[RED]], i32* %{{.+}}, +// CHECK-NEXT: call void @__kmpc_end_reduce( +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) + } +} + +template <class T, unsigned K> T tfoo(T a) { return a + K; } + +template <typename T, unsigned N> +int templ1(T a, T *z) { + #pragma omp for simd collapse(N) + for (int i = 0; i < N * 2; i++) { + for (long long j = 0; j < (N + N + N + N); j += 2) { + z[i + j] = a + tfoo<T, N>(i + j); + } + } + return 0; +} + +// Instatiation templ1<float,2> +// CHECK-LABEL: define {{.*i32}} @{{.*}}templ1{{.*}}(float {{.+}}, float* {{.+}}) +// CHECK: call void @__kmpc_for_static_init_8(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i64* [[LB:%[^,]+]], i64* [[UB:%[^,]+]], i64* [[STRIDE:%[^,]+]], i64 1, i64 1) +// CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]], +// CHECK: [[CMP:%.+]] = icmp sgt i64 [[UB_VAL]], 15 +// CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] +// CHECK: [[TRUE]] +// CHECK: br label %[[SWITCH:[^,]+]] +// CHECK: [[FALSE]] +// CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]], +// CHECK: br label %[[SWITCH]] +// CHECK: [[SWITCH]] +// CHECK: [[UP:%.+]] = phi i64 [ 15, %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] +// CHECK: store i64 [[UP]], i64* [[UB]], +// CHECK: [[LB_VAL:%.+]] = load i64, i64* [[LB]], +// CHECK: store i64 [[LB_VAL]], i64* [[T1_OMP_IV:%[^,]+]], + +// ... +// CHECK: [[IV:%.+]] = load i64, i64* [[T1_OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID:[0-9]+]] +// CHECK-NEXT: [[UB_VAL:%.+]] = load i64, i64* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]] +// CHECK-NEXT: [[CMP1:%.+]] = icmp sle i64 [[IV]], [[UB_VAL]] +// CHECK-NEXT: br i1 [[CMP1]], label %[[T1_BODY:.+]], label %[[T1_END:[^,]+]] +// CHECK: [[T1_BODY]] +// Loop counters i and j updates: +// CHECK: [[IV1:%.+]] = load i64, i64* [[T1_OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]] +// CHECK-NEXT: [[I_1:%.+]] = sdiv i64 [[IV1]], 4 +// CHECK-NEXT: [[I_1_MUL1:%.+]] = mul nsw i64 [[I_1]], 1 +// CHECK-NEXT: [[I_1_ADD0:%.+]] = add nsw i64 0, [[I_1_MUL1]] +// CHECK-NEXT: [[I_2:%.+]] = trunc i64 [[I_1_ADD0]] to i32 +// CHECK-NEXT: store i32 [[I_2]], i32* {{%.+}}{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]] +// CHECK: [[IV2:%.+]] = load i64, i64* [[T1_OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]] +// CHECK-NEXT: [[J_1:%.+]] = srem i64 [[IV2]], 4 +// CHECK-NEXT: [[J_2:%.+]] = mul nsw i64 [[J_1]], 2 +// CHECK-NEXT: [[J_2_ADD0:%.+]] = add nsw i64 0, [[J_2]] +// CHECK-NEXT: store i64 [[J_2_ADD0]], i64* {{%.+}}{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]] +// simd.for.inc: +// CHECK: [[IV3:%.+]] = load i64, i64* [[T1_OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]] +// CHECK-NEXT: [[INC:%.+]] = add nsw i64 [[IV3]], 1 +// CHECK-NEXT: store i64 [[INC]], i64* [[T1_OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]] +// CHECK-NEXT: br label {{%.+}} +// CHECK: [[T1_END]] +// CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: ret i32 0 +// +void inst_templ1() { + float a; + float z[100]; + templ1<float,2> (a, z); +} + + +typedef int MyIdx; + +class IterDouble { + double *Ptr; +public: + IterDouble operator++ () const { + IterDouble n; + n.Ptr = Ptr + 1; + return n; + } + bool operator < (const IterDouble &that) const { + return Ptr < that.Ptr; + } + double & operator *() const { + return *Ptr; + } + MyIdx operator - (const IterDouble &that) const { + return (MyIdx) (Ptr - that.Ptr); + } + IterDouble operator + (int Delta) { + IterDouble re; + re.Ptr = Ptr + Delta; + return re; + } + + ///~IterDouble() {} +}; + +// CHECK-LABEL: define {{.*void}} @{{.*}}iter_simple{{.*}} +void iter_simple(IterDouble ia, IterDouble ib, IterDouble ic) { +// +// Calculate number of iterations before the loop body. +// CHECK: [[DIFF1:%.+]] = invoke {{.*}}i32 @{{.*}}IterDouble{{.*}} +// CHECK: [[DIFF2:%.+]] = sub nsw i32 [[DIFF1]], 1 +// CHECK-NEXT: [[DIFF3:%.+]] = add nsw i32 [[DIFF2]], 1 +// CHECK-NEXT: [[DIFF4:%.+]] = sdiv i32 [[DIFF3]], 1 +// CHECK-NEXT: [[DIFF5:%.+]] = sub nsw i32 [[DIFF4]], 1 +// CHECK-NEXT: store i32 [[DIFF5]], i32* [[OMP_LAST_IT:%[^,]+]]{{.+}} + #pragma omp for simd + +// CHECK: call void @__kmpc_for_static_init_4(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i32* [[LB:%[^,]+]], i32* [[UB:%[^,]+]], i32* [[STRIDE:%[^,]+]], i32 1, i32 1) +// CHECK-DAG: [[UB_VAL:%.+]] = load i32, i32* [[UB]], +// CHECK-DAG: [[OMP_LAST_IT_VAL:%.+]] = load i32, i32* [[OMP_LAST_IT]], +// CHECK: [[CMP:%.+]] = icmp sgt i32 [[UB_VAL]], [[OMP_LAST_IT_VAL]] +// CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] +// CHECK: [[TRUE]] +// CHECK: [[OMP_LAST_IT_VAL:%.+]] = load i32, i32* [[OMP_LAST_IT]], +// CHECK: br label %[[SWITCH:[^,]+]] +// CHECK: [[FALSE]] +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]], +// CHECK: br label %[[SWITCH]] +// CHECK: [[SWITCH]] +// CHECK: [[UP:%.+]] = phi i32 [ [[OMP_LAST_IT_VAL]], %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] +// CHECK: store i32 [[UP]], i32* [[UB]], +// CHECK: [[LB_VAL:%.+]] = load i32, i32* [[LB]], +// CHECK: store i32 [[LB_VAL]], i32* [[IT_OMP_IV:%[^,]+]], + +// CHECK: [[IV:%.+]] = load i32, i32* [[IT_OMP_IV]]{{.+}} !llvm.mem.parallel_loop_access ![[ITER_LOOP_ID:[0-9]+]] +// CHECK-NEXT: [[UB_VAL:%.+]] = load i32, i32* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]] +// CHECK-NEXT: [[CMP:%.+]] = icmp sle i32 [[IV]], [[UB_VAL]] +// CHECK-NEXT: br i1 [[CMP]], label %[[IT_BODY:[^,]+]], label %[[IT_END:[^,]+]] + for (IterDouble i = ia; i < ib; ++i) { +// CHECK: [[IT_BODY]] +// Start of body: calculate i from index: +// CHECK: [[IV1:%.+]] = load i32, i32* [[IT_OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]] +// Call of operator+ (i, IV). +// CHECK: {{%.+}} = invoke {{.+}} @{{.*}}IterDouble{{.*}} +// ... loop body ... + *i = *ic * 0.5; +// Float multiply and save result. +// CHECK: [[MULR:%.+]] = fmul double {{%.+}}, 5.000000e-01 +// CHECK-NEXT: invoke {{.+}} @{{.*}}IterDouble{{.*}} +// CHECK: store double [[MULR:%.+]], double* [[RESULT_ADDR:%.+]], !llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]] + ++ic; +// +// CHECK: [[IV2:%.+]] = load i32, i32* [[IT_OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]] +// CHECK-NEXT: [[ADD2:%.+]] = add nsw i32 [[IV2]], 1 +// CHECK-NEXT: store i32 [[ADD2]], i32* [[IT_OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]] +// br label %{{.*}}, !llvm.loop ![[ITER_LOOP_ID]] + } +// CHECK: [[IT_END]] +// CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: ret void +} + + +// CHECK-LABEL: define {{.*void}} @{{.*}}collapsed{{.*}} +void collapsed(float *a, float *b, float *c, float *d) { + int i; // outer loop counter + unsigned j; // middle loop couter, leads to unsigned icmp in loop header. + // k declared in the loop init below + short l; // inner loop counter +// CHECK: call void @__kmpc_for_static_init_4u(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i32* [[LB:%[^,]+]], i32* [[UB:%[^,]+]], i32* [[STRIDE:%[^,]+]], i32 1, i32 1) +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]], +// CHECK: [[CMP:%.+]] = icmp ugt i32 [[UB_VAL]], 119 +// CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] +// CHECK: [[TRUE]] +// CHECK: br label %[[SWITCH:[^,]+]] +// CHECK: [[FALSE]] +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]], +// CHECK: br label %[[SWITCH]] +// CHECK: [[SWITCH]] +// CHECK: [[UP:%.+]] = phi i32 [ 119, %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] +// CHECK: store i32 [[UP]], i32* [[UB]], +// CHECK: [[LB_VAL:%.+]] = load i32, i32* [[LB]], +// CHECK: store i32 [[LB_VAL]], i32* [[OMP_IV:%[^,]+]], +// + #pragma omp for simd collapse(4) + +// CHECK: [[IV:%.+]] = load i32, i32* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID:[0-9]+]] +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]] +// CHECK-NEXT: [[CMP:%.+]] = icmp ule i32 [[IV]], [[UB_VAL]] +// CHECK-NEXT: br i1 [[CMP]], label %[[COLL1_BODY:[^,]+]], label %[[COLL1_END:[^,]+]] + for (i = 1; i < 3; i++) // 2 iterations + for (j = 2u; j < 5u; j++) //3 iterations + for (int k = 3; k <= 6; k++) // 4 iterations + for (l = 4; l < 9; ++l) // 5 iterations + { +// CHECK: [[COLL1_BODY]] +// Start of body: calculate i from index: +// CHECK: [[IV1:%.+]] = load i32, i32* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]] +// Calculation of the loop counters values. +// CHECK: [[CALC_I_1:%.+]] = udiv i32 [[IV1]], 60 +// CHECK-NEXT: [[CALC_I_1_MUL1:%.+]] = mul i32 [[CALC_I_1]], 1 +// CHECK-NEXT: [[CALC_I_2:%.+]] = add i32 1, [[CALC_I_1_MUL1]] +// CHECK-NEXT: store i32 [[CALC_I_2]], i32* [[LC_I:.+]] +// CHECK: [[IV1_2:%.+]] = load i32, i32* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]] +// CHECK-NEXT: [[CALC_J_1:%.+]] = udiv i32 [[IV1_2]], 20 +// CHECK-NEXT: [[CALC_J_2:%.+]] = urem i32 [[CALC_J_1]], 3 +// CHECK-NEXT: [[CALC_J_2_MUL1:%.+]] = mul i32 [[CALC_J_2]], 1 +// CHECK-NEXT: [[CALC_J_3:%.+]] = add i32 2, [[CALC_J_2_MUL1]] +// CHECK-NEXT: store i32 [[CALC_J_3]], i32* [[LC_J:.+]] +// CHECK: [[IV1_3:%.+]] = load i32, i32* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]] +// CHECK-NEXT: [[CALC_K_1:%.+]] = udiv i32 [[IV1_3]], 5 +// CHECK-NEXT: [[CALC_K_2:%.+]] = urem i32 [[CALC_K_1]], 4 +// CHECK-NEXT: [[CALC_K_2_MUL1:%.+]] = mul i32 [[CALC_K_2]], 1 +// CHECK-NEXT: [[CALC_K_3:%.+]] = add i32 3, [[CALC_K_2_MUL1]] +// CHECK-NEXT: store i32 [[CALC_K_3]], i32* [[LC_K:.+]] +// CHECK: [[IV1_4:%.+]] = load i32, i32* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]] +// CHECK-NEXT: [[CALC_L_1:%.+]] = urem i32 [[IV1_4]], 5 +// CHECK-NEXT: [[CALC_L_1_MUL1:%.+]] = mul i32 [[CALC_L_1]], 1 +// CHECK-NEXT: [[CALC_L_2:%.+]] = add i32 4, [[CALC_L_1_MUL1]] +// CHECK-NEXT: [[CALC_L_3:%.+]] = trunc i32 [[CALC_L_2]] to i16 +// CHECK-NEXT: store i16 [[CALC_L_3]], i16* [[LC_L:.+]] +// ... loop body ... +// End of body: store into a[i]: +// CHECK: store float [[RESULT:%.+]], float* [[RESULT_ADDR:%.+]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]] + float res = b[j] * c[k]; + a[i] = res * d[l]; +// CHECK: [[IV2:%.+]] = load i32, i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]] +// CHECK-NEXT: [[ADD2:%.+]] = add i32 [[IV2]], 1 +// CHECK-NEXT: store i32 [[ADD2]], i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]] +// br label %{{[^,]+}}, !llvm.loop ![[COLL1_LOOP_ID]] +// CHECK: [[COLL1_END]] + } +// i,j,l are updated; k is not updated. +// CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK-NEXT: store i32 3, i32* [[I:%[^,]+]] +// CHECK-NEXT: store i32 5, i32* [[I:%[^,]+]] +// CHECK-NEXT: store i16 9, i16* [[I:%[^,]+]] +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: ret void +} + +extern char foo(); +extern double globalfloat; + +// CHECK-LABEL: define {{.*void}} @{{.*}}widened{{.*}} +void widened(float *a, float *b, float *c, float *d) { + int i; // outer loop counter + short j; // inner loop counter + globalfloat = 1.0; + int localint = 1; +// CHECK: store double {{.+}}, double* [[GLOBALFLOAT:@.+]] +// Counter is widened to 64 bits. +// CHECK: [[MUL:%.+]] = mul nsw i64 2, %{{.+}} +// CHECK-NEXT: [[SUB:%.+]] = sub nsw i64 [[MUL]], 1 +// CHECK-NEXT: store i64 [[SUB]], i64* [[OMP_LAST_IT:%[^,]+]], +// CHECK: call void @__kmpc_for_static_init_8(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i64* [[LB:%[^,]+]], i64* [[UB:%[^,]+]], i64* [[STRIDE:%[^,]+]], i64 1, i64 1) +// CHECK-DAG: [[UB_VAL:%.+]] = load i64, i64* [[UB]], +// CHECK-DAG: [[OMP_LAST_IT_VAL:%.+]] = load i64, i64* [[OMP_LAST_IT]], +// CHECK: [[CMP:%.+]] = icmp sgt i64 [[UB_VAL]], [[OMP_LAST_IT_VAL]] +// CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] +// CHECK: [[TRUE]] +// CHECK: [[OMP_LAST_IT_VAL:%.+]] = load i64, i64* [[OMP_LAST_IT]], +// CHECK: br label %[[SWITCH:[^,]+]] +// CHECK: [[FALSE]] +// CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]], +// CHECK: br label %[[SWITCH]] +// CHECK: [[SWITCH]] +// CHECK: [[UP:%.+]] = phi i64 [ [[OMP_LAST_IT_VAL]], %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] +// CHECK: store i64 [[UP]], i64* [[UB]], +// CHECK: [[LB_VAL:%.+]] = load i64, i64* [[LB]], +// CHECK: store i64 [[LB_VAL]], i64* [[OMP_IV:%[^,]+]], +// + #pragma omp for simd collapse(2) private(globalfloat, localint) + +// CHECK: [[IV:%.+]] = load i64, i64* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID:[0-9]+]] +// CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]] +// CHECK-NEXT: [[CMP:%.+]] = icmp sle i64 [[IV]], [[UB_VAL]] +// CHECK-NEXT: br i1 [[CMP]], label %[[WIDE1_BODY:[^,]+]], label %[[WIDE1_END:[^,]+]] + for (i = 1; i < 3; i++) // 2 iterations + for (j = 0; j < foo(); j++) // foo() iterations + { +// CHECK: [[WIDE1_BODY]] +// Start of body: calculate i from index: +// CHECK: [[IV1:%.+]] = load i64, i64* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]] +// Calculation of the loop counters values... +// CHECK: store i32 {{[^,]+}}, i32* [[LC_I:.+]] +// CHECK: [[IV1_2:%.+]] = load i64, i64* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]] +// CHECK: store i16 {{[^,]+}}, i16* [[LC_J:.+]] +// ... loop body ... +// +// Here we expect store into private double var, not global +// CHECK-NOT: store double {{.+}}, double* [[GLOBALFLOAT]] + globalfloat = (float)j/i; + float res = b[j] * c[j]; +// Store into a[i]: +// CHECK: store float [[RESULT:%.+]], float* [[RESULT_ADDR:%.+]]{{.+}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]] + a[i] = res * d[i]; +// Then there's a store into private var localint: +// CHECK: store i32 {{.+}}, i32* [[LOCALINT:%[^,]+]]{{.+}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]] + localint = (int)j; +// CHECK: [[IV2:%.+]] = load i64, i64* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]] +// CHECK-NEXT: [[ADD2:%.+]] = add nsw i64 [[IV2]], 1 +// CHECK-NEXT: store i64 [[ADD2]], i64* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]] +// +// br label %{{[^,]+}}, !llvm.loop ![[WIDE1_LOOP_ID]] +// CHECK: [[WIDE1_END]] + } +// i,j are updated. +// CHECK: store i32 3, i32* [[I:%[^,]+]] +// CHECK: store i16 +// +// Here we expect store into original localint, not its privatized version. +// CHECK-NOT: store i32 {{.+}}, i32* [[LOCALINT]] + localint = (int)j; +// CHECK: ret void +} + +// TERM_DEBUG-LABEL: bar +int bar() {return 0;}; + +// TERM_DEBUG-LABEL: parallel_simd +void parallel_simd(float *a) { +#pragma omp parallel +#pragma omp for simd + // TERM_DEBUG-NOT: __kmpc_global_thread_num + // TERM_DEBUG: invoke i32 {{.*}}bar{{.*}}() + // TERM_DEBUG: unwind label %[[TERM_LPAD:.+]], + // TERM_DEBUG-NOT: __kmpc_global_thread_num + // TERM_DEBUG: [[TERM_LPAD]] + // TERM_DEBUG: call void @__clang_call_terminate + // TERM_DEBUG: unreachable + for (unsigned i = 131071; i <= 2147483647; i += 127) + a[i] += bar(); +} +// TERM_DEBUG: !{{[0-9]+}} = !DILocation(line: [[@LINE-11]], +#endif // HEADER + diff --git a/test/OpenMP/parallel_for_codegen.cpp b/test/OpenMP/parallel_for_codegen.cpp index 43bf832..6262e76 100644 --- a/test/OpenMP/parallel_for_codegen.cpp +++ b/test/OpenMP/parallel_for_codegen.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -gline-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG +// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -O1 -fopenmp -emit-llvm %s -o - | FileCheck %s --check-prefix=CLEANUP // // expected-no-diagnostics #ifndef HEADER @@ -376,6 +377,7 @@ void runtime(float *a, float *b, float *c, float *d) { int foo() {return 0;}; // TERM_DEBUG-LABEL: parallel_for +// CLEANUP: parallel_for void parallel_for(float *a) { #pragma omp parallel for schedule(static, 5) // TERM_DEBUG-NOT: __kmpc_global_thread_num @@ -388,13 +390,17 @@ void parallel_for(float *a) { // TERM_DEBUG: [[TERM_LPAD]] // TERM_DEBUG: call void @__clang_call_terminate // TERM_DEBUG: unreachable + // CLEANUP-NOT: __kmpc_global_thread_num + // CLEANUP: call void @__kmpc_for_static_init_4u({{.+}}) + // CLEANUP: call void @__kmpc_for_static_fini({{.+}}) + // CLEANUP: call {{.+}} @__kmpc_cancel_barrier({{.+}}) for (unsigned i = 131071; i <= 2147483647; i += 127) a[i] += foo(); } // Check source line corresponds to "#pragma omp parallel for schedule(static, 5)" above: // TERM_DEBUG-DAG: [[DBG_LOC_START]] = !DILocation(line: [[@LINE-4]], -// TERM_DEBUG-DAG: [[DBG_LOC_END]] = !DILocation(line: [[@LINE-16]], -// TERM_DEBUG-DAG: [[DBG_LOC_CANCEL]] = !DILocation(line: [[@LINE-17]], +// TERM_DEBUG-DAG: [[DBG_LOC_END]] = !DILocation(line: [[@LINE-20]], +// TERM_DEBUG-DAG: [[DBG_LOC_CANCEL]] = !DILocation(line: [[@LINE-21]], #endif // HEADER diff --git a/test/OpenMP/parallel_for_simd_codegen.cpp b/test/OpenMP/parallel_for_simd_codegen.cpp new file mode 100644 index 0000000..3490b8f --- /dev/null +++ b/test/OpenMP/parallel_for_simd_codegen.cpp @@ -0,0 +1,696 @@ +// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s +// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -g -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -gline-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG +// +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +long long get_val() { return 0; } +double *g_ptr; + +// CHECK-LABEL: define {{.*void}} @{{.*}}simple{{.*}}(float* {{.+}}, float* {{.+}}, float* {{.+}}, float* {{.+}}) +void simple(float *a, float *b, float *c, float *d) { +// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( +// CHECK: [[K0:%.+]] = call {{.*}}i64 @{{.*}}get_val +// CHECK-NEXT: store i64 [[K0]], i64* [[K_VAR:%[^,]+]] +// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( +// CHECK: store i32 12, i32* [[LIN_VAR:%[^,]+]] +// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( +// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( +// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( +// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( +// CHECK: store i32 -1, i32* [[A:%.+]], +// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( +// CHECK: store i32 -1, i32* [[R:%[^,]+]], +// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( + #pragma omp parallel for simd +// CHECK: call void @__kmpc_for_static_init_4(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i32* [[LB:%[^,]+]], i32* [[UB:%[^,]+]], i32* [[STRIDE:%[^,]+]], i32 1, i32 1) +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]], +// CHECK: [[CMP:%.+]] = icmp sgt i32 [[UB_VAL]], 5 +// CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] +// CHECK: [[TRUE]] +// CHECK: br label %[[SWITCH:[^,]+]] +// CHECK: [[FALSE]] +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]], +// CHECK: br label %[[SWITCH]] +// CHECK: [[SWITCH]] +// CHECK: [[UP:%.+]] = phi i32 [ 5, %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] +// CHECK: store i32 [[UP]], i32* [[UB]], +// CHECK: [[LB_VAL:%.+]] = load i32, i32* [[LB]], +// CHECK: store i32 [[LB_VAL]], i32* [[OMP_IV:%[^,]+]], + +// CHECK: [[IV:%.+]] = load i32, i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID:[0-9]+]] +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID]] +// CHECK-NEXT: [[CMP:%.+]] = icmp sle i32 [[IV]], [[UB_VAL]] +// CHECK-NEXT: br i1 [[CMP]], label %[[SIMPLE_LOOP1_BODY:.+]], label %[[SIMPLE_LOOP1_END:[^,]+]] + for (int i = 3; i < 32; i += 5) { +// CHECK: [[SIMPLE_LOOP1_BODY]] +// Start of body: calculate i from IV: +// CHECK: [[IV1_1:%.+]] = load i32, i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID]] +// CHECK: [[CALC_I_1:%.+]] = mul nsw i32 [[IV1_1]], 5 +// CHECK-NEXT: [[CALC_I_2:%.+]] = add nsw i32 3, [[CALC_I_1]] +// CHECK-NEXT: store i32 [[CALC_I_2]], i32* [[LC_I:.+]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID]] +// ... loop body ... +// End of body: store into a[i]: +// CHECK: store float [[RESULT:%.+]], float* {{%.+}}{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID]] + a[i] = b[i] * c[i] * d[i]; +// CHECK: [[IV1_2:%.+]] = load i32, i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID]] +// CHECK-NEXT: [[ADD1_2:%.+]] = add nsw i32 [[IV1_2]], 1 +// CHECK-NEXT: store i32 [[ADD1_2]], i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID]] +// br label %{{.+}}, !llvm.loop !{{.+}} + } +// CHECK: [[SIMPLE_LOOP1_END]] +// CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) + + long long k = get_val(); + + #pragma omp parallel for simd linear(k : 3) schedule(dynamic) +// CHECK: [[K0LOAD:%.+]] = load i64, i64* [[K_VAR:%[^,]+]] +// CHECK-NEXT: store i64 [[K0LOAD]], i64* [[LIN0:%[^,]+]] + +// CHECK: call void @__kmpc_dispatch_init_4(%ident_t* {{.+}}, i32 %{{.+}}, i32 35, i32 0, i32 8, i32 1, i32 1) +// CHECK: [[NEXT:%.+]] = call i32 @__kmpc_dispatch_next_4(%ident_t* {{.+}}, i32 %{{.+}}, i32* %{{.+}}, i32* [[LB:%.+]], i32* [[UB:%.+]], i32* %{{.+}}) +// CHECK: [[COND:%.+]] = icmp ne i32 [[NEXT]], 0 +// CHECK: br i1 [[COND]], label %[[CONT:.+]], label %[[END:.+]] +// CHECK: [[CONT]] +// CHECK: [[LB_VAL:%.+]] = load i32, i32* [[LB]], +// CHECK: store i32 [[LB_VAL]], i32* [[OMP_IV2:%[^,]+]], + +// CHECK: [[IV2:%.+]] = load i32, i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID:[0-9]+]] +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]] +// CHECK-NEXT: [[CMP2:%.+]] = icmp sle i32 [[IV2]], [[UB_VAL]] +// CHECK-NEXT: br i1 [[CMP2]], label %[[SIMPLE_LOOP2_BODY:.+]], label %[[SIMPLE_LOOP2_END:[^,]+]] + for (int i = 10; i > 1; i--) { +// CHECK: [[SIMPLE_LOOP2_BODY]] +// Start of body: calculate i from IV: +// CHECK: [[IV2_0:%.+]] = load i32, i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]] +// FIXME: It is interesting, why the following "mul 1" was not constant folded? +// CHECK-NEXT: [[IV2_1:%.+]] = mul nsw i32 [[IV2_0]], 1 +// CHECK-NEXT: [[LC_I_1:%.+]] = sub nsw i32 10, [[IV2_1]] +// CHECK-NEXT: store i32 [[LC_I_1]], i32* {{.+}}, !llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]] +// +// CHECK-NEXT: [[LIN0_1:%.+]] = load i64, i64* [[LIN0]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]] +// CHECK-NEXT: [[IV2_2:%.+]] = load i32, i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]] +// CHECK-NEXT: [[LIN_MUL1:%.+]] = mul nsw i32 [[IV2_2]], 3 +// CHECK-NEXT: [[LIN_EXT1:%.+]] = sext i32 [[LIN_MUL1]] to i64 +// CHECK-NEXT: [[LIN_ADD1:%.+]] = add nsw i64 [[LIN0_1]], [[LIN_EXT1]] +// Update of the privatized version of linear variable! +// CHECK-NEXT: store i64 [[LIN_ADD1]], i64* [[K_PRIVATIZED:%[^,]+]] + a[k]++; + k = k + 3; +// CHECK: [[IV2_2:%.+]] = load i32, i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]] +// CHECK-NEXT: [[ADD2_2:%.+]] = add nsw i32 [[IV2_2]], 1 +// CHECK-NEXT: store i32 [[ADD2_2]], i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]] +// br label {{.+}}, !llvm.loop ![[SIMPLE_LOOP2_ID]] + } +// CHECK: [[SIMPLE_LOOP2_END]] +// +// Update linear vars after loop, as the loop was operating on a private version. +// CHECK: [[LIN0_2:%.+]] = load i64, i64* [[LIN0]] +// CHECK-NEXT: [[LIN_ADD2:%.+]] = add nsw i64 [[LIN0_2]], 27 +// CHECK-NEXT: store i64 [[LIN_ADD2]], i64* %{{.+}} +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) + + int lin = 12; + #pragma omp parallel for simd linear(lin : get_val()), linear(g_ptr) + +// Init linear private var. +// CHECK: [[LIN_VAR:%.+]] = load i32*, i32** % +// CHECK-NEXT: [[LIN_LOAD:%.+]] = load i32, i32* [[LIN_VAR]] +// CHECK-NEXT: store i32 [[LIN_LOAD]], i32* [[LIN_START:%[^,]+]] +// Remember linear step. +// CHECK: [[CALL_VAL:%.+]] = invoke +// CHECK: store i64 [[CALL_VAL]], i64* [[LIN_STEP:%[^,]+]] + +// CHECK: [[GLIN_VAR:%.+]] = load double**, double*** % +// CHECK-NEXT: [[GLIN_LOAD:%.+]] = load double*, double** [[GLIN_VAR]] +// CHECK-NEXT: store double* [[GLIN_LOAD]], double** [[GLIN_START:%[^,]+]] + +// CHECK: call void @__kmpc_for_static_init_8u(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i64* [[LB:%[^,]+]], i64* [[UB:%[^,]+]], i64* [[STRIDE:%[^,]+]], i64 1, i64 1) +// CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]], +// CHECK: [[CMP:%.+]] = icmp ugt i64 [[UB_VAL]], 3 +// CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] +// CHECK: [[TRUE]] +// CHECK: br label %[[SWITCH:[^,]+]] +// CHECK: [[FALSE]] +// CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]], +// CHECK: br label %[[SWITCH]] +// CHECK: [[SWITCH]] +// CHECK: [[UP:%.+]] = phi i64 [ 3, %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] +// CHECK: store i64 [[UP]], i64* [[UB]], +// CHECK: [[LB_VAL:%.+]] = load i64, i64* [[LB]], +// CHECK: store i64 [[LB_VAL]], i64* [[OMP_IV3:%[^,]+]], + +// CHECK: [[IV3:%.+]] = load i64, i64* [[OMP_IV3]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID:[0-9]+]] +// CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] +// CHECK-NEXT: [[CMP3:%.+]] = icmp ule i64 [[IV3]], [[UB_VAL]] +// CHECK-NEXT: br i1 [[CMP3]], label %[[SIMPLE_LOOP3_BODY:.+]], label %[[SIMPLE_LOOP3_END:[^,]+]] + for (unsigned long long it = 2000; it >= 600; it-=400) { +// CHECK: [[SIMPLE_LOOP3_BODY]] +// Start of body: calculate it from IV: +// CHECK: [[IV3_0:%.+]] = load i64, i64* [[OMP_IV3]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] +// CHECK-NEXT: [[LC_IT_1:%.+]] = mul i64 [[IV3_0]], 400 +// CHECK-NEXT: [[LC_IT_2:%.+]] = sub i64 2000, [[LC_IT_1]] +// CHECK-NEXT: store i64 [[LC_IT_2]], i64* {{.+}}, !llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] +// +// Linear start and step are used to calculate current value of the linear variable. +// CHECK: [[LINSTART:.+]] = load i32, i32* [[LIN_START]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] +// CHECK: [[LINSTEP:.+]] = load i64, i64* [[LIN_STEP]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] +// CHECK-NOT: store i32 {{.+}}, i32* [[LIN_VAR]],{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] +// CHECK: [[GLINSTART:.+]] = load double*, double** [[GLIN_START]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] +// CHECK-NEXT: [[IV3_1:%.+]] = load i64, i64* [[OMP_IV3]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] +// CHECK-NEXT: [[MUL:%.+]] = mul i64 [[IV3_1]], 1 +// CHECK: [[GEP:%.+]] = getelementptr{{.*}}[[GLINSTART]] +// CHECK-NEXT: store double* [[GEP]], double** [[G_PTR_CUR:%[^,]+]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] + *g_ptr++ = 0.0; +// CHECK: [[GEP_VAL:%.+]] = load double{{.*}}[[G_PTR_CUR]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] +// CHECK: store double{{.*}}[[GEP_VAL]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] + a[it + lin]++; +// CHECK: [[FLT_INC:%.+]] = fadd float +// CHECK-NEXT: store float [[FLT_INC]],{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] +// CHECK: [[IV3_2:%.+]] = load i64, i64* [[OMP_IV3]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] +// CHECK-NEXT: [[ADD3_2:%.+]] = add i64 [[IV3_2]], 1 +// CHECK-NEXT: store i64 [[ADD3_2]], i64* [[OMP_IV3]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]] + } +// CHECK: [[SIMPLE_LOOP3_END]] +// CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) +// +// Linear start and step are used to calculate final value of the linear variables. +// CHECK: [[LIN_VAR:%.+]] = load i32*, i32** % +// CHECK: [[LINSTART:.+]] = load i32, i32* [[LIN_START]] +// CHECK: [[LINSTEP:.+]] = load i64, i64* [[LIN_STEP]] +// CHECK: store i32 {{.+}}, i32* [[LIN_VAR]], +// CHECK: [[GLIN_VAR:%.+]] = load double**, double*** % +// CHECK: [[GLINSTART:.+]] = load double*, double** [[GLIN_START]] +// CHECK: store double* {{.*}}[[GLIN_VAR]] +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) + + #pragma omp parallel for simd +// CHECK: call void @__kmpc_for_static_init_4(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i32* [[LB:%[^,]+]], i32* [[UB:%[^,]+]], i32* [[STRIDE:%[^,]+]], i32 1, i32 1) +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]], +// CHECK: [[CMP:%.+]] = icmp sgt i32 [[UB_VAL]], 3 +// CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] +// CHECK: [[TRUE]] +// CHECK: br label %[[SWITCH:[^,]+]] +// CHECK: [[FALSE]] +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]], +// CHECK: br label %[[SWITCH]] +// CHECK: [[SWITCH]] +// CHECK: [[UP:%.+]] = phi i32 [ 3, %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] +// CHECK: store i32 [[UP]], i32* [[UB]], +// CHECK: [[LB_VAL:%.+]] = load i32, i32* [[LB]], +// CHECK: store i32 [[LB_VAL]], i32* [[OMP_IV4:%[^,]+]], + +// CHECK: [[IV4:%.+]] = load i32, i32* [[OMP_IV4]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP4_ID:[0-9]+]] +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP4_ID]] +// CHECK-NEXT: [[CMP4:%.+]] = icmp sle i32 [[IV4]], [[UB_VAL]] +// CHECK-NEXT: br i1 [[CMP4]], label %[[SIMPLE_LOOP4_BODY:.+]], label %[[SIMPLE_LOOP4_END:[^,]+]] + for (short it = 6; it <= 20; it-=-4) { +// CHECK: [[SIMPLE_LOOP4_BODY]] +// Start of body: calculate it from IV: +// CHECK: [[IV4_0:%.+]] = load i32, i32* [[OMP_IV4]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP4_ID]] +// CHECK-NEXT: [[LC_IT_1:%.+]] = mul nsw i32 [[IV4_0]], 4 +// CHECK-NEXT: [[LC_IT_2:%.+]] = add nsw i32 6, [[LC_IT_1]] +// CHECK-NEXT: [[LC_IT_3:%.+]] = trunc i32 [[LC_IT_2]] to i16 +// CHECK-NEXT: store i16 [[LC_IT_3]], i16* {{.+}}, !llvm.mem.parallel_loop_access ![[SIMPLE_LOOP4_ID]] + +// CHECK: [[IV4_2:%.+]] = load i32, i32* [[OMP_IV4]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP4_ID]] +// CHECK-NEXT: [[ADD4_2:%.+]] = add nsw i32 [[IV4_2]], 1 +// CHECK-NEXT: store i32 [[ADD4_2]], i32* [[OMP_IV4]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP4_ID]] + } +// CHECK: [[SIMPLE_LOOP4_END]] +// CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) + + #pragma omp parallel for simd +// CHECK: call void @__kmpc_for_static_init_4(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i32* [[LB:%[^,]+]], i32* [[UB:%[^,]+]], i32* [[STRIDE:%[^,]+]], i32 1, i32 1) +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]], +// CHECK: [[CMP:%.+]] = icmp sgt i32 [[UB_VAL]], 25 +// CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] +// CHECK: [[TRUE]] +// CHECK: br label %[[SWITCH:[^,]+]] +// CHECK: [[FALSE]] +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]], +// CHECK: br label %[[SWITCH]] +// CHECK: [[SWITCH]] +// CHECK: [[UP:%.+]] = phi i32 [ 25, %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] +// CHECK: store i32 [[UP]], i32* [[UB]], +// CHECK: [[LB_VAL:%.+]] = load i32, i32* [[LB]], +// CHECK: store i32 [[LB_VAL]], i32* [[OMP_IV5:%[^,]+]], + +// CHECK: [[IV5:%.+]] = load i32, i32* [[OMP_IV5]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP5_ID:[0-9]+]] +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP5_ID]] +// CHECK-NEXT: [[CMP5:%.+]] = icmp sle i32 [[IV5]], [[UB_VAL]] +// CHECK-NEXT: br i1 [[CMP5]], label %[[SIMPLE_LOOP5_BODY:.+]], label %[[SIMPLE_LOOP5_END:[^,]+]] + for (unsigned char it = 'z'; it >= 'a'; it+=-1) { +// CHECK: [[SIMPLE_LOOP5_BODY]] +// Start of body: calculate it from IV: +// CHECK: [[IV5_0:%.+]] = load i32, i32* [[OMP_IV5]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP5_ID]] +// CHECK-NEXT: [[IV5_1:%.+]] = mul nsw i32 [[IV5_0]], 1 +// CHECK-NEXT: [[LC_IT_1:%.+]] = sub nsw i32 122, [[IV5_1]] +// CHECK-NEXT: [[LC_IT_2:%.+]] = trunc i32 [[LC_IT_1]] to i8 +// CHECK-NEXT: store i8 [[LC_IT_2]], i8* {{.+}}, !llvm.mem.parallel_loop_access ![[SIMPLE_LOOP5_ID]] + +// CHECK: [[IV5_2:%.+]] = load i32, i32* [[OMP_IV5]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP5_ID]] +// CHECK-NEXT: [[ADD5_2:%.+]] = add nsw i32 [[IV5_2]], 1 +// CHECK-NEXT: store i32 [[ADD5_2]], i32* [[OMP_IV5]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP5_ID]] + } +// CHECK: [[SIMPLE_LOOP5_END]] +// CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) + +// CHECK-NOT: mul i32 %{{.+}}, 10 + #pragma omp parallel for simd + for (unsigned i=100; i<10; i+=10) { + } + + int A; + { + A = -1; + #pragma omp parallel for simd lastprivate(A) +// CHECK: call void @__kmpc_for_static_init_8(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i64* [[LB:%[^,]+]], i64* [[UB:%[^,]+]], i64* [[STRIDE:%[^,]+]], i64 1, i64 1) +// CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]], +// CHECK: [[CMP:%.+]] = icmp sgt i64 [[UB_VAL]], 6 +// CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] +// CHECK: [[TRUE]] +// CHECK: br label %[[SWITCH:[^,]+]] +// CHECK: [[FALSE]] +// CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]], +// CHECK: br label %[[SWITCH]] +// CHECK: [[SWITCH]] +// CHECK: [[UP:%.+]] = phi i64 [ 6, %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] +// CHECK: store i64 [[UP]], i64* [[UB]], +// CHECK: [[LB_VAL:%.+]] = load i64, i64* [[LB]], +// CHECK: store i64 [[LB_VAL]], i64* [[OMP_IV7:%[^,]+]], + +// CHECK: br label %[[SIMD_LOOP7_COND:[^,]+]] +// CHECK: [[SIMD_LOOP7_COND]] +// CHECK-NEXT: [[IV7:%.+]] = load i64, i64* [[OMP_IV7]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID:[0-9]+]] +// CHECK-NEXT: [[UB_VAL:%.+]] = load i64, i64* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]] +// CHECK-NEXT: [[CMP7:%.+]] = icmp sle i64 [[IV7]], [[UB_VAL]] +// CHECK-NEXT: br i1 [[CMP7]], label %[[SIMPLE_LOOP7_BODY:.+]], label %[[SIMPLE_LOOP7_END:[^,]+]] + for (long long i = -10; i < 10; i += 3) { +// CHECK: [[SIMPLE_LOOP7_BODY]] +// Start of body: calculate i from IV: +// CHECK: [[IV7_0:%.+]] = load i64, i64* [[OMP_IV7]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]] +// CHECK-NEXT: [[LC_IT_1:%.+]] = mul nsw i64 [[IV7_0]], 3 +// CHECK-NEXT: [[LC_IT_2:%.+]] = add nsw i64 -10, [[LC_IT_1]] +// CHECK-NEXT: store i64 [[LC_IT_2]], i64* [[LC:%[^,]+]],{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]] +// CHECK-NEXT: [[LC_VAL:%.+]] = load i64, i64* [[LC]]{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]] +// CHECK-NEXT: [[CONV:%.+]] = trunc i64 [[LC_VAL]] to i32 +// CHECK-NEXT: store i32 [[CONV]], i32* [[A_PRIV:%[^,]+]],{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]] + A = i; +// CHECK: [[IV7_2:%.+]] = load i64, i64* [[OMP_IV7]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]] +// CHECK-NEXT: [[ADD7_2:%.+]] = add nsw i64 [[IV7_2]], 1 +// CHECK-NEXT: store i64 [[ADD7_2]], i64* [[OMP_IV7]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]] + } +// CHECK: [[SIMPLE_LOOP7_END]] +// CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: load i32, i32* +// CHECK: icmp ne i32 %{{.+}}, 0 +// CHECK: br i1 %{{.+}}, label +// CHECK: [[A_PRIV_VAL:%.+]] = load i32, i32* [[A_PRIV]], +// CHECK-NEXT: store i32 [[A_PRIV_VAL]], i32* %{{.+}}, +// CHECK-NEXT: br label +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) + } + int R; + { + R = -1; +// CHECK: store i32 1, i32* [[R_PRIV:%[^,]+]], + #pragma omp parallel for simd reduction(*:R) +// CHECK: call void @__kmpc_for_static_init_8(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i64* [[LB:%[^,]+]], i64* [[UB:%[^,]+]], i64* [[STRIDE:%[^,]+]], i64 1, i64 1) +// CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]], +// CHECK: [[CMP:%.+]] = icmp sgt i64 [[UB_VAL]], 6 +// CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] +// CHECK: [[TRUE]] +// CHECK: br label %[[SWITCH:[^,]+]] +// CHECK: [[FALSE]] +// CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]], +// CHECK: br label %[[SWITCH]] +// CHECK: [[SWITCH]] +// CHECK: [[UP:%.+]] = phi i64 [ 6, %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] +// CHECK: store i64 [[UP]], i64* [[UB]], +// CHECK: [[LB_VAL:%.+]] = load i64, i64* [[LB]], +// CHECK: store i64 [[LB_VAL]], i64* [[OMP_IV8:%[^,]+]], + +// CHECK: br label %[[SIMD_LOOP8_COND:[^,]+]] +// CHECK: [[SIMD_LOOP8_COND]] +// CHECK-NEXT: [[IV8:%.+]] = load i64, i64* [[OMP_IV8]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID:[0-9]+]] +// CHECK-NEXT: [[UB_VAL:%.+]] = load i64, i64* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]] +// CHECK-NEXT: [[CMP8:%.+]] = icmp sle i64 [[IV8]], [[UB_VAL]] +// CHECK-NEXT: br i1 [[CMP8]], label %[[SIMPLE_LOOP8_BODY:.+]], label %[[SIMPLE_LOOP8_END:[^,]+]] + for (long long i = -10; i < 10; i += 3) { +// CHECK: [[SIMPLE_LOOP8_BODY]] +// Start of body: calculate i from IV: +// CHECK: [[IV8_0:%.+]] = load i64, i64* [[OMP_IV8]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]] +// CHECK-NEXT: [[LC_IT_1:%.+]] = mul nsw i64 [[IV8_0]], 3 +// CHECK-NEXT: [[LC_IT_2:%.+]] = add nsw i64 -10, [[LC_IT_1]] +// CHECK-NEXT: store i64 [[LC_IT_2]], i64* [[LC:%[^,]+]],{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]] +// CHECK-NEXT: [[LC_VAL:%.+]] = load i64, i64* [[LC]]{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]] +// CHECK: store i32 %{{.+}}, i32* [[R_PRIV]],{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]] + R *= i; +// CHECK: [[IV8_2:%.+]] = load i64, i64* [[OMP_IV8]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]] +// CHECK-NEXT: [[ADD8_2:%.+]] = add nsw i64 [[IV8_2]], 1 +// CHECK-NEXT: store i64 [[ADD8_2]], i64* [[OMP_IV8]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]] + } +// CHECK: [[SIMPLE_LOOP8_END]] +// CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call i32 @__kmpc_reduce_nowait( +// CHECK: [[R_PRIV_VAL:%.+]] = load i32, i32* [[R_PRIV]], +// CHECK: [[RED:%.+]] = mul nsw i32 %{{.+}}, [[R_PRIV_VAL]] +// CHECK-NEXT: store i32 [[RED]], i32* %{{.+}}, +// CHECK-NEXT: call void @__kmpc_end_reduce_nowait( +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) + } +} + +template <class T, unsigned K> T tfoo(T a) { return a + K; } + +template <typename T, unsigned N> +int templ1(T a, T *z) { + #pragma omp parallel for simd collapse(N) + for (int i = 0; i < N * 2; i++) { + for (long long j = 0; j < (N + N + N + N); j += 2) { + z[i + j] = a + tfoo<T, N>(i + j); + } + } + return 0; +} + +// Instatiation templ1<float,2> +// CHECK-LABEL: define {{.*i32}} @{{.*}}templ1{{.*}}(float {{.+}}, float* {{.+}}) +// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( +void inst_templ1() { + float a; + float z[100]; + templ1<float,2> (a, z); +} + + +typedef int MyIdx; + +class IterDouble { + double *Ptr; +public: + IterDouble operator++ () const { + IterDouble n; + n.Ptr = Ptr + 1; + return n; + } + bool operator < (const IterDouble &that) const { + return Ptr < that.Ptr; + } + double & operator *() const { + return *Ptr; + } + MyIdx operator - (const IterDouble &that) const { + return (MyIdx) (Ptr - that.Ptr); + } + IterDouble operator + (int Delta) { + IterDouble re; + re.Ptr = Ptr + Delta; + return re; + } + + ///~IterDouble() {} +}; + +// CHECK-LABEL: define {{.*void}} @{{.*}}iter_simple{{.*}} +void iter_simple(IterDouble ia, IterDouble ib, IterDouble ic) { +// +// Calculate number of iterations before the loop body. +// CHECK: [[DIFF1:%.+]] = invoke {{.*}}i32 @{{.*}}IterDouble{{.*}} +// CHECK: [[DIFF2:%.+]] = sub nsw i32 [[DIFF1]], 1 +// CHECK-NEXT: [[DIFF3:%.+]] = add nsw i32 [[DIFF2]], 1 +// CHECK-NEXT: [[DIFF4:%.+]] = sdiv i32 [[DIFF3]], 1 +// CHECK-NEXT: [[DIFF5:%.+]] = sub nsw i32 [[DIFF4]], 1 +// CHECK-NEXT: store i32 [[DIFF5]], i32* [[OMP_LAST_IT:%[^,]+]]{{.+}} + #pragma omp parallel for simd + +// CHECK: call void @__kmpc_for_static_init_4(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i32* [[LB:%[^,]+]], i32* [[UB:%[^,]+]], i32* [[STRIDE:%[^,]+]], i32 1, i32 1) +// CHECK-DAG: [[UB_VAL:%.+]] = load i32, i32* [[UB]], +// CHECK-DAG: [[OMP_LAST_IT_VAL:%.+]] = load i32, i32* [[OMP_LAST_IT]], +// CHECK: [[CMP:%.+]] = icmp sgt i32 [[UB_VAL]], [[OMP_LAST_IT_VAL]] +// CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] +// CHECK: [[TRUE]] +// CHECK: [[OMP_LAST_IT_VAL:%.+]] = load i32, i32* [[OMP_LAST_IT]], +// CHECK: br label %[[SWITCH:[^,]+]] +// CHECK: [[FALSE]] +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]], +// CHECK: br label %[[SWITCH]] +// CHECK: [[SWITCH]] +// CHECK: [[UP:%.+]] = phi i32 [ [[OMP_LAST_IT_VAL]], %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] +// CHECK: store i32 [[UP]], i32* [[UB]], +// CHECK: [[LB_VAL:%.+]] = load i32, i32* [[LB]], +// CHECK: store i32 [[LB_VAL]], i32* [[IT_OMP_IV:%[^,]+]], + +// CHECK: [[IV:%.+]] = load i32, i32* [[IT_OMP_IV]]{{.+}} !llvm.mem.parallel_loop_access ![[ITER_LOOP_ID:[0-9]+]] +// CHECK-NEXT: [[UB_VAL:%.+]] = load i32, i32* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]] +// CHECK-NEXT: [[CMP:%.+]] = icmp sle i32 [[IV]], [[UB_VAL]] +// CHECK-NEXT: br i1 [[CMP]], label %[[IT_BODY:[^,]+]], label %[[IT_END:[^,]+]] + for (IterDouble i = ia; i < ib; ++i) { +// CHECK: [[IT_BODY]] +// Start of body: calculate i from index: +// CHECK: [[IV1:%.+]] = load i32, i32* [[IT_OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]] +// Call of operator+ (i, IV). +// CHECK: {{%.+}} = invoke {{.+}} @{{.*}}IterDouble{{.*}} +// ... loop body ... + *i = *ic * 0.5; +// Float multiply and save result. +// CHECK: [[MULR:%.+]] = fmul double {{%.+}}, 5.000000e-01 +// CHECK-NEXT: invoke {{.+}} @{{.*}}IterDouble{{.*}} +// CHECK: store double [[MULR:%.+]], double* [[RESULT_ADDR:%.+]], !llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]] + ++ic; +// +// CHECK: [[IV2:%.+]] = load i32, i32* [[IT_OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]] +// CHECK-NEXT: [[ADD2:%.+]] = add nsw i32 [[IV2]], 1 +// CHECK-NEXT: store i32 [[ADD2]], i32* [[IT_OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]] +// br label %{{.*}}, !llvm.loop ![[ITER_LOOP_ID]] + } +// CHECK: [[IT_END]] +// CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: ret void +} + + +// CHECK-LABEL: define {{.*void}} @{{.*}}collapsed{{.*}} +void collapsed(float *a, float *b, float *c, float *d) { + int i; // outer loop counter + unsigned j; // middle loop couter, leads to unsigned icmp in loop header. + // k declared in the loop init below + short l; // inner loop counter +// CHECK: call void @__kmpc_for_static_init_4u(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i32* [[LB:%[^,]+]], i32* [[UB:%[^,]+]], i32* [[STRIDE:%[^,]+]], i32 1, i32 1) +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]], +// CHECK: [[CMP:%.+]] = icmp ugt i32 [[UB_VAL]], 119 +// CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] +// CHECK: [[TRUE]] +// CHECK: br label %[[SWITCH:[^,]+]] +// CHECK: [[FALSE]] +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]], +// CHECK: br label %[[SWITCH]] +// CHECK: [[SWITCH]] +// CHECK: [[UP:%.+]] = phi i32 [ 119, %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] +// CHECK: store i32 [[UP]], i32* [[UB]], +// CHECK: [[LB_VAL:%.+]] = load i32, i32* [[LB]], +// CHECK: store i32 [[LB_VAL]], i32* [[OMP_IV:%[^,]+]], +// + #pragma omp parallel for simd collapse(4) + +// CHECK: [[IV:%.+]] = load i32, i32* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID:[0-9]+]] +// CHECK: [[UB_VAL:%.+]] = load i32, i32* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]] +// CHECK-NEXT: [[CMP:%.+]] = icmp ule i32 [[IV]], [[UB_VAL]] +// CHECK-NEXT: br i1 [[CMP]], label %[[COLL1_BODY:[^,]+]], label %[[COLL1_END:[^,]+]] + for (i = 1; i < 3; i++) // 2 iterations + for (j = 2u; j < 5u; j++) //3 iterations + for (int k = 3; k <= 6; k++) // 4 iterations + for (l = 4; l < 9; ++l) // 5 iterations + { +// CHECK: [[COLL1_BODY]] +// Start of body: calculate i from index: +// CHECK: [[IV1:%.+]] = load i32, i32* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]] +// Calculation of the loop counters values. +// CHECK: [[CALC_I_1:%.+]] = udiv i32 [[IV1]], 60 +// CHECK-NEXT: [[CALC_I_1_MUL1:%.+]] = mul i32 [[CALC_I_1]], 1 +// CHECK-NEXT: [[CALC_I_2:%.+]] = add i32 1, [[CALC_I_1_MUL1]] +// CHECK-NEXT: store i32 [[CALC_I_2]], i32* [[LC_I:.+]] +// CHECK: [[IV1_2:%.+]] = load i32, i32* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]] +// CHECK-NEXT: [[CALC_J_1:%.+]] = udiv i32 [[IV1_2]], 20 +// CHECK-NEXT: [[CALC_J_2:%.+]] = urem i32 [[CALC_J_1]], 3 +// CHECK-NEXT: [[CALC_J_2_MUL1:%.+]] = mul i32 [[CALC_J_2]], 1 +// CHECK-NEXT: [[CALC_J_3:%.+]] = add i32 2, [[CALC_J_2_MUL1]] +// CHECK-NEXT: store i32 [[CALC_J_3]], i32* [[LC_J:.+]] +// CHECK: [[IV1_3:%.+]] = load i32, i32* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]] +// CHECK-NEXT: [[CALC_K_1:%.+]] = udiv i32 [[IV1_3]], 5 +// CHECK-NEXT: [[CALC_K_2:%.+]] = urem i32 [[CALC_K_1]], 4 +// CHECK-NEXT: [[CALC_K_2_MUL1:%.+]] = mul i32 [[CALC_K_2]], 1 +// CHECK-NEXT: [[CALC_K_3:%.+]] = add i32 3, [[CALC_K_2_MUL1]] +// CHECK-NEXT: store i32 [[CALC_K_3]], i32* [[LC_K:.+]] +// CHECK: [[IV1_4:%.+]] = load i32, i32* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]] +// CHECK-NEXT: [[CALC_L_1:%.+]] = urem i32 [[IV1_4]], 5 +// CHECK-NEXT: [[CALC_L_1_MUL1:%.+]] = mul i32 [[CALC_L_1]], 1 +// CHECK-NEXT: [[CALC_L_2:%.+]] = add i32 4, [[CALC_L_1_MUL1]] +// CHECK-NEXT: [[CALC_L_3:%.+]] = trunc i32 [[CALC_L_2]] to i16 +// CHECK-NEXT: store i16 [[CALC_L_3]], i16* [[LC_L:.+]] +// ... loop body ... +// End of body: store into a[i]: +// CHECK: store float [[RESULT:%.+]], float* [[RESULT_ADDR:%.+]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]] + float res = b[j] * c[k]; + a[i] = res * d[l]; +// CHECK: [[IV2:%.+]] = load i32, i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]] +// CHECK-NEXT: [[ADD2:%.+]] = add i32 [[IV2]], 1 +// CHECK-NEXT: store i32 [[ADD2]], i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]] +// br label %{{[^,]+}}, !llvm.loop ![[COLL1_LOOP_ID]] +// CHECK: [[COLL1_END]] + } +// i,j,l are updated; k is not updated. +// CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: store i32 3, i32* [[I:%[^,]+]] +// CHECK: store i32 5, i32* [[I:%[^,]+]] +// CHECK: store i16 9, i16* [[I:%[^,]+]] +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: ret void +} + +extern char foo(); +extern double globalfloat; + +// CHECK-LABEL: define {{.*void}} @{{.*}}widened{{.*}} +void widened(float *a, float *b, float *c, float *d) { + int i; // outer loop counter + short j; // inner loop counter + globalfloat = 1.0; + int localint = 1; +// CHECK: store double {{.+}}, double* [[GLOBALFLOAT:@.+]] +// Counter is widened to 64 bits. +// CHECK: [[MUL:%.+]] = mul nsw i64 2, %{{.+}} +// CHECK-NEXT: [[SUB:%.+]] = sub nsw i64 [[MUL]], 1 +// CHECK-NEXT: store i64 [[SUB]], i64* [[OMP_LAST_IT:%[^,]+]], +// CHECK: call void @__kmpc_for_static_init_8(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i64* [[LB:%[^,]+]], i64* [[UB:%[^,]+]], i64* [[STRIDE:%[^,]+]], i64 1, i64 1) +// CHECK-DAG: [[UB_VAL:%.+]] = load i64, i64* [[UB]], +// CHECK-DAG: [[OMP_LAST_IT_VAL:%.+]] = load i64, i64* [[OMP_LAST_IT]], +// CHECK: [[CMP:%.+]] = icmp sgt i64 [[UB_VAL]], [[OMP_LAST_IT_VAL]] +// CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] +// CHECK: [[TRUE]] +// CHECK: [[OMP_LAST_IT_VAL:%.+]] = load i64, i64* [[OMP_LAST_IT]], +// CHECK: br label %[[SWITCH:[^,]+]] +// CHECK: [[FALSE]] +// CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]], +// CHECK: br label %[[SWITCH]] +// CHECK: [[SWITCH]] +// CHECK: [[UP:%.+]] = phi i64 [ [[OMP_LAST_IT_VAL]], %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] +// CHECK: store i64 [[UP]], i64* [[UB]], +// CHECK: [[LB_VAL:%.+]] = load i64, i64* [[LB]], +// CHECK: store i64 [[LB_VAL]], i64* [[OMP_IV:%[^,]+]], +// + #pragma omp parallel for simd collapse(2) private(globalfloat, localint) + +// CHECK: [[IV:%.+]] = load i64, i64* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID:[0-9]+]] +// CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]] +// CHECK-NEXT: [[CMP:%.+]] = icmp sle i64 [[IV]], [[UB_VAL]] +// CHECK-NEXT: br i1 [[CMP]], label %[[WIDE1_BODY:[^,]+]], label %[[WIDE1_END:[^,]+]] + for (i = 1; i < 3; i++) // 2 iterations + for (j = 0; j < foo(); j++) // foo() iterations + { +// CHECK: [[WIDE1_BODY]] +// Start of body: calculate i from index: +// CHECK: [[IV1:%.+]] = load i64, i64* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]] +// Calculation of the loop counters values... +// CHECK: store i32 {{[^,]+}}, i32* [[LC_I:.+]] +// CHECK: [[IV1_2:%.+]] = load i64, i64* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]] +// CHECK: store i16 {{[^,]+}}, i16* [[LC_J:.+]] +// ... loop body ... +// +// Here we expect store into private double var, not global +// CHECK-NOT: store double {{.+}}, double* [[GLOBALFLOAT]] + globalfloat = (float)j/i; + float res = b[j] * c[j]; +// Store into a[i]: +// CHECK: store float [[RESULT:%.+]], float* [[RESULT_ADDR:%.+]]{{.+}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]] + a[i] = res * d[i]; +// Then there's a store into private var localint: +// CHECK: store i32 {{.+}}, i32* [[LOCALINT:%[^,]+]]{{.+}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]] + localint = (int)j; +// CHECK: [[IV2:%.+]] = load i64, i64* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]] +// CHECK-NEXT: [[ADD2:%.+]] = add nsw i64 [[IV2]], 1 +// CHECK-NEXT: store i64 [[ADD2]], i64* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]] +// +// br label %{{[^,]+}}, !llvm.loop ![[WIDE1_LOOP_ID]] +// CHECK: [[WIDE1_END]] + } +// i,j are updated. +// CHECK: store i32 3, i32* [[I:%[^,]+]] +// CHECK: store i16 +// +// Here we expect store into original localint, not its privatized version. +// CHECK-NOT: store i32 {{.+}}, i32* [[LOCALINT]] + localint = (int)j; +// CHECK: ret void +} + +// CHECK: call void @__kmpc_for_static_init_8(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i64* [[LB:%[^,]+]], i64* [[UB:%[^,]+]], i64* [[STRIDE:%[^,]+]], i64 1, i64 1) +// CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]], +// CHECK: [[CMP:%.+]] = icmp sgt i64 [[UB_VAL]], 15 +// CHECK: br i1 [[CMP]], label %[[TRUE:.+]], label %[[FALSE:[^,]+]] +// CHECK: [[TRUE]] +// CHECK: br label %[[SWITCH:[^,]+]] +// CHECK: [[FALSE]] +// CHECK: [[UB_VAL:%.+]] = load i64, i64* [[UB]], +// CHECK: br label %[[SWITCH]] +// CHECK: [[SWITCH]] +// CHECK: [[UP:%.+]] = phi i64 [ 15, %[[TRUE]] ], [ [[UB_VAL]], %[[FALSE]] ] +// CHECK: store i64 [[UP]], i64* [[UB]], +// CHECK: [[LB_VAL:%.+]] = load i64, i64* [[LB]], +// CHECK: store i64 [[LB_VAL]], i64* [[T1_OMP_IV:%[^,]+]], + +// ... +// CHECK: [[IV:%.+]] = load i64, i64* [[T1_OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID:[0-9]+]] +// CHECK-NEXT: [[UB_VAL:%.+]] = load i64, i64* [[UB]]{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]] +// CHECK-NEXT: [[CMP1:%.+]] = icmp sle i64 [[IV]], [[UB_VAL]] +// CHECK-NEXT: br i1 [[CMP1]], label %[[T1_BODY:.+]], label %[[T1_END:[^,]+]] +// CHECK: [[T1_BODY]] +// Loop counters i and j updates: +// CHECK: [[IV1:%.+]] = load i64, i64* [[T1_OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]] +// CHECK-NEXT: [[I_1:%.+]] = sdiv i64 [[IV1]], 4 +// CHECK-NEXT: [[I_1_MUL1:%.+]] = mul nsw i64 [[I_1]], 1 +// CHECK-NEXT: [[I_1_ADD0:%.+]] = add nsw i64 0, [[I_1_MUL1]] +// CHECK-NEXT: [[I_2:%.+]] = trunc i64 [[I_1_ADD0]] to i32 +// CHECK-NEXT: store i32 [[I_2]], i32* {{%.+}}{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]] +// CHECK: [[IV2:%.+]] = load i64, i64* [[T1_OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]] +// CHECK-NEXT: [[J_1:%.+]] = srem i64 [[IV2]], 4 +// CHECK-NEXT: [[J_2:%.+]] = mul nsw i64 [[J_1]], 2 +// CHECK-NEXT: [[J_2_ADD0:%.+]] = add nsw i64 0, [[J_2]] +// CHECK-NEXT: store i64 [[J_2_ADD0]], i64* {{%.+}}{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]] +// simd.for.inc: +// CHECK: [[IV3:%.+]] = load i64, i64* [[T1_OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]] +// CHECK-NEXT: [[INC:%.+]] = add nsw i64 [[IV3]], 1 +// CHECK-NEXT: store i64 [[INC]], i64* [[T1_OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]] +// CHECK-NEXT: br label {{%.+}} +// CHECK: [[T1_END]] +// CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: ret void +// +// TERM_DEBUG-LABEL: bar +int bar() {return 0;}; + +// TERM_DEBUG-LABEL: parallel_simd +void parallel_simd(float *a) { +#pragma omp parallel for simd + // TERM_DEBUG-NOT: __kmpc_global_thread_num + // TERM_DEBUG: invoke i32 {{.*}}bar{{.*}}() + // TERM_DEBUG: unwind label %[[TERM_LPAD:.+]], + // TERM_DEBUG-NOT: __kmpc_global_thread_num + // TERM_DEBUG: [[TERM_LPAD]] + // TERM_DEBUG: call void @__clang_call_terminate + // TERM_DEBUG: unreachable + for (unsigned i = 131071; i <= 2147483647; i += 127) + a[i] += bar(); +} +// TERM_DEBUG: !{{[0-9]+}} = !DILocation(line: [[@LINE-11]], +#endif // HEADER + diff --git a/test/OpenMP/parallel_proc_bind_codegen.cpp b/test/OpenMP/parallel_proc_bind_codegen.cpp new file mode 100644 index 0000000..2a8eaee --- /dev/null +++ b/test/OpenMP/parallel_proc_bind_codegen.cpp @@ -0,0 +1,52 @@ +// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple %itanium_abi_triple -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s +// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -x c++ -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +typedef __INTPTR_TYPE__ intptr_t; + +// CHECK-DAG: [[IDENT_T_TY:%.+]] = type { i32, i32, i32, i32, i8* } +// CHECK-DAG: [[STR:@.+]] = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00" +// CHECK-DAG: [[DEF_LOC_2:@.+]] = private unnamed_addr constant [[IDENT_T_TY]] { i32 0, i32 2, i32 0, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* [[STR]], i32 0, i32 0) } + +void foo(); + +struct S { + intptr_t a, b, c; + S(intptr_t a) : a(a) {} + operator char() { return a; } + ~S() {} +}; + +template <typename T> +T tmain() { +#pragma omp parallel proc_bind(master) + foo(); + return T(); +} + +int main() { +#pragma omp parallel proc_bind(spread) + foo(); +#pragma omp parallel proc_bind(close) + foo(); + return tmain<int>(); +} + +// CHECK-LABEL: @main +// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEF_LOC_2]]) +// CHECK: call void @__kmpc_push_proc_bind([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 4) +// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( +// CHECK: call void @__kmpc_push_proc_bind([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 3) +// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( + +// CHECK-LABEL: @{{.+}}tmain +// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEF_LOC_2]]) +// CHECK: call void @__kmpc_push_proc_bind([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 2) +// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( +// CHECK: ret i32 0 +// CHECK-NEXT: } + +#endif diff --git a/test/OpenMP/simd_codegen.cpp b/test/OpenMP/simd_codegen.cpp index 586aaa5..ae649d8 100644 --- a/test/OpenMP/simd_codegen.cpp +++ b/test/OpenMP/simd_codegen.cpp @@ -41,9 +41,9 @@ void simple(float *a, float *b, float *c, float *d) { #pragma omp simd linear(k : 3) // CHECK: [[K0:%.+]] = call {{.*}}i64 @{{.*}}get_val // CHECK-NEXT: store i64 [[K0]], i64* [[K_VAR:%[^,]+]] +// CHECK: store i32 0, i32* [[OMP_IV2:%[^,]+]] // CHECK: [[K0LOAD:%.+]] = load i64, i64* [[K_VAR]] // CHECK-NEXT: store i64 [[K0LOAD]], i64* [[LIN0:%[^,]+]] -// CHECK: store i32 0, i32* [[OMP_IV2:%[^,]+]] // CHECK: [[IV2:%.+]] = load i32, i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID:[0-9]+]] // CHECK-NEXT: [[CMP2:%.+]] = icmp slt i32 [[IV2]], 9 @@ -84,17 +84,17 @@ void simple(float *a, float *b, float *c, float *d) { // Init linear private var. // CHECK: store i32 12, i32* [[LIN_VAR:%[^,]+]] -// CHECK: [[LIN_LOAD:%.+]] = load i32, i32* [[LIN_VAR]] -// CHECK-NEXT: store i32 [[LIN_LOAD]], i32* [[LIN_START:%[^,]+]] -// CHECK: [[GLIN_LOAD:%.+]] = load double*, double** [[GLIN_VAR:@[^,]+]] -// CHECK-NEXT: store double* [[GLIN_LOAD]], double** [[GLIN_START:%[^,]+]] - // CHECK: store i64 0, i64* [[OMP_IV3:%[^,]+]] +// CHECK: [[LIN_LOAD:%.+]] = load i32, i32* [[LIN_VAR]] +// CHECK-NEXT: store i32 [[LIN_LOAD]], i32* [[LIN_START:%[^,]+]] // Remember linear step. // CHECK: [[CALL_VAL:%.+]] = invoke // CHECK: store i64 [[CALL_VAL]], i64* [[LIN_STEP:%[^,]+]] +// CHECK: [[GLIN_LOAD:%.+]] = load double*, double** [[GLIN_VAR:@[^,]+]] +// CHECK-NEXT: store double* [[GLIN_LOAD]], double** [[GLIN_START:%[^,]+]] + // CHECK: [[IV3:%.+]] = load i64, i64* [[OMP_IV3]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID:[0-9]+]] // CHECK-NEXT: [[CMP3:%.+]] = icmp ult i64 [[IV3]], 4 // CHECK-NEXT: br i1 [[CMP3]], label %[[SIMPLE_LOOP3_BODY:.+]], label %[[SIMPLE_LOOP3_END:[^,]+]] @@ -182,15 +182,14 @@ void simple(float *a, float *b, float *c, float *d) { } int A; + // CHECK: store i32 -1, i32* [[A:%.+]], + A = -1; #pragma omp simd lastprivate(A) -// Clause 'lastprivate' implementation is not completed yet. -// Test checks that one iteration is separated in presence of lastprivate. -// // CHECK: store i64 0, i64* [[OMP_IV7:%[^,]+]] // CHECK: br label %[[SIMD_LOOP7_COND:[^,]+]] // CHECK: [[SIMD_LOOP7_COND]] // CHECK-NEXT: [[IV7:%.+]] = load i64, i64* [[OMP_IV7]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID:[0-9]+]] -// CHECK-NEXT: [[CMP7:%.+]] = icmp slt i64 [[IV7]], 6 +// CHECK-NEXT: [[CMP7:%.+]] = icmp slt i64 [[IV7]], 7 // CHECK-NEXT: br i1 [[CMP7]], label %[[SIMPLE_LOOP7_BODY:.+]], label %[[SIMPLE_LOOP7_END:[^,]+]] for (long long i = -10; i < 10; i += 3) { // CHECK: [[SIMPLE_LOOP7_BODY]] @@ -198,23 +197,49 @@ void simple(float *a, float *b, float *c, float *d) { // CHECK: [[IV7_0:%.+]] = load i64, i64* [[OMP_IV7]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]] // CHECK-NEXT: [[LC_IT_1:%.+]] = mul nsw i64 [[IV7_0]], 3 // CHECK-NEXT: [[LC_IT_2:%.+]] = add nsw i64 -10, [[LC_IT_1]] -// CHECK-NEXT: store i64 [[LC_IT_2]], i64* {{.+}}, !llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]] +// CHECK-NEXT: store i64 [[LC_IT_2]], i64* [[LC:%[^,]+]],{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]] +// CHECK-NEXT: [[LC_VAL:%.+]] = load i64, i64* [[LC]]{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]] +// CHECK-NEXT: [[CONV:%.+]] = trunc i64 [[LC_VAL]] to i32 +// CHECK-NEXT: store i32 [[CONV]], i32* [[A_PRIV:%[^,]+]],{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]] A = i; // CHECK: [[IV7_2:%.+]] = load i64, i64* [[OMP_IV7]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]] // CHECK-NEXT: [[ADD7_2:%.+]] = add nsw i64 [[IV7_2]], 1 // CHECK-NEXT: store i64 [[ADD7_2]], i64* [[OMP_IV7]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]] } // CHECK: [[SIMPLE_LOOP7_END]] -// Separated last iteration. -// CHECK: [[IV7_4:%.+]] = load i64, i64* [[OMP_IV7]] -// CHECK-NEXT: [[LC_FIN_1:%.+]] = mul nsw i64 [[IV7_4]], 3 -// CHECK-NEXT: [[LC_FIN_2:%.+]] = add nsw i64 -10, [[LC_FIN_1]] -// CHECK-NEXT: store i64 [[LC_FIN_2]], i64* [[ADDR_I:%[^,]+]] -// CHECK: [[LOAD_I:%.+]] = load i64, i64* [[ADDR_I]] -// CHECK-NEXT: [[CONV_I:%.+]] = trunc i64 [[LOAD_I]] to i32 -// - -// CHECK: ret void +// CHECK-NEXT: [[A_PRIV_VAL:%.+]] = load i32, i32* [[A_PRIV]], +// CHECK-NEXT: store i32 [[A_PRIV_VAL]], i32* [[A]], + int R; + // CHECK: store i32 -1, i32* [[R:%[^,]+]], + R = -1; +// CHECK: store i64 0, i64* [[OMP_IV8:%[^,]+]], +// CHECK: store i32 1, i32* [[R_PRIV:%[^,]+]], + #pragma omp simd reduction(*:R) +// CHECK: br label %[[SIMD_LOOP8_COND:[^,]+]] +// CHECK: [[SIMD_LOOP8_COND]] +// CHECK-NEXT: [[IV8:%.+]] = load i64, i64* [[OMP_IV8]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID:[0-9]+]] +// CHECK-NEXT: [[CMP8:%.+]] = icmp slt i64 [[IV8]], 7 +// CHECK-NEXT: br i1 [[CMP8]], label %[[SIMPLE_LOOP8_BODY:.+]], label %[[SIMPLE_LOOP8_END:[^,]+]] + for (long long i = -10; i < 10; i += 3) { +// CHECK: [[SIMPLE_LOOP8_BODY]] +// Start of body: calculate i from IV: +// CHECK: [[IV8_0:%.+]] = load i64, i64* [[OMP_IV8]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]] +// CHECK-NEXT: [[LC_IT_1:%.+]] = mul nsw i64 [[IV8_0]], 3 +// CHECK-NEXT: [[LC_IT_2:%.+]] = add nsw i64 -10, [[LC_IT_1]] +// CHECK-NEXT: store i64 [[LC_IT_2]], i64* [[LC:%[^,]+]],{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]] +// CHECK-NEXT: [[LC_VAL:%.+]] = load i64, i64* [[LC]]{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]] +// CHECK: store i32 %{{.+}}, i32* [[R_PRIV]],{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]] + R *= i; +// CHECK: [[IV8_2:%.+]] = load i64, i64* [[OMP_IV8]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]] +// CHECK-NEXT: [[ADD8_2:%.+]] = add nsw i64 [[IV8_2]], 1 +// CHECK-NEXT: store i64 [[ADD8_2]], i64* [[OMP_IV8]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]] + } +// CHECK: [[SIMPLE_LOOP8_END]] +// CHECK-DAG: [[R_VAL:%.+]] = load i32, i32* [[R]], +// CHECK-DAG: [[R_PRIV_VAL:%.+]] = load i32, i32* [[R_PRIV]], +// CHECK: [[RED:%.+]] = mul nsw i32 [[R_VAL]], [[R_PRIV_VAL]] +// CHECK-NEXT: store i32 [[RED]], i32* [[R]], +// CHECK-NEXT: ret void } template <class T, unsigned K> T tfoo(T a) { return a + K; } diff --git a/test/OpenMP/taskgroup_ast_print.cpp b/test/OpenMP/taskgroup_ast_print.cpp new file mode 100644 index 0000000..683141e --- /dev/null +++ b/test/OpenMP/taskgroup_ast_print.cpp @@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s +// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s +// expected-no-diagnostics + +#ifndef HEADER +#define HEADER + +void foo() {} + +int main (int argc, char **argv) { + int b = argc, c, d, e, f, g; + static int a; +// CHECK: static int a; +#pragma omp taskgroup + a=2; +// CHECK-NEXT: #pragma omp taskgroup +// CHECK-NEXT: a = 2; +// CHECK-NEXT: ++a; + ++a; +#pragma omp taskgroup + foo(); +// CHECK-NEXT: #pragma omp taskgroup +// CHECK-NEXT: foo(); +// CHECK-NEXT: return 0; + return 0; +} + +#endif diff --git a/test/OpenMP/taskgroup_codegen.cpp b/test/OpenMP/taskgroup_codegen.cpp new file mode 100644 index 0000000..a6aec1f --- /dev/null +++ b/test/OpenMP/taskgroup_codegen.cpp @@ -0,0 +1,56 @@ +// RUN: %clang_cc1 -verify -fopenmp -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s +// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -gline-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG +// expected-no-diagnostics + +#ifndef HEADER +#define HEADER + +// CHECK: [[IDENT_T_TY:%.+]] = type { i32, i32, i32, i32, i8* } + +// CHECK: define void [[FOO:@.+]]() + +void foo() {} + +// CHECK-LABEL: @main +// TERM_DEBUG-LABEL: @main +int main() { +// CHECK: [[A_ADDR:%.+]] = alloca i8 + char a; + +// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:@.+]]) +// CHECK: call void @__kmpc_taskgroup([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) +// CHECK-NEXT: store i8 2, i8* [[A_ADDR]] +// CHECK-NEXT: call void @__kmpc_end_taskgroup([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) +#pragma omp taskgroup + a = 2; +// CHECK: call void @__kmpc_taskgroup([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) +// CHECK-NEXT: invoke void [[FOO]]() +// CHECK: call void @__kmpc_end_taskgroup([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) +#pragma omp taskgroup + foo(); +// CHECK-NOT: call void @__kmpc_taskgroup +// CHECK-NOT: call void @__kmpc_end_taskgroup + return a; +} + +// CHECK-LABEL: parallel_taskgroup +// TERM_DEBUG-LABEL: parallel_taskgroup +void parallel_taskgroup() { +#pragma omp parallel +#pragma omp taskgroup + // TERM_DEBUG-NOT: __kmpc_global_thread_num + // TERM_DEBUG: call void @__kmpc_taskgroup({{.+}}), !dbg [[DBG_LOC_START:![0-9]+]] + // TERM_DEBUG: invoke void {{.*}}foo{{.*}}() + // TERM_DEBUG: unwind label %[[TERM_LPAD:.+]], + // TERM_DEBUG-NOT: __kmpc_global_thread_num + // TERM_DEBUG: call void @__kmpc_end_taskgroup({{.+}}), !dbg [[DBG_LOC_END:![0-9]+]] + // TERM_DEBUG: [[TERM_LPAD]] + // TERM_DEBUG: call void @__clang_call_terminate + // TERM_DEBUG: unreachable + foo(); +} +// TERM_DEBUG-DAG: [[DBG_LOC_START]] = !DILocation(line: [[@LINE-12]], +// TERM_DEBUG-DAG: [[DBG_LOC_END]] = !DILocation(line: [[@LINE-3]], +#endif diff --git a/test/OpenMP/taskgroup_messages.cpp b/test/OpenMP/taskgroup_messages.cpp new file mode 100644 index 0000000..e893da4 --- /dev/null +++ b/test/OpenMP/taskgroup_messages.cpp @@ -0,0 +1,67 @@ +// RUN: %clang_cc1 -verify -fopenmp %s + +int foo(); + +int main() { + #pragma omp taskgroup + ; + #pragma omp taskgroup unknown // expected-warning {{extra tokens at the end of '#pragma omp taskgroup' are ignored}} + foo(); + { + #pragma omp taskgroup + } // expected-error {{expected statement}} + #pragma omp taskgroup + #pragma omp taskgroup + for (int i = 0; i < 10; ++i) { + foo(); + #pragma omp parallel + #pragma omp for + for (int j = 0; j < 10; j++) { + foo(); + #pragma omp taskgroup + foo(); + } + } + #pragma omp taskgroup + #pragma omp taskgroup + for (int i = 0; i < 10; ++i) { + foo(); + #pragma omp parallel + #pragma omp for + for (int j = 0; j < 10; j++) { + #pragma omp taskgroup + foo(); + } + } + #pragma omp taskgroup + #pragma omp taskgroup + for (int i = 0; i < 10; ++i) { + foo(); + #pragma omp parallel + #pragma omp for + for (int j = 0; j < 10; j++) { + #pragma omp taskgroup + foo(); + } + } + + return 0; +} + +int foo() { + L1: + foo(); + #pragma omp taskgroup + { + foo(); + goto L1; // expected-error {{use of undeclared label 'L1'}} + } + goto L2; // expected-error {{use of undeclared label 'L2'}} + #pragma omp taskgroup + { + L2: + foo(); + } + + return 0; +} diff --git a/test/PCH/designated-init.c.h b/test/PCH/designated-init.c.h index 63b1f79..1821627 100644 --- a/test/PCH/designated-init.c.h +++ b/test/PCH/designated-init.c.h @@ -40,3 +40,25 @@ static void *FooTable[256] = { }, } }; + +struct P1 { + struct Q1 { + char a[6]; + char b[6]; + } q; +}; + +struct P1 l1 = { + (struct Q1){ "foo", "bar" }, + .q.b = { "boo" }, + .q.b = { [1] = 'x' } +}; + +extern struct Q1 *foo(); +static struct P1 test_foo() { + struct P1 l = { *foo(), + .q.b = { "boo" }, + .q.b = { [1] = 'x' } + }; + return l; +} diff --git a/test/PCH/modified-module-dependency.m b/test/PCH/modified-module-dependency.m index 3db8f3d..39fddb0 100644 --- a/test/PCH/modified-module-dependency.m +++ b/test/PCH/modified-module-dependency.m @@ -5,13 +5,13 @@ // RUN: cp %S/modified-module-dependency.module.map %t-dir/module.map // Precompile prefix.pch. -// RUN: %clang_cc1 -x objective-c -I %t-dir -fmodules -fmodules-cache-path=%t-dir/cache -fdisable-module-hash -emit-pch %t-dir/prefix.h -o %t-dir/prefix.pch +// RUN: %clang_cc1 -x objective-c -I %t-dir -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-dir/cache -fdisable-module-hash -emit-pch %t-dir/prefix.h -o %t-dir/prefix.pch // Modify the dependency. // RUN: echo ' ' >> %t-dir/test.h // Run and check the diagnostics. -// RUN: not %clang_cc1 -x objective-c -I %t-dir -include-pch %t-dir/prefix.pch -fmodules -fmodules-cache-path=%t-dir/cache -fdisable-module-hash -fsyntax-only %s 2> %t-dir/log +// RUN: not %clang_cc1 -x objective-c -I %t-dir -include-pch %t-dir/prefix.pch -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-dir/cache -fdisable-module-hash -fsyntax-only %s 2> %t-dir/log // RUN: FileCheck %s < %t-dir/log // CHECK: file '[[TEST_H:.*[/\\]test\.h]]' has been modified since the precompiled header '[[PREFIX_PCH:.*/prefix\.pch]]' was built diff --git a/test/PCH/module-hash-difference.m b/test/PCH/module-hash-difference.m index 073540e..fc542b0 100644 --- a/test/PCH/module-hash-difference.m +++ b/test/PCH/module-hash-difference.m @@ -1,7 +1,7 @@ // RUN: rm -rf %t.mcp // RUN: rm -rf %t.err -// RUN: %clang_cc1 -emit-pch -o %t.pch %s -I %S/Inputs/modules -fmodules -fmodules-cache-path=%t.mcp -// RUN: not %clang_cc1 -fsyntax-only -include-pch %t.pch %s -I %S/Inputs/modules -fmodules -fmodules-cache-path=%t.mcp -fdisable-module-hash 2> %t.err +// RUN: %clang_cc1 -emit-pch -o %t.pch %s -I %S/Inputs/modules -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp +// RUN: not %clang_cc1 -fsyntax-only -include-pch %t.pch %s -I %S/Inputs/modules -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -fdisable-module-hash 2> %t.err // RUN: FileCheck -input-file=%t.err %s // CHECK: error: PCH was compiled with module cache path {{.*}}, but the path is currently {{.*}} diff --git a/test/Parser/MicrosoftExtensions.c b/test/Parser/MicrosoftExtensions.c index 40a9510..389cf6d 100644 --- a/test/Parser/MicrosoftExtensions.c +++ b/test/Parser/MicrosoftExtensions.c @@ -52,6 +52,11 @@ void deprecated_enum_test(void) { [returnvalue:SA_Post( attr=1)] int foo1([SA_Post(attr=1)] void *param); +[unbalanced(attribute) /* expected-note {{to match this '['}} */ +void f(void); /* expected-error {{expected ']'}} */ + +[] __interface I {}; /* expected-error {{Microsoft attribute block cannot be empty}} */ + void ms_intrinsics(int a) { __noop(); __assume(a); diff --git a/test/Parser/nullability.c b/test/Parser/nullability.c new file mode 100644 index 0000000..f2b6abf --- /dev/null +++ b/test/Parser/nullability.c @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c99 -Wno-nullability-declspec -pedantic %s -verify + +__nonnull int *ptr; // expected-warning{{type nullability specifier '__nonnull' is a Clang extension}} + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnullability-extension" +__nonnull int *ptr2; // no-warning +#pragma clang diagnostic pop + +#if __has_feature(nullability) +# error Nullability should not be supported in C under -pedantic -std=c99 +#endif + +#if !__has_extension(nullability) +# error Nullability should always be supported as an extension +#endif diff --git a/test/Parser/pragma-loop-safety.cpp b/test/Parser/pragma-loop-safety.cpp new file mode 100644 index 0000000..cc98c77 --- /dev/null +++ b/test/Parser/pragma-loop-safety.cpp @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -std=c++11 -verify %s + +// Note that this puts the expected lines before the directives to work around +// limitations in the -verify mode. + +void test(int *List, int Length) { + int i = 0; + +#pragma clang loop vectorize(assume_safety) +#pragma clang loop interleave(assume_safety) + while (i + 1 < Length) { + List[i] = i; + } + +/* expected-error {{expected ')'}} */ #pragma clang loop vectorize(assume_safety +/* expected-error {{expected ')'}} */ #pragma clang loop interleave(assume_safety + +/* expected-error {{invalid argument; expected 'full' or 'disable'}} */ #pragma clang loop unroll(assume_safety) + +/* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop vectorize(badidentifier) +/* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop interleave(badidentifier) +/* expected-error {{invalid argument; expected 'full' or 'disable'}} */ #pragma clang loop unroll(badidentifier) + while (i-7 < Length) { + List[i] = i; + } + +/* expected-error {{duplicate directives 'vectorize(assume_safety)' and 'vectorize(enable)'}} */ #pragma clang loop vectorize(enable) +#pragma clang loop vectorize(assume_safety) +/* expected-error {{duplicate directives 'interleave(assume_safety)' and 'interleave(enable)'}} */ #pragma clang loop interleave(enable) +#pragma clang loop interleave(assume_safety) + while (i-9 < Length) { + List[i] = i; + } +} diff --git a/test/Parser/pragma-loop.cpp b/test/Parser/pragma-loop.cpp index a0213ac..6082058 100644 --- a/test/Parser/pragma-loop.cpp +++ b/test/Parser/pragma-loop.cpp @@ -130,7 +130,7 @@ void test(int *List, int Length) { /* expected-error {{expected ')'}} */ #pragma clang loop interleave_count(4 /* expected-error {{expected ')'}} */ #pragma clang loop unroll_count(4 -/* expected-error {{missing argument; expected 'enable' or 'disable'}} */ #pragma clang loop vectorize() +/* expected-error {{missing argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop vectorize() /* expected-error {{missing argument; expected an integer value}} */ #pragma clang loop interleave_count() /* expected-error {{missing argument; expected 'full' or 'disable'}} */ #pragma clang loop unroll() @@ -184,8 +184,8 @@ const int VV = 4; List[i] = i; } -/* expected-error {{invalid argument; expected 'enable' or 'disable'}} */ #pragma clang loop vectorize(badidentifier) -/* expected-error {{invalid argument; expected 'enable' or 'disable'}} */ #pragma clang loop interleave(badidentifier) +/* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop vectorize(badidentifier) +/* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop interleave(badidentifier) /* expected-error {{invalid argument; expected 'full' or 'disable'}} */ #pragma clang loop unroll(badidentifier) while (i-7 < Length) { List[i] = i; @@ -194,7 +194,7 @@ const int VV = 4; // PR20069 - Loop pragma arguments that are not identifiers or numeric // constants crash FE. /* expected-error {{expected ')'}} */ #pragma clang loop vectorize(() -/* expected-error {{invalid argument; expected 'enable' or 'disable'}} */ #pragma clang loop interleave(*) +/* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop interleave(*) /* expected-error {{invalid argument; expected 'full' or 'disable'}} */ #pragma clang loop unroll(=) /* expected-error {{type name requires a specifier or qualifier}} expected-error {{expected expression}} */ #pragma clang loop vectorize_width(^) /* expected-error {{expected expression}} expected-error {{expected expression}} */ #pragma clang loop interleave_count(/) diff --git a/test/Preprocessor/aarch64-target-features.c b/test/Preprocessor/aarch64-target-features.c index 85c0f24..eea72b3 100644 --- a/test/Preprocessor/aarch64-target-features.c +++ b/test/Preprocessor/aarch64-target-features.c @@ -92,6 +92,12 @@ // RUN: %clang -target aarch64 -mcpu=generic+crc -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-2 %s // RUN: %clang -target aarch64 -mcpu=generic+nocrc+crc -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-2 %s // RUN: %clang -target aarch64 -mcpu=cortex-a53+nosimd -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-3 %s +// ================== Check whether -mcpu accepts mixed-case features. +// RUN: %clang -target aarch64 -mcpu=cyclone+NOCRYPTO -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-1 %s +// RUN: %clang -target aarch64 -mcpu=cyclone+CRYPTO+nocrypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-1 %s +// RUN: %clang -target aarch64 -mcpu=generic+Crc -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-2 %s +// RUN: %clang -target aarch64 -mcpu=GENERIC+nocrc+CRC -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-2 %s +// RUN: %clang -target aarch64 -mcpu=cortex-a53+noSIMD -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-3 %s // CHECK-MCPU-1: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "-crypto" "-target-feature" "+zcm" "-target-feature" "+zcz" // CHECK-MCPU-2: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" // CHECK-MCPU-3: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "-neon" @@ -113,6 +119,10 @@ // RUN: %clang -target aarch64 -march=armv8.1a+crypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A-FEATURE-1 %s // RUN: %clang -target aarch64 -march=armv8.1a+nocrypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A-FEATURE-2 %s // RUN: %clang -target aarch64 -march=armv8.1a+nosimd -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A-FEATURE-3 %s +// ================== Check whether -march accepts mixed-case features. +// RUN: %clang -target aarch64 -march=ARMV8.1A+CRYPTO -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A-FEATURE-1 %s +// RUN: %clang -target aarch64 -march=Armv8.1a+NOcrypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A-FEATURE-2 %s +// RUN: %clang -target aarch64 -march=armv8.1a+noSIMD -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A-FEATURE-3 %s // CHECK-V81A-FEATURE-1: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+v8.1a" "-target-feature" "+crypto" // CHECK-V81A-FEATURE-2: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+v8.1a" "-target-feature" "-crypto" // CHECK-V81A-FEATURE-3: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+v8.1a" "-target-feature" "-neon" diff --git a/test/Preprocessor/openmp-macro-expansion.c b/test/Preprocessor/openmp-macro-expansion.c new file mode 100644 index 0000000..a83512b --- /dev/null +++ b/test/Preprocessor/openmp-macro-expansion.c @@ -0,0 +1,31 @@ +// RUN: %clang_cc1 -fopenmp -E -o - %s 2>&1 | FileCheck %s + +// This is to make sure the pragma name is not expanded! +#define omp (0xDEADBEEF) + +#define N 2 +#define M 1 +#define E N> + +#define map_to_be_expanded(x) map(tofrom:x) +#define sched_to_be_expanded(x,s) schedule(x,s) +#define reda_to_be_expanded(x) reduction(+:x) +#define redb_to_be_expanded(x,op) reduction(op:x) + +void foo(int *a, int *b) { + //CHECK: omp target map(a[0:2]) map(tofrom:b[0:2*1]) + #pragma omp target map(a[0:N]) map_to_be_expanded(b[0:2*M]) + { + int reda; + int redb; + //CHECK: omp parallel for schedule(static,2> >1) reduction(+:reda) reduction(*:redb) + #pragma omp parallel for sched_to_be_expanded(static, E>1) \ + reda_to_be_expanded(reda) redb_to_be_expanded(redb,*) + for (int i = 0; i < N; ++i) { + reda += a[i]; + redb += b[i]; + } + a[0] = reda; + b[0] = redb; + } +} diff --git a/test/Preprocessor/pp-modules.c b/test/Preprocessor/pp-modules.c index 213a5fd..09f3eee 100644 --- a/test/Preprocessor/pp-modules.c +++ b/test/Preprocessor/pp-modules.c @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x objective-c %s -F %S/../Modules/Inputs -E -o - | FileCheck %s +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x objective-c %s -F %S/../Modules/Inputs -E -o - | FileCheck %s // CHECK: int bar(); int bar(); diff --git a/test/Sema/aarch64-special-register.c b/test/Sema/aarch64-special-register.c new file mode 100644 index 0000000..40d4033 --- /dev/null +++ b/test/Sema/aarch64-special-register.c @@ -0,0 +1,77 @@ +// RUN: %clang_cc1 -ffreestanding -fsyntax-only -verify -triple aarch64 %s + +void string_literal(unsigned v) { + __builtin_arm_wsr(0, v); // expected-error {{expression is not a string literal}} +} + +void wsr_1(unsigned v) { + __builtin_arm_wsr("sysreg", v); +} + +void wsrp_1(void *v) { + __builtin_arm_wsrp("sysreg", v); +} + +void wsr64_1(unsigned long v) { + __builtin_arm_wsr64("sysreg", v); //expected-error {{invalid special register for builtin}} +} + +unsigned rsr_1() { + return __builtin_arm_rsr("sysreg"); +} + +void *rsrp_1() { + return __builtin_arm_rsrp("sysreg"); +} + +unsigned long rsr64_1() { + return __builtin_arm_rsr64("sysreg"); //expected-error {{invalid special register for builtin}} +} + +void wsr_2(unsigned v) { + __builtin_arm_wsr("0:1:2:3:4", v); +} + +void wsrp_2(void *v) { + __builtin_arm_wsrp("0:1:2:3:4", v); +} + +void wsr64_2(unsigned long v) { + __builtin_arm_wsr64("0:1:2:3:4", v); +} + +unsigned rsr_2() { + return __builtin_arm_rsr("0:1:2:3:4"); +} + +void *rsrp_2() { + return __builtin_arm_rsrp("0:1:2:3:4"); +} + +unsigned long rsr64_2() { + return __builtin_arm_rsr64("0:1:2:3:4"); +} + +void wsr_3(unsigned v) { + __builtin_arm_wsr("0:1:2", v); //expected-error {{invalid special register for builtin}} +} + +void wsrp_3(void *v) { + __builtin_arm_wsrp("0:1:2", v); //expected-error {{invalid special register for builtin}} +} + +void wsr64_3(unsigned long v) { + __builtin_arm_wsr64("0:1:2", v); //expected-error {{invalid special register for builtin}} +} + +unsigned rsr_3() { + return __builtin_arm_rsr("0:1:2"); //expected-error {{invalid special register for builtin}} +} + +void *rsrp_3() { + return __builtin_arm_rsrp("0:1:2"); //expected-error {{invalid special register for builtin}} +} + +unsigned long rsr64_3() { + return __builtin_arm_rsr64("0:1:2"); //expected-error {{invalid special register for builtin}} +} diff --git a/test/Sema/arm-special-register.c b/test/Sema/arm-special-register.c new file mode 100644 index 0000000..3ded628 --- /dev/null +++ b/test/Sema/arm-special-register.c @@ -0,0 +1,89 @@ +// RUN: %clang_cc1 -ffreestanding -fsyntax-only -verify -triple arm %s + +void string_literal(unsigned v) { + __builtin_arm_wsr(0, v); // expected-error {{expression is not a string literal}} +} + +void wsr_1(unsigned v) { + __builtin_arm_wsr("sysreg", v); +} + +void wsrp_1(void *v) { + __builtin_arm_wsrp("sysreg", v); +} + +void wsr64_1(unsigned long v) { + __builtin_arm_wsr64("sysreg", v); //expected-error {{invalid special register for builtin}} +} + +unsigned rsr_1() { + return __builtin_arm_rsr("sysreg"); +} + +void *rsrp_1() { + return __builtin_arm_rsrp("sysreg"); +} + +unsigned long rsr64_1() { + return __builtin_arm_rsr64("sysreg"); //expected-error {{invalid special register for builtin}} +} + +void wsr_2(unsigned v) { + __builtin_arm_wsr("cp0:1:c2:c3:4", v); +} + +void wsrp_2(void *v) { + __builtin_arm_wsrp("cp0:1:c2:c3:4", v); +} + +void wsr64_2(unsigned long v) { + __builtin_arm_wsr64("cp0:1:c2:c3:4", v); //expected-error {{invalid special register for builtin}} +} + +unsigned rsr_2() { + return __builtin_arm_rsr("cp0:1:c2:c3:4"); +} + +void *rsrp_2() { + return __builtin_arm_rsrp("cp0:1:c2:c3:4"); +} + +unsigned long rsr64_2() { + return __builtin_arm_rsr64("cp0:1:c2:c3:4"); //expected-error {{invalid special register for builtin}} +} + +void wsr_3(unsigned v) { + __builtin_arm_wsr("cp0:1:c2", v); //expected-error {{invalid special register for builtin}} +} + +void wsrp_3(void *v) { + __builtin_arm_wsrp("cp0:1:c2", v); //expected-error {{invalid special register for builtin}} +} + +void wsr64_3(unsigned long v) { + __builtin_arm_wsr64("cp0:1:c2", v); +} + +unsigned rsr_3() { + return __builtin_arm_rsr("cp0:1:c2"); //expected-error {{invalid special register for builtin}} +} + +void *rsrp_3() { + return __builtin_arm_rsrp("cp0:1:c2"); //expected-error {{invalid special register for builtin}} +} + +unsigned long rsr64_3() { + return __builtin_arm_rsr64("cp0:1:c2"); +} + +unsigned rsr_4() { + return __builtin_arm_rsr("0:1:2:3:4"); //expected-error {{invalid special register for builtin}} +} + +void *rsrp_4() { + return __builtin_arm_rsrp("0:1:2:3:4"); //expected-error {{invalid special register for builtin}} +} + +unsigned long rsr64_4() { + return __builtin_arm_rsr64("0:1:2"); //expected-error {{invalid special register for builtin}} +} diff --git a/test/Sema/attr-mode-vector-types.c b/test/Sema/attr-mode-vector-types.c new file mode 100644 index 0000000..3893922 --- /dev/null +++ b/test/Sema/attr-mode-vector-types.c @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-unknown-linux-gnu %s + +// Correct cases. +typedef int __attribute__((mode(byte))) __attribute__((vector_size(256))) vec_t1; +typedef int __attribute__((mode(QI))) __attribute__((vector_size(256))) vec_t2; +typedef int __attribute__((mode(SI))) __attribute__((vector_size(256))) vec_t3; +typedef int __attribute__((mode(DI))) __attribute__((vector_size(256)))vec_t4; +typedef float __attribute__((mode(SF))) __attribute__((vector_size(256))) vec_t5; +typedef float __attribute__((mode(DF))) __attribute__((vector_size(256))) vec_t6; +typedef float __attribute__((mode(XF))) __attribute__((vector_size(256))) vec_t7; + +// Incorrect cases. +typedef float __attribute__((mode(QC))) __attribute__((vector_size(256))) vec_t8; +// expected-error@-1{{unsupported machine mode 'QC'}} +// expected-error@-2{{type of machine mode does not match type of base type}} +typedef _Complex float __attribute__((mode(HC))) __attribute__((vector_size(256))) vec_t9; +// expected-error@-1{{unsupported machine mode 'HC'}} +// expected-error@-2{{invalid vector element type '_Complex float'}} +typedef int __attribute__((mode(SC))) __attribute__((vector_size(256))) vec_t10; +// expected-error@-1{{type of machine mode does not match type of base type}} +// expected-error@-2{{type of machine mode does not support base vector types}} +typedef float __attribute__((mode(DC))) __attribute__((vector_size(256))) vec_t11; +// expected-error@-1{{type of machine mode does not match type of base type}} +// expected-error@-2{{type of machine mode does not support base vector types}} +typedef _Complex float __attribute__((mode(XC))) __attribute__((vector_size(256))) vec_t12; +// expected-error@-1{{invalid vector element type '_Complex float'}} diff --git a/test/Sema/attr-target.c b/test/Sema/attr-target.c new file mode 100644 index 0000000..6c6b461 --- /dev/null +++ b/test/Sema/attr-target.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -verify %s + +int __attribute__((target("avx,sse4.2,arch=ivybridge"))) foo() { return 4; } +int __attribute__((target())) bar() { return 4; } //expected-error {{'target' attribute takes one argument}} +int __attribute__((target("tune=sandybridge"))) baz() { return 4; } //expected-warning {{Ignoring unsupported 'tune=' in the target attribute string}} +int __attribute__((target("fpmath=387"))) walrus() { return 4; } //expected-warning {{Ignoring unsupported 'fpmath=' in the target attribute string}} + + diff --git a/test/Sema/designated-initializers.c b/test/Sema/designated-initializers.c index 6630da6..a4582de 100644 --- a/test/Sema/designated-initializers.c +++ b/test/Sema/designated-initializers.c @@ -45,8 +45,8 @@ struct point array[10] = { struct point array2[10] = { [10].x = 2.0, // expected-error{{array designator index (10) exceeds array bounds (10)}} - [4 ... 5].y = 2.0, - [4 ... 6] = { .x = 3, .y = 4.0 } + [4 ... 5].y = 2.0, // expected-note 2 {{previous initialization is here}} + [4 ... 6] = { .x = 3, .y = 4.0 } // expected-warning 2 {{subobject initialization overrides initialization of other fields within its enclosing subobject}} }; struct point array3[10] = { @@ -129,11 +129,11 @@ int get8() { ++counter; return 8; } void test() { struct X xs[] = { - [0] = (struct X){1, 2}, // expected-note{{previous initialization is here}} + [0] = (struct X){1, 2}, // expected-note 2 {{previous initialization is here}} [0].c = 3, // expected-warning{{subobject initialization overrides initialization of other fields within its enclosing subobject}} (struct X) {4, 5, 6}, // expected-note{{previous initialization is here}} [1].b = get8(), // expected-warning{{subobject initialization overrides initialization of other fields within its enclosing subobject}} - [0].b = 8 + [0].b = 8 // expected-warning{{subobject initialization overrides initialization of other fields within its enclosing subobject}} }; } @@ -332,12 +332,22 @@ struct overwrite_string_struct { int M; } overwrite_string[] = { { { "foo" }, 1 }, // expected-note {{previous initialization is here}} - [0].L[2] = 'x' // expected-warning{{initializer overrides prior initialization of this subobject}} + [0].L[2] = 'x' // expected-warning{{subobject initialization overrides initialization of other fields}} }; struct overwrite_string_struct2 { char L[6]; int M; } overwrite_string2[] = { - { { "foo" }, 1 }, - [0].L[4] = 'x' // no-warning + { { "foo" }, 1 }, // expected-note{{previous initialization is here}} + [0].L[4] = 'x' // expected-warning{{subobject initialization overrides initialization of other fields}} }; +struct overwrite_string_struct +overwrite_string3[] = { + "foo", 1, // expected-note{{previous initialization is here}} + [0].L[4] = 'x' // expected-warning{{subobject initialization overrides initialization of other fields}} +}; +struct overwrite_string_struct +overwrite_string4[] = { + { { 'f', 'o', 'o' }, 1 }, + [0].L[4] = 'x' // no-warning +}; diff --git a/test/Sema/non-null-warning.c b/test/Sema/non-null-warning.c new file mode 100644 index 0000000..6cd98e2 --- /dev/null +++ b/test/Sema/non-null-warning.c @@ -0,0 +1,42 @@ +// RUN: %clang_cc1 -fsyntax-only -Wnonnull -Wnullability %s -verify +// rdar://19160762 + +#if __has_feature(nullability) +#else +# error nullability feature should be defined +#endif + + +int * __nullable foo(int * __nonnull x); + +int *__nonnull ret_nonnull(); + +int *foo(int *x) { + return 0; +} + +int * __nullable foo1(int * __nonnull x); // expected-note {{previous declaration is here}} + +int *foo1(int * __nullable x) { // expected-warning {{nullability specifier '__nullable' conflicts with existing specifier '__nonnull'}} + return 0; +} + +int * __nullable foo2(int * __nonnull x); + +int *foo2(int * __nonnull x) { + return 0; +} + +int * __nullable foo3(int * __nullable x); // expected-note {{previous declaration is here}} + +int *foo3(int * __nonnull x) { // expected-warning {{nullability specifier '__nonnull' conflicts with existing specifier '__nullable'}} + return 0; +} + +int * ret_nonnull() { + return 0; // expected-warning {{null returned from function that requires a non-null return value}} +} + +int main () { + foo(0); // expected-warning {{null passed to a callee that requires a non-null argument}} +} diff --git a/test/Sema/nullability.c b/test/Sema/nullability.c new file mode 100644 index 0000000..6144b7e --- /dev/null +++ b/test/Sema/nullability.c @@ -0,0 +1,113 @@ +// RUN: %clang_cc1 -fsyntax-only -fblocks -Wnullable-to-nonnull-conversion -Wno-nullability-declspec %s -verify + +#if __has_feature(nullability) +#else +# error nullability feature should be defined +#endif + +typedef int * int_ptr; + +// Parse nullability type specifiers. +typedef int * __nonnull nonnull_int_ptr; // expected-note{{'__nonnull' specified here}} +typedef int * __nullable nullable_int_ptr; +typedef int * __null_unspecified null_unspecified_int_ptr; + +// Redundant nullability type specifiers. +typedef int * __nonnull __nonnull redundant_1; // expected-warning{{duplicate nullability specifier '__nonnull'}} + +// Conflicting nullability type specifiers. +typedef int * __nonnull __nullable conflicting_1; // expected-error{{nullability specifier '__nonnull' conflicts with existing specifier '__nullable'}} +typedef int * __null_unspecified __nonnull conflicting_2; // expected-error{{nullability specifier '__null_unspecified' conflicts with existing specifier '__nonnull'}} + +// Redundant nullability specifiers via a typedef are okay. +typedef nonnull_int_ptr __nonnull redundant_okay_1; + +// Conflicting nullability specifiers via a typedef are not. +typedef nonnull_int_ptr __nullable conflicting_2; // expected-error{{nullability specifier '__nullable' conflicts with existing specifier '__nonnull'}} +typedef nonnull_int_ptr nonnull_int_ptr_typedef; +typedef nonnull_int_ptr_typedef __nullable conflicting_2; // expected-error{{nullability specifier '__nullable' conflicts with existing specifier '__nonnull'}} +typedef nonnull_int_ptr_typedef nonnull_int_ptr_typedef_typedef; +typedef nonnull_int_ptr_typedef_typedef __null_unspecified conflicting_3; // expected-error{{nullability specifier '__null_unspecified' conflicts with existing specifier '__nonnull'}} + +// Nullability applies to all pointer types. +typedef int (* __nonnull function_pointer_type_1)(int, int); +typedef int (^ __nonnull block_type_1)(int, int); + +// Nullability must be on a pointer type. +typedef int __nonnull int_type_1; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'int'}} + +// Nullability can move out to a pointer/block pointer declarator +// (with a suppressed warning). +typedef __nonnull int * nonnull_int_ptr_2; +typedef int __nullable * nullable_int_ptr_2; +typedef __nonnull int (* function_pointer_type_2)(int, int); +typedef __nonnull int (^ block_type_2)(int, int); +typedef __nonnull int * * __nullable nonnull_int_ptr_ptr_1; +typedef __nonnull int *(^ block_type_3)(int, int); +typedef __nonnull int *(* function_pointer_type_3)(int, int); +typedef __nonnull int_ptr (^ block_type_4)(int, int); +typedef __nonnull int_ptr (* function_pointer_type_4)(int, int); + +void acceptFunctionPtr(__nonnull int *(*)(void)); +void acceptBlockPtr(__nonnull int *(^)(void)); + +void testBlockFunctionPtrNullability() { + float *fp; + fp = (function_pointer_type_3)0; // expected-warning{{from 'function_pointer_type_3' (aka 'int * __nonnull (*)(int, int)')}} + fp = (block_type_3)0; // expected-error{{from incompatible type 'block_type_3' (aka 'int * __nonnull (^)(int, int)')}} + fp = (function_pointer_type_4)0; // expected-warning{{from 'function_pointer_type_4' (aka 'int_ptr __nonnull (*)(int, int)')}} + fp = (block_type_4)0; // expected-error{{from incompatible type 'block_type_4' (aka 'int_ptr __nonnull (^)(int, int)')}} + + acceptFunctionPtr(0); // no-warning + acceptBlockPtr(0); // no-warning +} + +// Moving nullability where it creates a conflict. +typedef __nonnull int * __nullable * conflict_int_ptr_ptr_2; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'int'}} + +// Nullability is not part of the canonical type. +typedef int * __nonnull ambiguous_int_ptr; +typedef int * ambiguous_int_ptr; +typedef int * __nullable ambiguous_int_ptr; + +// Printing of nullability. +float f; +int * __nonnull ip_1 = &f; // expected-warning{{incompatible pointer types initializing 'int * __nonnull' with an expression of type 'float *'}} + +// Check printing of nullability specifiers. +void printing_nullability(void) { + int * __nonnull iptr; + float *fptr = iptr; // expected-warning{{incompatible pointer types initializing 'float *' with an expression of type 'int * __nonnull'}} + + int * * __nonnull iptrptr; + float **fptrptr = iptrptr; // expected-warning{{incompatible pointer types initializing 'float **' with an expression of type 'int ** __nonnull'}} + + int * __nullable * __nonnull iptrptr2; + float * *fptrptr2 = iptrptr2; // expected-warning{{incompatible pointer types initializing 'float **' with an expression of type 'int * __nullable * __nonnull'}} +} + +// Check passing null to a __nonnull argument. +void accepts_nonnull_1(__nonnull int *ptr); +void (*accepts_nonnull_2)(__nonnull int *ptr); +void (^accepts_nonnull_3)(__nonnull int *ptr); + +void test_accepts_nonnull_null_pointer_literal() { + accepts_nonnull_1(0); // expected-warning{{null passed to a callee that requires a non-null argument}} + accepts_nonnull_2(0); // expected-warning{{null passed to a callee that requires a non-null argument}} + accepts_nonnull_3(0); // expected-warning{{null passed to a callee that requires a non-null argument}} +} + +// Check returning nil from a __nonnull-returning function. +__nonnull int *returns_int_ptr(int x) { + if (x) { + return 0; // expected-warning{{null returned from function that requires a non-null return value}} + } + + return (__nonnull int *)0; +} + +// Check nullable-to-nonnull conversions. +void nullable_to_nonnull(__nullable int *ptr) { + int *a = ptr; // okay + __nonnull int *b = ptr; // expected-warning{{implicit conversion from nullable pointer 'int * __nullable' to non-nullable pointer type 'int * __nonnull'}} +} diff --git a/test/Sema/stmtexprs.c b/test/Sema/stmtexprs.c new file mode 100644 index 0000000..8594aae --- /dev/null +++ b/test/Sema/stmtexprs.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -Wno-gnu-statement-expression + +int stmtexpr_fn(); +void stmtexprs(int i) { + __builtin_assume( ({ 1; }) ); // no warning about "side effects" + __builtin_assume( ({ if (i) { (void)0; }; 42; }) ); // no warning about "side effects" + // expected-warning@+1 {{the argument to '__builtin_assume' has side effects that will be discarded}} + __builtin_assume( ({ if (i) ({ stmtexpr_fn(); }); 1; }) ); +} diff --git a/test/Sema/warn-unused-function.c b/test/Sema/warn-unused-function.c index 013b925..6d81366 100644 --- a/test/Sema/warn-unused-function.c +++ b/test/Sema/warn-unused-function.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -Wused-but-marked-unused -Wunused-function -Wunneeded-internal-declaration -verify %s // RUN: %clang_cc1 -fsyntax-only -verify -Wunused %s -// RUN: %clang_cc1 -fsyntax-only -verify -Wall %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wall -Wno-infinite-recursion %s void foo() {} static void f2() {} diff --git a/test/SemaCXX/decltype.cpp b/test/SemaCXX/decltype.cpp index f1900b2..2956f9a 100644 --- a/test/SemaCXX/decltype.cpp +++ b/test/SemaCXX/decltype.cpp @@ -76,6 +76,31 @@ namespace PR18876 { decltype(f(), 0) *e; // expected-error {{attempt to use a deleted function}} } +namespace D5789 { + struct P1 { char x[6]; } g1 = { "foo" }; + struct LP1 { struct P1 p1; }; + + // expected-warning@+3 {{subobject initialization overrides}} + // expected-note@+2 {{previous initialization}} + // expected-note@+1 {{previous definition}} + template<class T> void foo(decltype(T(LP1{ .p1 = g1, .p1.x[1] = 'x' }))) {} + + // expected-warning@+3 {{subobject initialization overrides}} + // expected-note@+2 {{previous initialization}} + template<class T> + void foo(decltype(T(LP1{ .p1 = g1, .p1.x[1] = 'r' }))) {} // okay + + // expected-warning@+3 {{subobject initialization overrides}} + // expected-note@+2 {{previous initialization}} + template<class T> + void foo(decltype(T(LP1{ .p1 = { "foo" }, .p1.x[1] = 'x'}))) {} // okay + + // expected-warning@+3 {{subobject initialization overrides}} + // expected-note@+2 {{previous initialization}} + // expected-error@+1 {{redefinition of 'foo'}} + template<class T> void foo(decltype(T(LP1{ .p1 = g1, .p1.x[1] = 'x' }))) {} +} + template<typename> class conditional { }; diff --git a/test/SemaCXX/incomplete-call.cpp b/test/SemaCXX/incomplete-call.cpp index 69eb03a..6f5169e 100644 --- a/test/SemaCXX/incomplete-call.cpp +++ b/test/SemaCXX/incomplete-call.cpp @@ -47,3 +47,15 @@ struct C; // expected-note{{forward declaration}} void test_incomplete_object_call(C& c) { c(); // expected-error{{incomplete type in call to object of type}} } + +namespace pr18542 { + struct X { + int count; + template<typename CharT> class basic_istream; + template<typename CharT> + void basic_istream<CharT>::read() { // expected-error{{out-of-line definition of 'read' from class 'basic_istream<CharT>' without definition}} + count = 0; + } + }; +} + diff --git a/test/SemaCXX/nullability-declspec.cpp b/test/SemaCXX/nullability-declspec.cpp new file mode 100644 index 0000000..ef1a171 --- /dev/null +++ b/test/SemaCXX/nullability-declspec.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -fblocks -Werror=nullability-declspec -verify %s + +struct X { }; + +__nullable int *ip1; // expected-error{{nullability specifier '__nullable' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the pointer?}} +__nullable int (*fp1)(int); // expected-error{{nullability specifier '__nullable' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the function pointer?}} +__nonnull int (^bp1)(int); // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the block pointer?}} +__nonnull int X::*pmd1; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the member pointer?}} +__nonnull int (X::*pmf1)(int); // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the member function pointer?}} diff --git a/test/SemaCXX/nullability.cpp b/test/SemaCXX/nullability.cpp new file mode 100644 index 0000000..f0aa13b --- /dev/null +++ b/test/SemaCXX/nullability.cpp @@ -0,0 +1,64 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wno-nullability-declspec %s -verify + +typedef decltype(nullptr) nullptr_t; + +class X { +}; + +// Nullability applies to all pointer types. +typedef int (X::* __nonnull member_function_type_1)(int); +typedef int X::* __nonnull member_data_type_1; +typedef nullptr_t __nonnull nonnull_nullptr_t; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'nullptr_t'}} + +// Nullability can move into member pointers (this is suppressing a warning). +typedef __nonnull int (X::* member_function_type_2)(int); +typedef int (X::* __nonnull member_function_type_3)(int); +typedef __nonnull int X::* member_data_type_2; + +// Adding non-null via a template. +template<typename T> +struct AddNonNull { + typedef __nonnull T type; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'int'}} + // expected-error@-1{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'nullptr_t'}} +}; + +typedef AddNonNull<int *>::type nonnull_int_ptr_1; +typedef AddNonNull<int * __nullable>::type nonnull_int_ptr_2; // FIXME: check that it was overridden +typedef AddNonNull<nullptr_t>::type nonnull_int_ptr_3; // expected-note{{in instantiation of template class}} + +typedef AddNonNull<int>::type nonnull_non_pointer_1; // expected-note{{in instantiation of template class 'AddNonNull<int>' requested here}} + +// Non-null checking within a template. +template<typename T> +struct AddNonNull2 { + typedef __nonnull AddNonNull<T> invalid1; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'AddNonNull<T>'}} + typedef __nonnull AddNonNull2 invalid2; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'AddNonNull2<T>'}} + typedef __nonnull AddNonNull2<T> invalid3; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'AddNonNull2<T>'}} + typedef __nonnull typename AddNonNull<T>::type okay1; + + // Don't move past a dependent type even if we know that nullability + // cannot apply to that specific dependent type. + typedef __nonnull AddNonNull<T> (*invalid4); // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'AddNonNull<T>'}} +}; + +// Check passing null to a __nonnull argument. +void (*accepts_nonnull_1)(__nonnull int *ptr); +void (*& accepts_nonnull_2)(__nonnull int *ptr) = accepts_nonnull_1; +void (X::* accepts_nonnull_3)(__nonnull int *ptr); +void accepts_nonnull_4(__nonnull int *ptr); +void (&accepts_nonnull_5)(__nonnull int *ptr) = accepts_nonnull_4; + +void test_accepts_nonnull_null_pointer_literal(X *x) { + accepts_nonnull_1(0); // expected-warning{{null passed to a callee that requires a non-null argument}} + accepts_nonnull_2(0); // expected-warning{{null passed to a callee that requires a non-null argument}} + (x->*accepts_nonnull_3)(0); // expected-warning{{null passed to a callee that requires a non-null argument}} + accepts_nonnull_4(0); // expected-warning{{null passed to a callee that requires a non-null argument}} + accepts_nonnull_5(0); // expected-warning{{null passed to a callee that requires a non-null argument}} +} + +template<void FP(__nonnull int*)> +void test_accepts_nonnull_null_pointer_literal_template() { + FP(0); // expected-warning{{null passed to a callee that requires a non-null argument}} +} + +template void test_accepts_nonnull_null_pointer_literal_template<&accepts_nonnull_4>(); // expected-note{{instantiation of function template specialization}} diff --git a/test/SemaObjC/arc-property-decl-attrs.m b/test/SemaObjC/arc-property-decl-attrs.m index 283772c..2d46917 100644 --- a/test/SemaObjC/arc-property-decl-attrs.m +++ b/test/SemaObjC/arc-property-decl-attrs.m @@ -79,3 +79,29 @@ @property (readwrite) id frr; @end +// rdar://20152386 +// rdar://20383235 + +@interface NSObject @end + +#pragma clang assume_nonnull begin +@interface I: NSObject +@property(nonatomic, weak) id delegate; // Do not warn, nullable is inferred. +@property(nonatomic, weak, readonly) id ROdelegate; // Do not warn, nullable is inferred. +@property(nonatomic, weak, nonnull) id NonNulldelete; // expected-error {{property attributes 'nonnull' and 'weak' are mutually exclusive}} +@property(nonatomic, weak, nullable) id Nullabledelete; // do not warn + +// strong cases. +@property(nonatomic, strong) id stdelegate; // Do not warn +@property(nonatomic, readonly) id stROdelegate; // Do not warn +@property(nonatomic, strong, nonnull) id stNonNulldelete; // Do not warn +@property(nonatomic, nullable) id stNullabledelete; // do not warn +@end +#pragma clang assume_nonnull end + +@interface J: NSObject +@property(nonatomic, weak) id ddd; // Do not warn, nullable is inferred. +@property(nonatomic, weak, nonnull) id delegate; // expected-error {{property attributes 'nonnull' and 'weak' are mutually exclusive}} +@property(nonatomic, weak, nonnull, readonly) id ROdelegate; // expected-error {{property attributes 'nonnull' and 'weak' are mutually exclusive}} +@end + diff --git a/test/SemaObjC/arc-unavailable-for-weakref.m b/test/SemaObjC/arc-unavailable-for-weakref.m index 8274802..53ceaa1 100644 --- a/test/SemaObjC/arc-unavailable-for-weakref.m +++ b/test/SemaObjC/arc-unavailable-for-weakref.m @@ -56,7 +56,7 @@ __attribute__((objc_arc_weak_reference_unavailable)) @interface I { } -@property (weak) NSFont *font; // expected-error {{synthesizing __weak instance variable of type 'NSFont *', which does not support weak references}} +@property (weak) NSFont *font; // expected-error {{synthesizing __weak instance variable of type 'NSFont * __nullable', which does not support weak references}} @end @implementation I // expected-note {{when implemented by class I}} @@ -65,7 +65,7 @@ __attribute__((objc_arc_weak_reference_unavailable)) // rdar://13676793 @protocol MyProtocol -@property (weak) NSFont *font; // expected-error {{synthesizing __weak instance variable of type 'NSFont *', which does not support weak references}} +@property (weak) NSFont *font; // expected-error {{synthesizing __weak instance variable of type 'NSFont * __nullable', which does not support weak references}} @end @interface I1 <MyProtocol> @@ -76,7 +76,7 @@ __attribute__((objc_arc_weak_reference_unavailable)) @end @interface Super -@property (weak) NSFont *font; // expected-error {{synthesizing __weak instance variable of type 'NSFont *', which does not support weak references}} +@property (weak) NSFont *font; // expected-error {{synthesizing __weak instance variable of type 'NSFont * __nullable', which does not support weak references}} @end diff --git a/test/SemaObjC/attr-cf_returns.m b/test/SemaObjC/attr-cf_returns.m new file mode 100644 index 0000000..560d40d --- /dev/null +++ b/test/SemaObjC/attr-cf_returns.m @@ -0,0 +1,49 @@ +// RUN: %clang_cc1 -verify -fsyntax-only -fobjc-arc -fblocks %s + +#if __has_feature(attribute_cf_returns_on_parameters) +# error "okay!" +// expected-error@-1 {{okay!}} +#else +# error "uh-oh" +#endif + +#define CF_RETURNS_RETAINED __attribute__((cf_returns_retained)) +#define CF_RETURNS_NOT_RETAINED __attribute__((cf_returns_not_retained)) + +int x CF_RETURNS_RETAINED; // expected-warning{{'cf_returns_retained' attribute only applies to functions, methods, and parameters}} +int y CF_RETURNS_NOT_RETAINED; // expected-warning{{'cf_returns_not_retained' attribute only applies to functions, methods, and parameters}} + +typedef struct __CFFoo *CFFooRef; + +int invalid1() CF_RETURNS_RETAINED; // expected-warning{{'cf_returns_retained' attribute only applies to functions that return a pointer}} +void invalid2() CF_RETURNS_RETAINED; // expected-warning{{'cf_returns_retained' attribute only applies to functions that return a pointer}} + +CFFooRef valid1() CF_RETURNS_RETAINED; +id valid2() CF_RETURNS_RETAINED; + +@interface Test +- (int)invalid1 CF_RETURNS_RETAINED; // expected-warning{{'cf_returns_retained' attribute only applies to methods that return a pointer}} +- (void)invalid2 CF_RETURNS_RETAINED; // expected-warning{{'cf_returns_retained' attribute only applies to methods that return a pointer}} + +- (CFFooRef)valid1 CF_RETURNS_RETAINED; +- (id)valid2 CF_RETURNS_RETAINED; + +@property int invalidProp1 CF_RETURNS_RETAINED; // expected-warning{{'cf_returns_retained' attribute only applies to properties that return a pointer}} +@property void invalidProp2 CF_RETURNS_RETAINED; // expected-warning{{'cf_returns_retained' attribute only applies to properties that return a pointer}} + +@property CFFooRef valid1 CF_RETURNS_RETAINED; +@property id valid2 CF_RETURNS_RETAINED; +@end + +void invalidParam(int a CF_RETURNS_RETAINED, // expected-warning{{'cf_returns_retained' attribute only applies to pointer-to-CF-pointer parameters}} + int *b CF_RETURNS_RETAINED, // expected-warning{{'cf_returns_retained' attribute only applies to pointer-to-CF-pointer parameters}} + id c CF_RETURNS_RETAINED, // expected-warning{{'cf_returns_retained' attribute only applies to pointer-to-CF-pointer parameters}} + void *d CF_RETURNS_RETAINED, // expected-warning{{'cf_returns_retained' attribute only applies to pointer-to-CF-pointer parameters}} + CFFooRef e CF_RETURNS_RETAINED); // expected-warning{{'cf_returns_retained' attribute only applies to pointer-to-CF-pointer parameters}} + +void validParam(id *a CF_RETURNS_RETAINED, + CFFooRef *b CF_RETURNS_RETAINED, + void **c CF_RETURNS_RETAINED); +void validParam2(id *a CF_RETURNS_NOT_RETAINED, + CFFooRef *b CF_RETURNS_NOT_RETAINED, + void **c CF_RETURNS_NOT_RETAINED); diff --git a/test/SemaObjC/nullability-arc.m b/test/SemaObjC/nullability-arc.m new file mode 100644 index 0000000..917a808 --- /dev/null +++ b/test/SemaObjC/nullability-arc.m @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -fobjc-arc -fsyntax-only -Woverriding-method-mismatch %s -verify + +__attribute__((objc_root_class)) +@interface NSFoo +@end + +// ARC qualifiers stacked with nullability. +void accepts_arc_qualified(NSFoo * __unsafe_unretained __nonnull obj) { + accepts_arc_qualified(0); // expected-warning{{null passed to a callee that requires a non-null argument}} +} diff --git a/test/SemaObjC/nullability.m b/test/SemaObjC/nullability.m new file mode 100644 index 0000000..ca8c2fc --- /dev/null +++ b/test/SemaObjC/nullability.m @@ -0,0 +1,232 @@ +// RUN: %clang_cc1 -fsyntax-only -fblocks -Woverriding-method-mismatch -Wno-nullability-declspec %s -verify + +__attribute__((objc_root_class)) +@interface NSFoo +- (void)methodTakingIntPtr:(__nonnull int *)ptr; +- (__nonnull int *)methodReturningIntPtr; +@end + +// Nullability applies to all pointer types. +typedef NSFoo * __nonnull nonnull_NSFoo_ptr; +typedef id __nonnull nonnull_id; +typedef SEL __nonnull nonnull_SEL; + +// Nullability can move into Objective-C pointer types. +typedef __nonnull NSFoo * nonnull_NSFoo_ptr_2; + +// Conflicts from nullability moving into Objective-C pointer type. +typedef __nonnull NSFoo * __nullable conflict_NSFoo_ptr_2; // expected-error{{'__nonnull' cannot be applied to non-pointer type 'NSFoo'}} + +void testBlocksPrinting(NSFoo * __nullable (^bp)(int)) { + int *ip = bp; // expected-error{{'NSFoo * __nullable (^)(int)'}} +} + +// Check returning nil from a __nonnull-returning method. +@implementation NSFoo +- (void)methodTakingIntPtr:(__nonnull int *)ptr { } +- (__nonnull int *)methodReturningIntPtr { + return 0; // no warning +} +@end + +// Context-sensitive keywords and property attributes for nullability. +__attribute__((objc_root_class)) +@interface NSBar +- (nonnull NSFoo *)methodWithFoo:(nonnull NSFoo *)foo; + +- (nonnull NSFoo **)invalidMethod1; // expected-error{{nullability keyword 'nonnull' cannot be applied to multi-level pointer type 'NSFoo **'}} +// expected-note@-1{{use nullability type specifier '__nonnull' to affect the innermost pointer type of 'NSFoo **'}} +- (nonnull NSFoo * __nullable)conflictingMethod1; // expected-error{{nullability specifier '__nullable' conflicts with existing specifier '__nonnull'}} +- (nonnull NSFoo * __nonnull)redundantMethod1; // expected-warning{{duplicate nullability specifier '__nonnull'}} + +@property(nonnull,retain) NSFoo *property1; +@property(nullable,assign) NSFoo ** invalidProperty1; // expected-error{{nullability keyword 'nullable' cannot be applied to multi-level pointer type 'NSFoo **'}} +// expected-note@-1{{use nullability type specifier '__nullable' to affect the innermost pointer type of 'NSFoo **'}} +@property(null_unspecified,retain) NSFoo * __nullable conflictingProperty1; // expected-error{{nullability specifier '__nullable' conflicts with existing specifier '__null_unspecified'}} +@property(retain,nonnull) NSFoo * __nonnull redundantProperty1; // expected-warning{{duplicate nullability specifier '__nonnull'}} + +@property(null_unspecified,retain,nullable) NSFoo *conflictingProperty3; // expected-error{{nullability specifier 'nullable' conflicts with existing specifier 'null_unspecified'}} +@property(nullable,retain,nullable) NSFoo *redundantProperty3; // expected-warning{{duplicate nullability specifier 'nullable'}} +@end + +@interface NSBar () +@property(nonnull,retain) NSFoo *property2; +@property(nullable,assign) NSFoo ** invalidProperty2; // expected-error{{nullability keyword 'nullable' cannot be applied to multi-level pointer type 'NSFoo **'}} +// expected-note@-1{{use nullability type specifier '__nullable' to affect the innermost pointer type of 'NSFoo **'}} +@property(null_unspecified,retain) NSFoo * __nullable conflictingProperty2; // expected-error{{nullability specifier '__nullable' conflicts with existing specifier '__null_unspecified'}} +@property(retain,nonnull) NSFoo * __nonnull redundantProperty2; // expected-warning{{duplicate nullability specifier '__nonnull'}} +@end + +void test_accepts_nonnull_null_pointer_literal(NSFoo *foo, __nonnull NSBar *bar) { + [foo methodTakingIntPtr: 0]; // expected-warning{{null passed to a callee that requires a non-null argument}} + [bar methodWithFoo: 0]; // expected-warning{{null passed to a callee that requires a non-null argument}} + bar.property1 = 0; // expected-warning{{null passed to a callee that requires a non-null argument}} + bar.property2 = 0; // expected-warning{{null passed to a callee that requires a non-null argument}} + [bar setProperty1: 0]; // expected-warning{{null passed to a callee that requires a non-null argument}} + [bar setProperty2: 0]; // expected-warning{{null passed to a callee that requires a non-null argument}} + int *ptr = bar.property1; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'NSFoo * __nonnull'}} +} + +// Check returning nil from a nonnull-returning method. +@implementation NSBar +- (nonnull NSFoo *)methodWithFoo:(nonnull NSFoo *)foo { + return 0; // no warning +} + +- (NSFoo **)invalidMethod1 { + return 0; +} + +- (NSFoo *)conflictingMethod1 { + return 0; // no warning +} +- (NSFoo *)redundantMethod1 { + int *ip = 0; + return ip; // expected-warning{{result type 'NSFoo * __nonnull'}} +} +@end + +__attribute__((objc_root_class)) +@interface NSMerge +- (nonnull NSFoo *)methodA:(nonnull NSFoo*)foo; +- (nonnull NSFoo *)methodB:(nonnull NSFoo*)foo; +- (NSFoo *)methodC:(NSFoo*)foo; +@end + +@implementation NSMerge +- (NSFoo *)methodA:(NSFoo*)foo { + int *ptr = foo; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'NSFoo * __nonnull'}} + return ptr; // expected-warning{{result type 'NSFoo * __nonnull'}} +} + +- (nullable NSFoo *)methodB:(null_unspecified NSFoo*)foo { // expected-error{{nullability specifier 'nullable' conflicts with existing specifier 'nonnull'}} \ + // expected-error{{nullability specifier 'null_unspecified' conflicts with existing specifier 'nonnull'}} + return 0; +} + +- (nonnull NSFoo *)methodC:(nullable NSFoo*)foo { + int *ip = 0; + return ip; // expected-warning{{result type 'NSFoo * __nonnull'}} +} +@end + +// Checking merging of nullability when sending a message. +@interface NSMergeReceiver +- (id)returnsNone; +- (nonnull id)returnsNonNull; +- (nullable id)returnsNullable; +- (null_unspecified id)returnsNullUnspecified; +@end + +void test_receiver_merge(NSMergeReceiver *none, + __nonnull NSMergeReceiver *nonnull, + __nullable NSMergeReceiver *nullable, + __null_unspecified NSMergeReceiver *null_unspecified) { + int *ptr; + + ptr = [nullable returnsNullable]; // expected-warning{{'id __nullable'}} + ptr = [nullable returnsNullUnspecified]; // expected-warning{{'id __nullable'}} + ptr = [nullable returnsNonNull]; // expected-warning{{'id __nullable'}} + ptr = [nullable returnsNone]; // expected-warning{{'id __nullable'}} + + ptr = [null_unspecified returnsNullable]; // expected-warning{{'id __nullable'}} + ptr = [null_unspecified returnsNullUnspecified]; // expected-warning{{'id __null_unspecified'}} + ptr = [null_unspecified returnsNonNull]; // expected-warning{{'id __null_unspecified'}} + ptr = [null_unspecified returnsNone]; // expected-warning{{'id'}} + + ptr = [nonnull returnsNullable]; // expected-warning{{'id __nullable'}} + ptr = [nonnull returnsNullUnspecified]; // expected-warning{{'id __null_unspecified'}} + ptr = [nonnull returnsNonNull]; // expected-warning{{'id __nonnull'}} + ptr = [nonnull returnsNone]; // expected-warning{{'id'}} + + ptr = [none returnsNullable]; // expected-warning{{'id __nullable'}} + ptr = [none returnsNullUnspecified]; // expected-warning{{'id'}} + ptr = [none returnsNonNull]; // expected-warning{{'id'}} + ptr = [none returnsNone]; // expected-warning{{'id'}} + +} + +// instancetype +@protocol Initializable +- (instancetype)initWithBlah:(id)blah; +@end + +__attribute__((objc_root_class)) +@interface InitializableClass <Initializable> +- (nonnull instancetype)initWithBlah:(nonnull id)blah; +- (nullable instancetype)returnMe; ++ (nullable instancetype)returnInstanceOfMe; + +- (nonnull instancetype __nullable)initWithBlah2:(nonnull id)blah; // expected-error {{nullability specifier '__nullable' conflicts with existing specifier '__nonnull'}} +- (instancetype __nullable)returnMe2; ++ (__nonnull instancetype)returnInstanceOfMe2; +@end + +void test_instancetype(InitializableClass * __nonnull ic, id __nonnull object) { + int *ip = [ic returnMe]; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'InitializableClass * __nullable'}} + ip = [InitializableClass returnMe]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'id __nullable'}} + ip = [InitializableClass returnInstanceOfMe]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'InitializableClass * __nullable'}} + ip = [object returnMe]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'id __nullable'}} + + ip = [ic returnMe2]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'InitializableClass * __nullable'}} + ip = [InitializableClass returnInstanceOfMe2]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'InitializableClass * __nonnull'}} +} + +// Check null_resettable getters/setters. +__attribute__((objc_root_class)) +@interface NSResettable +@property(null_resettable,retain) NSResettable *resettable1; // expected-note{{passing argument to parameter 'resettable1' here}} +@property(null_resettable,retain,nonatomic) NSResettable *resettable2; +@property(null_resettable,retain,nonatomic) NSResettable *resettable3; +@property(null_resettable,retain,nonatomic) NSResettable *resettable4; +@property(null_resettable,retain,nonatomic) NSResettable *resettable5; +@property(null_resettable,retain,nonatomic) NSResettable *resettable6; +@end + +void test_null_resettable(NSResettable *r, int *ip) { + [r setResettable1:ip]; // expected-warning{{incompatible pointer types sending 'int *' to parameter of type 'NSResettable * __nullable'}} + r.resettable1 = ip; // expected-warning{{incompatible pointer types assigning to 'NSResettable * __nullable' from 'int *'}} +} + +@implementation NSResettable // expected-warning{{synthesized setter 'setResettable4:' for null_resettable property 'resettable4' does not handle nil}} +- (NSResettable *)resettable1 { + int *ip = 0; + return ip; // expected-warning{{result type 'NSResettable * __nonnull'}} +} + +- (void)setResettable1:(NSResettable *)param { +} + +@synthesize resettable2; // no warning; not synthesized +@synthesize resettable3; // expected-warning{{synthesized setter 'setResettable3:' for null_resettable property 'resettable3' does not handle nil}} + +- (void)setResettable2:(NSResettable *)param { +} + +@dynamic resettable5; + +- (NSResettable *)resettable6 { + return 0; // no warning +} +@end + +// rdar://problem/19814852 +@interface MultiProp +@property (nullable, copy) id a, b, c; +@property (nullable, copy) MultiProp *d, *(^e)(int); +@end + +void testMultiProp(MultiProp *foo) { + int *ip; + ip = foo.a; // expected-warning{{from 'id __nullable'}} + ip = foo.d; // expected-warning{{from 'MultiProp * __nullable'}} + ip = foo.e; // expected-error{{incompatible type 'MultiProp *(^ __nullable)(int)'}} +} + +void testBlockLiterals() { + (void)(^id(void) { return 0; }); + (void)(^id __nullable (void) { return 0; }); + (void)(^ __nullable id(void) { return 0; }); + + int *x = (^ __nullable id(void) { return 0; })(); // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'id __nullable'}} +} diff --git a/test/SemaObjC/nullable-weak-property.m b/test/SemaObjC/nullable-weak-property.m new file mode 100644 index 0000000..617ff4e --- /dev/null +++ b/test/SemaObjC/nullable-weak-property.m @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -fobjc-arc -fobjc-runtime-has-weak -Wnullable-to-nonnull-conversion %s -verify + + +// rdar://19985330 +@interface NSObject @end + +@class NSFoo; +void foo (NSFoo * __nonnull); + +@interface NSBar : NSObject +@property(weak) NSFoo *property1; +@end + +@implementation NSBar +- (void) Meth { + foo (self.property1); // expected-warning {{implicit conversion from nullable pointer 'NSFoo * __nullable' to non-nullable pointer type 'NSFoo * __nonnull'}} +} +@end diff --git a/test/SemaObjC/override-nullability.m b/test/SemaObjC/override-nullability.m new file mode 100644 index 0000000..8e29f91 --- /dev/null +++ b/test/SemaObjC/override-nullability.m @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fobjc-arc -fobjc-runtime-has-weak -Wnonnull %s -verify +//rdar://19211059 + +@interface NSObject @end + +@interface Base : NSObject +- (nonnull id)bad:(nullable id)obj; // expected-note 2 {{previous declaration is here}} +- (nullable id)notAsBad:(nonnull id)obj; +@end + +@interface Sub : Base +- (nullable id)bad:(nonnull id)obj; // expected-warning {{conflicting nullability specifier on return types, 'nullable' conflicts with existing specifier 'nonnull'}} \ + // expected-warning {{conflicting nullability specifier on parameter types, 'nonnull' conflicts with existing specifier 'nullable'}} +- (nonnull id)notAsBad:(nullable id)obj; +@end diff --git a/test/SemaObjCXX/Inputs/nullability-consistency-1.h b/test/SemaObjCXX/Inputs/nullability-consistency-1.h new file mode 100644 index 0000000..4d6bf79 --- /dev/null +++ b/test/SemaObjCXX/Inputs/nullability-consistency-1.h @@ -0,0 +1,17 @@ +void f1(int *ptr); // expected-warning{{pointer is missing a nullability type specifier}} + +void f2(int * __nonnull); + +#include "nullability-consistency-2.h" + +void f3(int *ptr) { // expected-warning{{pointer is missing a nullability type specifier}} + int *other = ptr; // shouldn't warn +} + +class X { + void mf(int *ptr); // expected-warning{{pointer is missing a nullability type specifier}} + int X:: *memptr; // expected-warning{{member pointer is missing a nullability type specifier}} +}; + + + diff --git a/test/SemaObjCXX/Inputs/nullability-consistency-2.h b/test/SemaObjCXX/Inputs/nullability-consistency-2.h new file mode 100644 index 0000000..8efdfa8 --- /dev/null +++ b/test/SemaObjCXX/Inputs/nullability-consistency-2.h @@ -0,0 +1,16 @@ +void g1(int * __nonnull); + +void g2(int (^block)(int, int)); // expected-warning{{block pointer is missing a nullability type specifier}} + +void g3(const + id // expected-warning{{missing a nullability type specifier}} + volatile + * // expected-warning{{missing a nullability type specifier}} + ); + +@interface SomeClass +@property (retain,nonnull) id property1; +@property (retain,nullable) SomeClass *property2; +- (nullable SomeClass *)method1; +- (void)method2:(nonnull SomeClass *)param; +@end diff --git a/test/SemaObjCXX/Inputs/nullability-consistency-3.h b/test/SemaObjCXX/Inputs/nullability-consistency-3.h new file mode 100644 index 0000000..a0c0d38 --- /dev/null +++ b/test/SemaObjCXX/Inputs/nullability-consistency-3.h @@ -0,0 +1 @@ +void double_declarator1(int *__nonnull *); // expected-warning{{pointer is missing a nullability type specifier (__nonnull, __nullable, or __null_unspecified)}} diff --git a/test/SemaObjCXX/Inputs/nullability-consistency-4.h b/test/SemaObjCXX/Inputs/nullability-consistency-4.h new file mode 100644 index 0000000..984280c --- /dev/null +++ b/test/SemaObjCXX/Inputs/nullability-consistency-4.h @@ -0,0 +1 @@ +void double_declarator1(int * * __nonnull); // expected-warning{{pointer is missing a nullability type specifier (__nonnull, __nullable, or __null_unspecified)}} diff --git a/test/SemaObjCXX/Inputs/nullability-consistency-5.h b/test/SemaObjCXX/Inputs/nullability-consistency-5.h new file mode 100644 index 0000000..3a685af --- /dev/null +++ b/test/SemaObjCXX/Inputs/nullability-consistency-5.h @@ -0,0 +1,14 @@ +#define SUPPRESS_NULLABILITY_WARNING(Type) \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wnullability-completeness\"") \ + Type \ + _Pragma("clang diagnostic pop") + +void suppress1(SUPPRESS_NULLABILITY_WARNING(int *) ptr); // no warning + +void shouldwarn5(int *ptr); //expected-warning{{missing a nullability type specifier}} + +void trigger5(int * __nonnull); + +void suppress2(SUPPRESS_NULLABILITY_WARNING(int *) ptr); // no warning + diff --git a/test/SemaObjCXX/Inputs/nullability-consistency-6.h b/test/SemaObjCXX/Inputs/nullability-consistency-6.h new file mode 100644 index 0000000..cb712e9 --- /dev/null +++ b/test/SemaObjCXX/Inputs/nullability-consistency-6.h @@ -0,0 +1,8 @@ +int *ptr; // expected-warning {{missing a nullability type specifier}} + +#pragma clang assume_nonnull begin + +extern void **blah; // expected-warning 2{{missing a nullability type specifier}} + +#pragma clang assume_nonnull end + diff --git a/test/SemaObjCXX/Inputs/nullability-consistency-7.h b/test/SemaObjCXX/Inputs/nullability-consistency-7.h new file mode 100644 index 0000000..ddbdfad --- /dev/null +++ b/test/SemaObjCXX/Inputs/nullability-consistency-7.h @@ -0,0 +1,40 @@ +#ifndef SOMEKIT_H +#define SOMEKIT_H + +__attribute__((objc_root_class)) +#ifndef NS_ASSUME_NONNULL_BEGIN +#if __has_feature(assume_nonnull) +#define NS_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin") +#define NS_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end") +#else +#define NS_ASSUME_NONNULL_BEGIN +#define NS_ASSUME_NONNULL_END +#endif +#endif + +NS_ASSUME_NONNULL_BEGIN + +@interface A +-(null_unspecified A*)transform:(null_unspecified A*)input __attribute__((unavailable("anything but this"))); +-(A*)transform:(A*)input integer:(int)integer; + +@property (null_unspecified, nonatomic, readonly, retain) A* someA; +@property (null_unspecified, nonatomic, retain) A* someOtherA; + +@property (nonatomic) int intValue __attribute__((unavailable("wouldn't work anyway"))); +@end + +NS_ASSUME_NONNULL_END + + +__attribute__((unavailable("just don't"))) +@interface B : A +@end + +@interface C : A +- (instancetype)init; // expected-warning{{pointer is missing a nullability type specifier}} +- (instancetype)initWithA:( A*)a __attribute__((objc_designated_initializer)); // expected-warning 2{{pointer is missing a nullability type specifier}} +@end + +#endif + diff --git a/test/SemaObjCXX/Inputs/nullability-consistency-8.h b/test/SemaObjCXX/Inputs/nullability-consistency-8.h new file mode 100644 index 0000000..890bb4d --- /dev/null +++ b/test/SemaObjCXX/Inputs/nullability-consistency-8.h @@ -0,0 +1,27 @@ +typedef int* __nonnull mynonnull; + +__attribute__((objc_root_class)) +@interface typedefClass +- (void) func1:(mynonnull)i; +@end + +void func2(mynonnull i); + +void func3(int *); // expected-warning{{pointer is missing a nullability type specifier}} + +#define CF_RETURNS_NOT_RETAINED __attribute__((cf_returns_not_retained)) +typedef void *CFTypeRef; +void cf1(CFTypeRef * p CF_RETURNS_NOT_RETAINED); // expected-warning {{pointer is missing a nullability type specifier}} + +void cf2(CFTypeRef * __nullable p CF_RETURNS_NOT_RETAINED); +void cf3(CFTypeRef * __nonnull p CF_RETURNS_NOT_RETAINED); + +void cf4(CFTypeRef __nullable * __nullable p CF_RETURNS_NOT_RETAINED); +void cf5(CFTypeRef __nonnull * __nullable p CF_RETURNS_NOT_RETAINED); + +void cf6(CFTypeRef * __nullable CF_RETURNS_NOT_RETAINED p); +void cf7(CF_RETURNS_NOT_RETAINED CFTypeRef * __nonnull p); + +typedef CFTypeRef __nullable *CFTypeRefPtr; +void cfp1(CFTypeRefPtr p CF_RETURNS_NOT_RETAINED); // expected-warning {{pointer is missing a nullability type specifier}} +void cfp2(CFTypeRefPtr __nonnull p CF_RETURNS_NOT_RETAINED); diff --git a/test/SemaObjCXX/Inputs/nullability-consistency-system/nullability-consistency-system.h b/test/SemaObjCXX/Inputs/nullability-consistency-system/nullability-consistency-system.h new file mode 100644 index 0000000..6dbca16 --- /dev/null +++ b/test/SemaObjCXX/Inputs/nullability-consistency-system/nullability-consistency-system.h @@ -0,0 +1,8 @@ +// Simply marking this as "#pragma clang system_header" didn't tickle the bug, rdar://problem/21134250. + +void system1(int *ptr); +#if WARN_IN_SYSTEM_HEADERS +// expected-warning@-2{{pointer is missing a nullability type specifier}} +#endif + +void system2(int * __nonnull); diff --git a/test/SemaObjCXX/Inputs/nullability-pragmas-1.h b/test/SemaObjCXX/Inputs/nullability-pragmas-1.h new file mode 100644 index 0000000..9501116 --- /dev/null +++ b/test/SemaObjCXX/Inputs/nullability-pragmas-1.h @@ -0,0 +1,101 @@ +__attribute__((objc_root_class)) +@interface NSError +@end + +__attribute__((objc_root_class)) +@interface A +@end + +struct X { }; + +void f1(int *x); // expected-warning{{pointer is missing a nullability type specifier}} + +typedef struct __attribute__((objc_bridge(NSError))) __CFError *CFErrorRef; +typedef NSError *NSErrorPtr; +typedef NSError **NSErrorPtrPtr; +typedef CFErrorRef *CFErrorRefPtr; +typedef int *int_ptr; +typedef A *A_ptr; +typedef int (^block_ptr)(int, int); + +#pragma clang assume_nonnull begin + +void f2(int *x); +void f3(A* obj); +void f4(int (^block)(int, int)); +void f5(int_ptr x); +void f6(A_ptr obj); +void f7(int * __nullable x); +void f8(A * __nullable obj); +void f9(int X::* mem_ptr); +void f10(int (X::*mem_func)(int, int)); +void f11(int X::* __nullable mem_ptr); +void f12(int (X::* __nullable mem_func)(int, int)); + +int_ptr f13(void); +A *f14(void); + +int * __null_unspecified f15(void); +A * __null_unspecified f16(void); +void f17(CFErrorRef *error); // expected-note{{no known conversion from 'A * __nonnull' to 'CFErrorRef __nullable * __nullable' (aka '__CFError **') for 1st argument}} +void f18(A **); // expected-warning 2{{pointer is missing a nullability type specifier}} +void f19(CFErrorRefPtr error); // expected-warning{{pointer is missing a nullability type specifier}} + +void g1(int (^)(int, int)); +void g2(int (^ *bp)(int, int)); // expected-warning{{block pointer is missing a nullability type specifier}} +// expected-warning@-1{{pointer is missing a nullability type specifier}} +void g3(block_ptr *bp); // expected-warning{{block pointer is missing a nullability type specifier}} +// expected-warning@-1{{pointer is missing a nullability type specifier}} +void g4(int (*fp)(int, int)); +void g5(int (**fp)(int, int)); // expected-warning 2{{pointer is missing a nullability type specifier}} + +@interface A(Pragmas1) ++ (instancetype)aWithA:(A *)a; +- (A *)method1:(A_ptr)ptr; +- (null_unspecified A *)method2; +- (void)method3:(NSError **)error; // expected-note{{passing argument to parameter 'error' here}} +- (void)method4:(NSErrorPtr *)error; // expected-note{{passing argument to parameter 'error' here}} +- (void)method5:(NSErrorPtrPtr)error; +// expected-warning@-1{{pointer is missing a nullability type specifier}} + +@property A *aProp; +@property NSError **anError; // expected-warning 2{{pointer is missing a nullability type specifier}} +@end + +int *global_int_ptr; + +// typedefs not inferred __nonnull +typedef int *int_ptr_2; + +typedef int * // expected-warning{{pointer is missing a nullability type specifier}} + *int_ptr_ptr; + +static inline void f30(void) { + float *fp = global_int_ptr; // expected-error{{cannot initialize a variable of type 'float *' with an lvalue of type 'int * __nonnull'}} + + int_ptr_2 ip2; + float *fp2 = ip2; // expected-error{{cannot initialize a variable of type 'float *' with an lvalue of type 'int_ptr_2' (aka 'int *')}} + + int_ptr_ptr ipp; + float *fp3 = ipp; // expected-error{{lvalue of type 'int_ptr_ptr' (aka 'int **')}} +} + +@interface AA : A { +@public + id ivar1; + __nonnull id ivar2; +} +@end + +#pragma clang assume_nonnull end + +void f20(A *a); // expected-warning{{pointer is missing a nullability type specifier}} +void f21(int_ptr x); // expected-warning{{pointer is missing a nullability type specifier}} +void f22(A_ptr y); // expected-warning{{pointer is missing a nullability type specifier}} +void f23(int_ptr __nullable x); +void f24(A_ptr __nullable y); +void f25(int_ptr_2 x); // expected-warning{{pointer is missing a nullability type specifier}} + +@interface A(OutsidePragmas1) ++ (instancetype)aWithInt:(int)value; // expected-warning{{pointer is missing a nullability type specifier}} +@end diff --git a/test/SemaObjCXX/Inputs/nullability-pragmas-2.h b/test/SemaObjCXX/Inputs/nullability-pragmas-2.h new file mode 100644 index 0000000..da3d21d --- /dev/null +++ b/test/SemaObjCXX/Inputs/nullability-pragmas-2.h @@ -0,0 +1,12 @@ +#pragma clang assume_nonnull start // expected-error{{expected 'begin' or 'end'}} + +#pragma clang assume_nonnull begin // expected-note{{#pragma entered here}} + +#include "nullability-pragmas-3.h" // expected-error{{cannot #include files inside '#pragma clang assume_nonnull'}} + +#pragma clang assume_nonnull begin // expected-note{{#pragma entered here}} +#pragma clang assume_nonnull begin // expected-error{{already inside '#pragma clang assume_nonnull'}} +#pragma clang assume_nonnull end + +#pragma clang assume_nonnull begin // expected-error{{'#pragma clang assume_nonnull' was not ended within this file}} + diff --git a/test/SemaObjCXX/Inputs/nullability-pragmas-3.h b/test/SemaObjCXX/Inputs/nullability-pragmas-3.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/SemaObjCXX/Inputs/nullability-pragmas-3.h diff --git a/test/SemaObjCXX/nullability-consistency.mm b/test/SemaObjCXX/nullability-consistency.mm new file mode 100644 index 0000000..acb972d --- /dev/null +++ b/test/SemaObjCXX/nullability-consistency.mm @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs -isystem %S/Inputs/nullability-consistency-system %s -verify +// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs -isystem %S/Inputs/nullability-consistency-system %s -Wsystem-headers -DWARN_IN_SYSTEM_HEADERS -verify + +#include "nullability-consistency-1.h" +#include "nullability-consistency-3.h" +#include "nullability-consistency-4.h" +#include "nullability-consistency-5.h" +#include "nullability-consistency-5.h" +#include "nullability-consistency-6.h" +#include "nullability-consistency-7.h" +#include "nullability-consistency-8.h" +#include "nullability-consistency-system.h" + +void h1(int *ptr) { } // don't warn + +void h2(int * __nonnull) { } diff --git a/test/SemaObjCXX/nullability-pragmas.mm b/test/SemaObjCXX/nullability-pragmas.mm new file mode 100644 index 0000000..0c61a30 --- /dev/null +++ b/test/SemaObjCXX/nullability-pragmas.mm @@ -0,0 +1,41 @@ +// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs %s -verify + +#include "nullability-pragmas-1.h" +#include "nullability-pragmas-2.h" + +#if !__has_feature(assume_nonnull) +# error assume_nonnull feature is not set +#endif + +void test_pragmas_1(A * __nonnull a, AA * __nonnull aa) { + f1(0); // okay: no nullability annotations + f2(0); // expected-warning{{null passed to a callee that requires a non-null argument}} + f3(0); // expected-warning{{null passed to a callee that requires a non-null argument}} + f4(0); // expected-warning{{null passed to a callee that requires a non-null argument}} + f5(0); // expected-warning{{null passed to a callee that requires a non-null argument}} + f6(0); // expected-warning{{null passed to a callee that requires a non-null argument}} + f7(0); // okay + f8(0); // okay + f9(0); // expected-warning{{null passed to a callee that requires a non-null argument}} + f10(0); // expected-warning{{null passed to a callee that requires a non-null argument}} + f11(0); // okay + f12(0); // okay + [a method1:0]; // expected-warning{{null passed to a callee that requires a non-null argument}} + + f17(a); // expected-error{{no matching function for call to 'f17'}} + [a method3: a]; // expected-error{{cannot initialize a parameter of type 'NSError * __nullable * __nullable' with an lvalue of type 'A * __nonnull'}} + [a method4: a]; // expected-error{{cannot initialize a parameter of type 'NSErrorPtr __nullable * __nullable' (aka 'NSError **') with an lvalue of type 'A * __nonnull'}} + + float *ptr; + ptr = f13(); // expected-error{{assigning to 'float *' from incompatible type 'int_ptr __nonnull' (aka 'int *')}} + ptr = f14(); // expected-error{{assigning to 'float *' from incompatible type 'A * __nonnull'}} + ptr = [a method1:a]; // expected-error{{assigning to 'float *' from incompatible type 'A * __nonnull'}} + ptr = a.aProp; // expected-error{{assigning to 'float *' from incompatible type 'A * __nonnull'}} + ptr = global_int_ptr; // expected-error{{assigning to 'float *' from incompatible type 'int * __nonnull'}} + ptr = f15(); // expected-error{{assigning to 'float *' from incompatible type 'int * __null_unspecified'}} + ptr = f16(); // expected-error{{assigning to 'float *' from incompatible type 'A * __null_unspecified'}} + ptr = [a method2]; // expected-error{{assigning to 'float *' from incompatible type 'A * __null_unspecified'}} + + ptr = aa->ivar1; // expected-error{{from incompatible type 'id'}} + ptr = aa->ivar2; // expected-error{{from incompatible type 'id __nonnull'}} +} diff --git a/test/SemaTemplate/ms-lookup-template-base-classes.cpp b/test/SemaTemplate/ms-lookup-template-base-classes.cpp index 6245108..9fa59e6 100644 --- a/test/SemaTemplate/ms-lookup-template-base-classes.cpp +++ b/test/SemaTemplate/ms-lookup-template-base-classes.cpp @@ -547,3 +547,29 @@ struct E : D<T> XXX x; // expected-error {{unknown type name}} }; } + +namespace PR23810 { +void f(int); +struct Base { + void f(); // expected-note{{must qualify identifier to find this declaration in dependent base class}} +}; +template <typename T> struct Template : T { + void member() { + f(); // expected-warning {{found via unqualified lookup into dependent bases}} + } +}; +void test() { + Template<Base> x; + x.member(); // expected-note{{requested here}} +}; +} + +namespace PR23823 { +// Don't delay lookup in SFINAE context. +template <typename T> decltype(g(T())) check(); // expected-note{{candidate template ignored: substitution failure [with T = int]: use of undeclared identifier 'g'}} +decltype(check<int>()) x; // expected-error{{no matching function for call to 'check'}} + +void h(); +template <typename T> decltype(h(T())) check2(); // expected-note{{candidate template ignored: substitution failure [with T = int]: no matching function for call to 'h'}} +decltype(check2<int>()) y; // expected-error{{no matching function for call to 'check2'}} +} diff --git a/test/VFS/incomplete-umbrella.m b/test/VFS/incomplete-umbrella.m index 4e138cc..ee66337 100644 --- a/test/VFS/incomplete-umbrella.m +++ b/test/VFS/incomplete-umbrella.m @@ -2,7 +2,7 @@ // RUN: mkdir -p %t/Incomplete.framework/Headers // RUN: echo '// IncompleteReal.h' > %t/Incomplete.framework/Headers/IncompleteReal.h // RUN: sed -e "s:INPUT_DIR:%S/Inputs:g" -e "s:OUT_DIR:%t:g" %S/Inputs/vfsoverlay.yaml > %t.yaml -// RUN: not %clang_cc1 -Werror -fmodules -fmodules-cache-path=%t \ +// RUN: not %clang_cc1 -Werror -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ // RUN: -ivfsoverlay %t.yaml -F %t -fsyntax-only %s 2>&1 | FileCheck %s // REQUIRES: shell diff --git a/test/VFS/module-import.m b/test/VFS/module-import.m index d2adcfe..a0bfa4c 100644 --- a/test/VFS/module-import.m +++ b/test/VFS/module-import.m @@ -1,6 +1,6 @@ // RUN: rm -rf %t // RUN: sed -e "s:INPUT_DIR:%S/Inputs:g" -e "s:OUT_DIR:%t:g" %S/Inputs/vfsoverlay.yaml > %t.yaml -// RUN: %clang_cc1 -Werror -fmodules -fmodules-cache-path=%t -ivfsoverlay %t.yaml -I %t -fsyntax-only %s +// RUN: %clang_cc1 -Werror -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ivfsoverlay %t.yaml -I %t -fsyntax-only %s // REQUIRES: shell @import not_real; @@ -18,10 +18,10 @@ void foo() { // Override the module map (vfsoverlay2 on top) // RUN: sed -e "s:INPUT_DIR:%S/Inputs:g" -e "s:OUT_DIR:%t:g" %S/Inputs/vfsoverlay2.yaml > %t2.yaml -// RUN: %clang_cc1 -Werror -fmodules -fmodules-cache-path=%t -ivfsoverlay %t.yaml -ivfsoverlay %t2.yaml -I %t -fsyntax-only %s +// RUN: %clang_cc1 -Werror -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ivfsoverlay %t.yaml -ivfsoverlay %t2.yaml -I %t -fsyntax-only %s // vfsoverlay2 not present -// RUN: not %clang_cc1 -Werror -fmodules -fmodules-cache-path=%t -ivfsoverlay %t.yaml -I %t -fsyntax-only %s -DIMPORT2 2>&1 | FileCheck -check-prefix=CHECK-VFS2 %s +// RUN: not %clang_cc1 -Werror -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ivfsoverlay %t.yaml -I %t -fsyntax-only %s -DIMPORT2 2>&1 | FileCheck -check-prefix=CHECK-VFS2 %s // vfsoverlay2 on the bottom -// RUN: not %clang_cc1 -Werror -fmodules -fmodules-cache-path=%t -ivfsoverlay %t2.yaml -ivfsoverlay %t.yaml -I %t -fsyntax-only %s -DIMPORT2 2>&1 | FileCheck -check-prefix=CHECK-VFS2 %s +// RUN: not %clang_cc1 -Werror -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ivfsoverlay %t2.yaml -ivfsoverlay %t.yaml -I %t -fsyntax-only %s -DIMPORT2 2>&1 | FileCheck -check-prefix=CHECK-VFS2 %s diff --git a/test/VFS/real-path-found-first.m b/test/VFS/real-path-found-first.m index f494c6e..3b37a64 100644 --- a/test/VFS/real-path-found-first.m +++ b/test/VFS/real-path-found-first.m @@ -11,32 +11,32 @@ // RUN: sed -e "s:INPUT_DIR:%S/Inputs:g" -e "s:OUT_DIR:%t:g" %S/Inputs/vfsoverlay.yaml > %t.yaml // Build -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t-cache -F %t \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \ // RUN: -ivfsoverlay %t.yaml -fsyntax-only %s -verify -Wauto-import \ // RUN: -Werror=non-modular-include-in-framework-module // Rebuild // RUN: echo ' ' >> %t/SomeFramework.framework/Modules/module.modulemap -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t-cache -F %t \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \ // RUN: -ivfsoverlay %t.yaml -fsyntax-only %s -verify -Wauto-import \ // RUN: -Werror=non-modular-include-in-framework-module // Load from PCH -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t-cache -F %t \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \ // RUN: -ivfsoverlay %t.yaml -emit-pch %s -o %t.pch \ // RUN: -Werror=non-modular-include-in-framework-module \ // RUN: -fmodules-ignore-macro=WITH_PREFIX -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t-cache -F %t \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \ // RUN: -ivfsoverlay %t.yaml -include-pch %t.pch -fsyntax-only %s \ // RUN: -Werror=non-modular-include-in-framework-module -DWITH_PREFIX \ // RUN: -fmodules-ignore-macro=WITH_PREFIX // While indexing -// RUN: c-index-test -index-file %s -fmodules -fmodules-cache-path=%t-cache -F %t \ +// RUN: c-index-test -index-file %s -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \ // RUN: -ivfsoverlay %t.yaml -fsyntax-only -Wauto-import \ // RUN: -Werror=non-modular-include-in-framework-module | FileCheck %s // RUN: echo ' ' >> %t/SomeFramework.framework/Modules/module.modulemap -// RUN: c-index-test -index-file %s -fmodules -fmodules-cache-path=%t-cache -F %t \ +// RUN: c-index-test -index-file %s -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \ // RUN: -ivfsoverlay %t.yaml -fsyntax-only -Wauto-import \ // RUN: -Werror=non-modular-include-in-framework-module | FileCheck %s // CHECK: warning: treating @@ -48,22 +48,22 @@ // RUN: echo "'name': '%t/SomeFramework.framework/Modules/module.modulemap'," >> %t2.yaml // RUN: echo "'type': 'file', 'external-contents': '%t/hide_module.map' } ] }" >> %t2.yaml -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t-cache -F %t \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \ // RUN: -ivfsoverlay %t.yaml -ivfsoverlay %t2.yaml -fsyntax-only %s -verify \ // RUN: -Wauto-import -Werror=non-modular-include-in-framework-module // RUN: echo ' ' >> %t/hide_module.map -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t-cache -F %t \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \ // RUN: -ivfsoverlay %t.yaml -ivfsoverlay %t2.yaml -fsyntax-only %s -verify \ // RUN: -Wauto-import -Werror=non-modular-include-in-framework-module // Within a module build // RUN: echo '@import import_some_frame;' | \ -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t-cache -F %t \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \ // RUN: -ivfsoverlay %t.yaml -ivfsoverlay %t2.yaml -fsyntax-only - \ // RUN: -Werror=non-modular-include-in-framework-module -x objective-c -I %t // RUN: echo ' ' >> %t/hide_module.map // RUN: echo '@import import_some_frame;' | \ -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t-cache -F %t \ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \ // RUN: -ivfsoverlay %t.yaml -ivfsoverlay %t2.yaml -fsyntax-only - \ // RUN: -Werror=non-modular-include-in-framework-module -x objective-c -I %t diff --git a/test/VFS/umbrella-mismatch.m b/test/VFS/umbrella-mismatch.m index 741b0e6..fc51802 100644 --- a/test/VFS/umbrella-mismatch.m +++ b/test/VFS/umbrella-mismatch.m @@ -1,7 +1,7 @@ // RUN: rm -rf %t // RUN: sed -e "s;INPUT_DIR;%/S/Inputs;g" -e "s;OUT_DIR;%/S/Inputs;g" %S/Inputs/vfsoverlay.yaml > %t.yaml -// RUN: %clang_cc1 -Werror -fmodules -fmodules-cache-path=%t -ivfsoverlay %t.yaml -F %S/Inputs -fsyntax-only %s -verify -// RUN: %clang_cc1 -Werror -fmodules -fmodules-cache-path=%t -F %S/Inputs -fsyntax-only %s -verify +// RUN: %clang_cc1 -Werror -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ivfsoverlay %t.yaml -F %S/Inputs -fsyntax-only %s -verify +// RUN: %clang_cc1 -Werror -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -F %S/Inputs -fsyntax-only %s -verify // expected-no-diagnostics @import UsesFoo; |