Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / mangle-exception-spec.cpp
blob15f7a8b6cb5048694f7365cefbdfb8105837e3ed
1 // RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 -Wno-dynamic-exception-spec | FileCheck %s --check-prefix CHECK --check-prefix CHECK-CXX11
2 // RUN: %clang_cc1 -std=c++1z -emit-llvm %s -o - -triple=x86_64-apple-darwin9 -Wno-dynamic-exception-spec | FileCheck %s --check-prefix CHECK --check-prefix CHECK-CXX17
4 // CHECK: define {{.*}} @_Z1aPFivE(
5 void a(int() throw(int, float)) {}
6 // CHECK-CXX11: define {{.*}} @_Z1bPFivE(
7 // CHECK-CXX17: define {{.*}} @_Z1bPDoFivE(
8 void b(int() noexcept) {}
9 // CHECK-CXX11: define {{.*}} @_Z1cPFivE(
10 // CHECK-CXX17: define {{.*}} @_Z1cPDoFivE(
11 void c(int() throw()) {}
12 // CHECK: define {{.*}} @_Z1dPFivE(
13 void d(int() noexcept(false)) {}
14 // CHECK-CXX11: define {{.*}} @_Z1ePFivE(
15 // CHECK-CXX17: define {{.*}} @_Z1ePDoFivE(
16 void e(int() noexcept(true)) {}
18 template<bool B> void f(int() noexcept(B)) {}
19 // CHECK: define {{.*}} @_Z1fILb0EEvPDOT_EFivE(
20 template void f<false>(int());
21 // CHECK: define {{.*}} @_Z1fILb1EEvPDOT_EFivE(
22 template void f<true>(int() noexcept);
24 template<typename...T> void g(int() throw(T...)) {}
25 // CHECK: define {{.*}} @_Z1gIJEEvPDwDpT_EFivE(
26 template void g<>(int() noexcept);
27 // CHECK: define {{.*}} @_Z1gIJfEEvPDwDpT_EFivE(
28 template void g<float>(int());
30 // We consider the exception specifications in parameter and return type here
31 // to be different.
32 template<typename...T> auto h(int() throw(int, T...)) -> int (*)() throw(T..., int) { return nullptr; }
33 // CHECK: define {{.*}} @_Z1hIJEEPDwDpT_iEFivEPDwiS1_EFivE(
34 template auto h<>(int()) -> int (*)();
35 // CHECK: define {{.*}} @_Z1hIJfEEPDwDpT_iEFivEPDwiS1_EFivE(
36 template auto h<float>(int()) -> int (*)();
38 // FIXME: The C++11 manglings here are wrong; they should be the same as the
39 // C++17 manglings.
40 // The mangler mishandles substitutions for instantiation-dependent types that
41 // differ only in type sugar that is not relevant for mangling. (In this case,
42 // the types differ in presence/absence of ParenType nodes under the pointer.)
43 template<typename...T> auto i(int() throw(int, T...)) -> int (*)() throw(int, T...) { return nullptr; }
44 // CHECK-CXX11: define {{.*}} @_Z1iIJEEPDwiDpT_EFivEPS2_(
45 // CHECK-CXX17: define {{.*}} @_Z1iIJEEPDwiDpT_EFivES3_(
46 template auto i<>(int()) -> int (*)();
47 // CHECK-CXX11: define {{.*}} @_Z1iIJfEEPDwiDpT_EFivEPS2_(
48 // CHECK-CXX17: define {{.*}} @_Z1iIJfEEPDwiDpT_EFivES3_(
49 template auto i<float>(int()) -> int (*)();