File: mangle-ms-md5.cpp

package info (click to toggle)
llvm-toolchain-15 1%3A15.0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,554,644 kB
  • sloc: cpp: 5,922,452; ansic: 1,012,136; asm: 674,362; python: 191,568; objc: 73,855; f90: 42,327; lisp: 31,913; pascal: 11,973; javascript: 10,144; sh: 9,421; perl: 7,447; ml: 5,527; awk: 3,523; makefile: 2,520; xml: 885; cs: 573; fortran: 567
file content (73 lines) | stat: -rw-r--r-- 3,476 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// RUN: %clang_cc1 -emit-llvm -o - -triple i686-pc-win32 %s | FileCheck %s
// Define macros, using token pasting, to build up an identifier of any length
#define C_(P1, P2) P1##P2
#define C2(P1, P2) C_(P1, P2)
#define C4(P1, P2, P3, P4) C2(C2(P1, P2), C2(P3, P4))

#define X2(X) C2(X, X)
#define X4(X) X2(X2(X))
#define X8(X) X2(X4(X))
#define X16(X) X2(X8(X))
#define X32(X) X2(X16(X))
#define X64(X) X2(X32(X))
#define X128(X) X2(X64(X))
#define X256(X) X2(X128(X))
#define X512(X) X2(X256(X))
#define X1024(X) X2(X512(X))
#define X2048(X) X2(X1024(X))
#define X4096(X) X2(X2048(X))

#define X4095(X)                                \
    C2(C2(                                      \
      C4(X,       X2(X),   X4(X),    X8(X)),    \
      C4(X16(X),  X32(X),  X64(X),   X128(X))), \
      C4(X256(X), X512(X), X1024(X), X2048(X)))

int X4095(x);
#define Y4095 X4095(y)
// CHECK-DAG: @"??@bf7ea7b95f260b0b24e7f1e8fc8370ab@" = dso_local global i32 0, align 4

struct Y4095 {
  Y4095 ();
  virtual void f();
};
Y4095::Y4095() {}
// CHECK-DAG: @"??@a6a285da2eea70dba6b578022be61d81@??_R4@" = linkonce_odr constant %rtti.CompleteObjectLocator
// CHECK-DAG: @"??@a6a285da2eea70dba6b578022be61d81@" = unnamed_addr alias

// RUN: %clang_cc1 -DTHROW -fcxx-exceptions -fms-compatibility-version=18.0 -emit-llvm -o - -triple i686-pc-win32 %s | FileCheck --check-prefix=HAVECTOR %s
// RUN: %clang_cc1 -DTHROW -fcxx-exceptions -fms-compatibility-version=19.0 -emit-llvm -o - -triple i686-pc-win32 %s | FileCheck --check-prefix=OMITCTOR %s
// RUN: %clang_cc1 -DTHROW -fcxx-exceptions -fms-compatibility-version=19.10 -emit-llvm -o - -triple i686-pc-win32 %s | FileCheck --check-prefix=OMITCTOR %s
// RUN: %clang_cc1 -DTHROW -fcxx-exceptions -fms-compatibility-version=19.11 -emit-llvm -o - -triple i686-pc-win32 %s | FileCheck --check-prefix=OMITCTOR %s
// FIXME: Not known where between 19.11 and 19.14 this changed.
// RUN: %clang_cc1 -DTHROW -fcxx-exceptions -fms-compatibility-version=19.14 -emit-llvm -o - -triple i686-pc-win32 %s | FileCheck --check-prefix=HAVECTOR %s
// RUN: %clang_cc1 -DTHROW -fcxx-exceptions -fms-compatibility-version=19.20 -emit-llvm -o - -triple i686-pc-win32 %s | FileCheck --check-prefix=HAVECTOR %s
#ifdef THROW
void g() {
  throw Y4095();
// OMITCTOR: "_CT??@c14087f0ec22b387aea7c59083f4f546@4"
// HAVECTOR: "_CT??@c14087f0ec22b387aea7c59083f4f546@??@4ef4f8979c81f9d2224b32bf327e6bdf@4"
}
#endif

// Verify the threshold where md5 mangling kicks in
// Test an ident with 4088 characters, pre-hash, MangleName.size() is 4095
#define X4088(X)                                \
    C2(C2(                                      \
      C4(X,       X4(X),   X4(X),    X8(X)),    \
      C4(X8(X),   X32(X),  X64(X),   X128(X))), \
      C4(X256(X), X512(X), X1024(X), X2048(X)))
#define Z4088 X4088(z)
// Use initialization to verify mangled name association in the il
int X4088(z) = 1515;
// CHECK-DAG: @"?{{z+}}@@3HA" = dso_local global i32 1515, align 4

// Test an ident with 4089 characters, pre-hash, MangleName.size() is 4096
#define X4089(X)                                \
    C2(C2(                                      \
      C4(X2(X),   X4(X),   X4(X),    X8(X)),    \
      C4(X8(X),   X32(X),  X64(X),   X128(X))), \
      C4(X256(X), X512(X), X1024(X), X2048(X)))
// Use initialization to verify mangled name association in the il
int X4089(z) = 1717;
// CHECK-DAG: @"??@0269945400a3474730d6880df0967d8f@" = dso_local global i32 1717, align 4