diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGen/attr-target-mv.c | 17 | ||||
-rw-r--r-- | test/CodeGen/builtin-cpu-supports.c | 2 | ||||
-rw-r--r-- | test/Driver/cl-options.c | 1 | ||||
-rw-r--r-- | test/Driver/cl-pch.cpp | 21 | ||||
-rw-r--r-- | test/Driver/linux-ld.c | 8 | ||||
-rw-r--r-- | test/PCH/Inputs/pch-through-use3c.cpp | 2 | ||||
-rw-r--r-- | test/PCH/Inputs/pch-through3c.h | 1 | ||||
-rw-r--r-- | test/PCH/pch-through3c.cpp | 8 | ||||
-rw-r--r-- | test/SemaCXX/cxx1y-deduced-return-type.cpp | 70 | ||||
-rw-r--r-- | test/SemaCXX/friend.cpp | 23 |
10 files changed, 151 insertions, 2 deletions
diff --git a/test/CodeGen/attr-target-mv.c b/test/CodeGen/attr-target-mv.c index 0085a154ced1..48e155835697 100644 --- a/test/CodeGen/attr-target-mv.c +++ b/test/CodeGen/attr-target-mv.c @@ -70,6 +70,22 @@ void bar4() { // CHECK: ret void ()* @foo_decls.sse4.2 // CHECK: ret void ()* @foo_decls +// CHECK: define void @bar4() +// CHECK: call void @foo_multi.ifunc() + +// CHECK: define void ()* @foo_multi.resolver() comdat +// CHECK: and i32 %{{.*}}, 4352 +// CHECK: icmp eq i32 %{{.*}}, 4352 +// CHECK: ret void ()* @foo_multi.fma4_sse4.2 +// CHECK: icmp eq i32 %{{.*}}, 12 +// CHECK: and i32 %{{.*}}, 4352 +// CHECK: icmp eq i32 %{{.*}}, 4352 +// CHECK: ret void ()* @foo_multi.arch_ivybridge_fma4_sse4.2 +// CHECK: and i32 %{{.*}}, 768 +// CHECK: icmp eq i32 %{{.*}}, 768 +// CHECK: ret void ()* @foo_multi.avx_sse4.2 +// CHECK: ret void ()* @foo_multi + // CHECK: declare i32 @foo.arch_sandybridge() // CHECK: define available_externally i32 @foo_inline.sse4.2() @@ -88,4 +104,3 @@ void bar4() { // CHECK: define available_externally void @foo_multi.avx_sse4.2() // CHECK: define available_externally void @foo_multi.fma4_sse4.2() // CHECK: define available_externally void @foo_multi.arch_ivybridge_fma4_sse4.2() - diff --git a/test/CodeGen/builtin-cpu-supports.c b/test/CodeGen/builtin-cpu-supports.c index b70f4aca9d43..4964b98e6f52 100644 --- a/test/CodeGen/builtin-cpu-supports.c +++ b/test/CodeGen/builtin-cpu-supports.c @@ -14,7 +14,7 @@ int main() { // CHECK: [[LOAD:%[^ ]+]] = load i32, i32* getelementptr inbounds ({ i32, i32, i32, [1 x i32] }, { i32, i32, i32, [1 x i32] }* @__cpu_model, i32 0, i32 3, i32 0) // CHECK: [[AND:%[^ ]+]] = and i32 [[LOAD]], 256 - // CHECK: = icmp ne i32 [[AND]], 0 + // CHECK: = icmp eq i32 [[AND]], 256 return 0; } diff --git a/test/Driver/cl-options.c b/test/Driver/cl-options.c index 9aa6ced34994..59f565e6f2ec 100644 --- a/test/Driver/cl-options.c +++ b/test/Driver/cl-options.c @@ -566,6 +566,7 @@ // RUN: %clang_cl \ // RUN: --driver-mode=cl \ // RUN: -fblocks \ +// RUN: -fcrash-diagnostics-dir=/foo \ // RUN: -fno-blocks \ // RUN: -fbuiltin \ // RUN: -fno-builtin \ diff --git a/test/Driver/cl-pch.cpp b/test/Driver/cl-pch.cpp index 8521d3576a7b..0103db93e1a1 100644 --- a/test/Driver/cl-pch.cpp +++ b/test/Driver/cl-pch.cpp @@ -345,3 +345,24 @@ // CHECK-NoSourceTP: pchfile.pch // CHECK-NoSourceTP: -x // CHECK-NoSourceTP: "c++" + +// If only preprocessing, PCH options are ignored. +// RUN: %clang_cl /P /Ycpchfile.h /FIpchfile.h /c -### -- %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-YC-P %s +// CHECK-YC-P-NOT: -emit-pch +// CHECK-YC-P-NOT: -include-pch + +// RUN: %clang_cl /E /Ycpchfile.h /FIpchfile.h /c -### -- %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-YC-E %s +// CHECK-YC-E-NOT: -emit-pch +// CHECK-YC-E-NOT: -include-pch + +// RUN: %clang_cl /P /Ycpchfile.h /FIpchfile.h /c -### -- %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-YU-P %s +// CHECK-YU-P-NOT: -emit-pch +// CHECK-YU-P-NOT: -include-pch + +// RUN: %clang_cl /E /Ycpchfile.h /FIpchfile.h /c -### -- %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-YU-E %s +// CHECK-YU-E-NOT: -emit-pch +// CHECK-YU-E-NOT: -include-pch diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c index 787013931a48..d4823a8d9f01 100644 --- a/test/Driver/linux-ld.c +++ b/test/Driver/linux-ld.c @@ -1648,6 +1648,14 @@ // CHECK-ARMV7EB: "--be8" // CHECK-ARMV7EB: "-m" "armelfb_linux_eabi" +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=aarch64_be-unknown-linux \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-AARCH64BE %s +// CHECK-AARCH64BE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-AARCH64BE: "-m" "aarch64linuxb" + // Check dynamic-linker for musl-libc // RUN: %clang %s -### -o %t.o 2>&1 \ // RUN: --target=i386-pc-linux-musl \ diff --git a/test/PCH/Inputs/pch-through-use3c.cpp b/test/PCH/Inputs/pch-through-use3c.cpp new file mode 100644 index 000000000000..6102c514fba3 --- /dev/null +++ b/test/PCH/Inputs/pch-through-use3c.cpp @@ -0,0 +1,2 @@ +int a = A; +// expected-no-diagnostics diff --git a/test/PCH/Inputs/pch-through3c.h b/test/PCH/Inputs/pch-through3c.h new file mode 100644 index 000000000000..ab2a05dbbf84 --- /dev/null +++ b/test/PCH/Inputs/pch-through3c.h @@ -0,0 +1 @@ +#define A 1 diff --git a/test/PCH/pch-through3c.cpp b/test/PCH/pch-through3c.cpp new file mode 100644 index 000000000000..97b98c405987 --- /dev/null +++ b/test/PCH/pch-through3c.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -I %S -emit-pch \ +// RUN: -include Inputs/pch-through3c.h \ +// RUN: -pch-through-header=Inputs/pch-through3c.h -o %t.3c %s + +// RUN: %clang_cc1 -verify -I %S -include-pch %t.3c \ +// RUN: -include Inputs/pch-through3c.h \ +// RUN: -pch-through-header=Inputs/pch-through3c.h \ +// RUN: %S/Inputs/pch-through-use3c.cpp 2>&1 diff --git a/test/SemaCXX/cxx1y-deduced-return-type.cpp b/test/SemaCXX/cxx1y-deduced-return-type.cpp index 13ff751acae4..5daba67bc56a 100644 --- a/test/SemaCXX/cxx1y-deduced-return-type.cpp +++ b/test/SemaCXX/cxx1y-deduced-return-type.cpp @@ -552,3 +552,73 @@ namespace PR24989 { void forinit_decltypeauto() { for (decltype(auto) forinit_decltypeauto_inner();;) {} // expected-warning {{interpreted as a function}} expected-note {{replace}} } + +namespace PR33222 { + auto f1(); + auto f2(); + + template<typename T> decltype(auto) g0(T x) { return x.n; } + template<typename T> decltype(auto) g1(T); + template<typename T> decltype(auto) g2(T); + + struct X { + static auto f1(); + static auto f2(); + + template<typename T> static decltype(auto) g0(T x) { return x.n; } // FIXME (PR38883): expected-error {{private}} + template<typename T> static decltype(auto) g1(T); + template<typename T> static decltype(auto) g2(T); + }; + + template<typename U> class A { + friend auto f1(); + friend auto f2(); + + // FIXME (PR38883): This friend declaration doesn't actually work, because + // we fail to look up the named function properly during instantiation. + friend decltype(auto) g0<>(A); + template<typename T> friend decltype(auto) g1(T); + template<typename T> friend decltype(auto) g2(T); + + friend auto X::f1(); + friend auto X::f2(); + + // FIXME (PR38882): 'A' names the class template not the injected-class-name here! + friend decltype(auto) X::g0<>(A<U>); + // FIXME (PR38882): ::T hides the template parameter if both are named T here! + template<typename T_> friend decltype(auto) X::g1(T_); + template<typename T_> friend decltype(auto) X::g2(T_); + + int n; // FIXME: expected-note {{here}} + }; + + auto f1() { return A<int>().n; } + template<typename T> decltype(auto) g1(T x) { return A<int>().n; } + + auto X::f1() { return A<int>().n; } + template<typename T> decltype(auto) X::g1(T x) { return A<int>().n; } + + A<int> ai; + int k1 = g0(ai); + int k2 = X::g0(ai); // FIXME: expected-note {{in instantiation of}} + + int k3 = g1(ai); + int k4 = X::g1(ai); + + auto f2() { return A<int>().n; } + template<typename T> decltype(auto) g2(T x) { return A<int>().n; } + + auto X::f2() { return A<int>().n; } + template<typename T> decltype(auto) X::g2(T x) { return A<int>().n; } + + int k5 = g2(ai); + int k6 = X::g2(ai); + + template<typename> struct B { + auto *q() { return (float*)0; } // expected-note 2{{previous}} + }; + template<> auto *B<char[1]>::q() { return (int*)0; } + template<> auto B<char[2]>::q() { return (int*)0; } // expected-error {{return type}} + // FIXME: suppress this follow-on error: expected-error@-1 {{cannot initialize}} + template<> int B<char[3]>::q() { return 0; } // expected-error {{return type}} +} diff --git a/test/SemaCXX/friend.cpp b/test/SemaCXX/friend.cpp index 1f64ba609b16..61e96922f6d5 100644 --- a/test/SemaCXX/friend.cpp +++ b/test/SemaCXX/friend.cpp @@ -388,3 +388,26 @@ namespace default_arg { friend void f(void *p = 0) {} // expected-error {{must be the only}} }; } + +namespace PR33222 { + int f(); + template<typename T> struct X { + friend T f(); + }; + X<int> xi; + + int g(); // expected-note {{previous}} + template<typename T> struct Y { + friend T g(); // expected-error {{return type}} + }; + Y<float> yf; // expected-note {{instantiation}} + + int h(); + template<typename T> struct Z { + // FIXME: The note here should point at the non-friend declaration, not the + // instantiation in Z<int>. + friend T h(); // expected-error {{return type}} expected-note {{previous}} + }; + Z<int> zi; + Z<float> zf; // expected-note {{instantiation}} +} |