1 // RUN: %clang_cc1 -emit-llvm -o - -triple i686-pc-win32 %s | FileCheck %s
2 // Define macros, using token pasting, to build up an identifier of any length
3 #define C_(P1, P2) P1##P2
4 #define C2(P1, P2) C_(P1, P2)
5 #define C4(P1, P2, P3, P4) C2(C2(P1, P2), C2(P3, P4))
6
7 #define X2(X) C2(X, X)
8 #define X4(X) X2(X2(X))
9 #define X8(X) X2(X4(X))
10 #define X16(X) X2(X8(X))
11 #define X32(X) X2(X16(X))
12 #define X64(X) X2(X32(X))
13 #define X128(X) X2(X64(X))
14 #define X256(X) X2(X128(X))
15 #define X512(X) X2(X256(X))
16 #define X1024(X) X2(X512(X))
17 #define X2048(X) X2(X1024(X))
18 #define X4096(X) X2(X2048(X))
19
20 #define X4095(X) \
21 C2(C2( \
22 C4(X, X2(X), X4(X), X8(X)), \
23 C4(X16(X), X32(X), X64(X), X128(X))), \
24 C4(X256(X), X512(X), X1024(X), X2048(X)))
25
26 int X4095(x);
27 #define Y4095 X4095(y)
28 // CHECK-DAG: @"??@bf7ea7b95f260b0b24e7f1e8fc8370ab@" = dso_local global i32 0, align 4
29
30 struct Y4095 {
31 Y4095 ();
32 virtual void f();
33 };
Y4095()34 Y4095::Y4095() {}
35 // CHECK-DAG: @"??@a6a285da2eea70dba6b578022be61d81@??_R4@" = linkonce_odr constant %rtti.CompleteObjectLocator
36 // CHECK-DAG: @"??@a6a285da2eea70dba6b578022be61d81@" = unnamed_addr alias
37
38 // RUN: %clang_cc1 -DTHROW -fcxx-exceptions -fms-compatibility-version=18.0 -emit-llvm -o - -triple i686-pc-win32 %s | FileCheck --check-prefix=HAVECTOR %s
39 // RUN: %clang_cc1 -DTHROW -fcxx-exceptions -fms-compatibility-version=19.0 -emit-llvm -o - -triple i686-pc-win32 %s | FileCheck --check-prefix=OMITCTOR %s
40 // RUN: %clang_cc1 -DTHROW -fcxx-exceptions -fms-compatibility-version=19.10 -emit-llvm -o - -triple i686-pc-win32 %s | FileCheck --check-prefix=OMITCTOR %s
41 // RUN: %clang_cc1 -DTHROW -fcxx-exceptions -fms-compatibility-version=19.11 -emit-llvm -o - -triple i686-pc-win32 %s | FileCheck --check-prefix=OMITCTOR %s
42 // FIXME: Not known where between 19.11 and 19.14 this changed.
43 // RUN: %clang_cc1 -DTHROW -fcxx-exceptions -fms-compatibility-version=19.14 -emit-llvm -o - -triple i686-pc-win32 %s | FileCheck --check-prefix=HAVECTOR %s
44 // RUN: %clang_cc1 -DTHROW -fcxx-exceptions -fms-compatibility-version=19.20 -emit-llvm -o - -triple i686-pc-win32 %s | FileCheck --check-prefix=HAVECTOR %s
45 #ifdef THROW
g()46 void g() {
47 throw Y4095();
48 // OMITCTOR: "_CT??@c14087f0ec22b387aea7c59083f4f546@4"
49 // HAVECTOR: "_CT??@c14087f0ec22b387aea7c59083f4f546@??@4ef4f8979c81f9d2224b32bf327e6bdf@4"
50 }
51 #endif
52
53 // Verify the threshold where md5 mangling kicks in
54 // Test an ident with 4088 characters, pre-hash, MangleName.size() is 4095
55 #define X4088(X) \
56 C2(C2( \
57 C4(X, X4(X), X4(X), X8(X)), \
58 C4(X8(X), X32(X), X64(X), X128(X))), \
59 C4(X256(X), X512(X), X1024(X), X2048(X)))
60 #define Z4088 X4088(z)
61 // Use initialization to verify mangled name association in the il
62 int X4088(z) = 1515;
63 // CHECK-DAG: @"?{{z+}}@@3HA" = dso_local global i32 1515, align 4
64
65 // Test an ident with 4089 characters, pre-hash, MangleName.size() is 4096
66 #define X4089(X) \
67 C2(C2( \
68 C4(X2(X), X4(X), X4(X), X8(X)), \
69 C4(X8(X), X32(X), X64(X), X128(X))), \
70 C4(X256(X), X512(X), X1024(X), X2048(X)))
71 // Use initialization to verify mangled name association in the il
72 int X4089(z) = 1717;
73 // CHECK-DAG: @"??@0269945400a3474730d6880df0967d8f@" = dso_local global i32 1717, align 4
74