Clang Project

clang_source_code/test/CodeGenCXX/mangle-ms-exception-spec.cpp
1// RUN: %clang_cc1 -std=c++11 -fms-extensions -emit-llvm %s -o - -triple=x86_64-pc-win32 -Wno-noexcept-type -fms-compatibility-version=19.12 | FileCheck %s --check-prefix=CHECK --check-prefix=CXX11
2// RUN: %clang_cc1 -std=c++17 -fms-extensions -emit-llvm %s -o - -triple=x86_64-pc-win32 | FileCheck %s --check-prefix=CHECK --check-prefix=NOCOMPAT
3// RUN: %clang_cc1 -std=c++17 -fms-extensions -emit-llvm %s -o - -triple=x86_64-pc-win32 -fms-compatibility-version=19.12 | FileCheck %s --check-prefix=CHECK --check-prefix=CXX17
4
5// Prove that mangling only changed for noexcept types under /std:C++17, not all noexcept functions
6// CHECK-DAG: @"?nochange@@YAXXZ"
7void nochange() noexcept {}
8
9// CXX11-DAG: @"?a@@YAXP6AHXZ@Z"
10// NOCOMPAT-DAG: @"?a@@YAXP6AHXZ@Z"
11// CXX17-DAG: @"?a@@YAXP6AHX_E@Z"
12void a(int() noexcept) {}
13// CHECK-DAG: @"?b@@YAXP6AHXZ@Z"
14void b(int() noexcept(false)) {}
15// CXX11-DAG: @"?c@@YAXP6AHXZ@Z"
16// NOCOMPAT-DAG: @"?c@@YAXP6AHXZ@Z"
17// CXX17-DAG: @"?c@@YAXP6AHX_E@Z"
18void c(int() noexcept(true)) {}
19// CHECK-DAG: @"?d@@YAXP6AHXZ@Z"
20void d(int()) {}
21
22template <typename T>
23class e;
24template <typename T, typename... U>
25class e<T(U...) noexcept> {
26  // CXX11-DAG: @"?ee@?$e@$$A6AXXZ@@EEAAXXZ"
27  // NOCOMPAT-DAG: @"?ee@?$e@$$A6AXXZ@@EEAAXXZ"
28  // CXX17-DAG: @"?ee@?$e@$$A6AXX_E@@EEAAXXZ"
29  virtual T ee(U &&...) noexcept {};
30};
31
32e<void() noexcept> e1;
33
34template <typename T>
35class f;
36template <typename T, typename... U>
37class f<T(U...)> {
38  // CHECK-DAG: @"?ff@?$f@$$A6AXXZ@@EEAAXXZ"
39  virtual T ff(U &&...) noexcept {};
40};
41
42f<void()> f1;
43