head	1.1;
branch	1.1.1;
access;
symbols
	netbsd-11-0-RC4:1.1.1.8
	netbsd-11-0-RC3:1.1.1.8
	netbsd-11-0-RC2:1.1.1.8
	netbsd-11-0-RC1:1.1.1.8
	perseant-exfatfs-base-20250801:1.1.1.8
	netbsd-11:1.1.1.8.0.10
	netbsd-11-base:1.1.1.8
	netbsd-10-1-RELEASE:1.1.1.8
	perseant-exfatfs-base-20240630:1.1.1.8
	perseant-exfatfs:1.1.1.8.0.8
	perseant-exfatfs-base:1.1.1.8
	netbsd-8-3-RELEASE:1.1.1.6
	netbsd-9-4-RELEASE:1.1.1.7
	netbsd-10-0-RELEASE:1.1.1.8
	netbsd-10-0-RC6:1.1.1.8
	netbsd-10-0-RC5:1.1.1.8
	netbsd-10-0-RC4:1.1.1.8
	netbsd-10-0-RC3:1.1.1.8
	netbsd-10-0-RC2:1.1.1.8
	netbsd-10-0-RC1:1.1.1.8
	netbsd-10:1.1.1.8.0.6
	netbsd-10-base:1.1.1.8
	netbsd-9-3-RELEASE:1.1.1.7
	cjep_sun2x:1.1.1.8.0.4
	cjep_sun2x-base:1.1.1.8
	cjep_staticlib_x-base1:1.1.1.8
	netbsd-9-2-RELEASE:1.1.1.7
	cjep_staticlib_x:1.1.1.8.0.2
	cjep_staticlib_x-base:1.1.1.8
	netbsd-9-1-RELEASE:1.1.1.7
	phil-wifi-20200421:1.1.1.8
	phil-wifi-20200411:1.1.1.8
	phil-wifi-20200406:1.1.1.8
	netbsd-8-2-RELEASE:1.1.1.6
	netbsd-9-0-RELEASE:1.1.1.7
	netbsd-9-0-RC2:1.1.1.7
	netbsd-9-0-RC1:1.1.1.7
	netbsd-9:1.1.1.7.0.2
	netbsd-9-base:1.1.1.7
	phil-wifi-20190609:1.1.1.7
	netbsd-8-1-RELEASE:1.1.1.6
	netbsd-8-1-RC1:1.1.1.6
	pgoyette-compat-merge-20190127:1.1.1.6.14.1
	pgoyette-compat-20190127:1.1.1.7
	pgoyette-compat-20190118:1.1.1.7
	pgoyette-compat-1226:1.1.1.7
	pgoyette-compat-1126:1.1.1.7
	pgoyette-compat-1020:1.1.1.7
	pgoyette-compat-0930:1.1.1.7
	pgoyette-compat-0906:1.1.1.7
	netbsd-7-2-RELEASE:1.1.1.4.2.1
	pgoyette-compat-0728:1.1.1.7
	clang-337282:1.1.1.7
	netbsd-8-0-RELEASE:1.1.1.6
	phil-wifi:1.1.1.6.0.16
	phil-wifi-base:1.1.1.6
	pgoyette-compat-0625:1.1.1.6
	netbsd-8-0-RC2:1.1.1.6
	pgoyette-compat-0521:1.1.1.6
	pgoyette-compat-0502:1.1.1.6
	pgoyette-compat-0422:1.1.1.6
	netbsd-8-0-RC1:1.1.1.6
	pgoyette-compat-0415:1.1.1.6
	pgoyette-compat-0407:1.1.1.6
	pgoyette-compat-0330:1.1.1.6
	pgoyette-compat-0322:1.1.1.6
	pgoyette-compat-0315:1.1.1.6
	netbsd-7-1-2-RELEASE:1.1.1.4.2.1
	pgoyette-compat:1.1.1.6.0.14
	pgoyette-compat-base:1.1.1.6
	netbsd-7-1-1-RELEASE:1.1.1.4.2.1
	clang-319952:1.1.1.6
	matt-nb8-mediatek:1.1.1.6.0.12
	matt-nb8-mediatek-base:1.1.1.6
	clang-309604:1.1.1.6
	perseant-stdc-iso10646:1.1.1.6.0.10
	perseant-stdc-iso10646-base:1.1.1.6
	netbsd-8:1.1.1.6.0.8
	netbsd-8-base:1.1.1.6
	prg-localcount2-base3:1.1.1.6
	prg-localcount2-base2:1.1.1.6
	prg-localcount2-base1:1.1.1.6
	prg-localcount2:1.1.1.6.0.6
	prg-localcount2-base:1.1.1.6
	pgoyette-localcount-20170426:1.1.1.6
	bouyer-socketcan-base1:1.1.1.6
	pgoyette-localcount-20170320:1.1.1.6
	netbsd-7-1:1.1.1.4.2.1.0.6
	netbsd-7-1-RELEASE:1.1.1.4.2.1
	netbsd-7-1-RC2:1.1.1.4.2.1
	clang-294123:1.1.1.6
	netbsd-7-nhusb-base-20170116:1.1.1.4.2.1
	bouyer-socketcan:1.1.1.6.0.4
	bouyer-socketcan-base:1.1.1.6
	clang-291444:1.1.1.6
	pgoyette-localcount-20170107:1.1.1.6
	netbsd-7-1-RC1:1.1.1.4.2.1
	pgoyette-localcount-20161104:1.1.1.6
	netbsd-7-0-2-RELEASE:1.1.1.4.2.1
	localcount-20160914:1.1.1.6
	netbsd-7-nhusb:1.1.1.4.2.1.0.4
	netbsd-7-nhusb-base:1.1.1.4.2.1
	clang-280599:1.1.1.6
	pgoyette-localcount-20160806:1.1.1.6
	pgoyette-localcount-20160726:1.1.1.6
	pgoyette-localcount:1.1.1.6.0.2
	pgoyette-localcount-base:1.1.1.6
	netbsd-7-0-1-RELEASE:1.1.1.4.2.1
	clang-261930:1.1.1.6
	netbsd-7-0:1.1.1.4.2.1.0.2
	netbsd-7-0-RELEASE:1.1.1.4.2.1
	netbsd-7-0-RC3:1.1.1.4.2.1
	netbsd-7-0-RC2:1.1.1.4.2.1
	netbsd-7-0-RC1:1.1.1.4.2.1
	clang-237755:1.1.1.5
	clang-232565:1.1.1.5
	clang-227398:1.1.1.5
	tls-maxphys-base:1.1.1.4
	tls-maxphys:1.1.1.4.0.4
	netbsd-7:1.1.1.4.0.2
	netbsd-7-base:1.1.1.4
	clang-215315:1.1.1.4
	clang-209886:1.1.1.3
	yamt-pagecache:1.1.1.2.0.4
	yamt-pagecache-base9:1.1.1.2
	tls-earlyentropy:1.1.1.2.0.2
	tls-earlyentropy-base:1.1.1.3
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.1.1.2
	riastradh-drm2-base3:1.1.1.2
	clang-202566:1.1.1.2
	clang-201163:1.1.1.2
	clang-199312:1.1.1.2
	clang-198450:1.1.1.1
	clang-196603:1.1.1.1
	clang-195771:1.1.1.1
	LLVM:1.1.1;
locks; strict;
comment	@// @;


1.1
date	2013.11.28.14.14.58;	author joerg;	state Exp;
branches
	1.1.1.1;
next	;
commitid	ow8OybrawrB1f3fx;

1.1.1.1
date	2013.11.28.14.14.58;	author joerg;	state Exp;
branches;
next	1.1.1.2;
commitid	ow8OybrawrB1f3fx;

1.1.1.2
date	2014.01.15.21.26.09;	author joerg;	state Exp;
branches
	1.1.1.2.2.1
	1.1.1.2.4.1;
next	1.1.1.3;
commitid	NQXlzzA0SPkc5glx;

1.1.1.3
date	2014.05.30.18.14.47;	author joerg;	state Exp;
branches;
next	1.1.1.4;
commitid	8q0kdlBlCn09GACx;

1.1.1.4
date	2014.08.10.17.08.40;	author joerg;	state Exp;
branches
	1.1.1.4.2.1
	1.1.1.4.4.1;
next	1.1.1.5;
commitid	N85tXAN6Ex9VZPLx;

1.1.1.5
date	2015.01.29.19.57.35;	author joerg;	state Exp;
branches;
next	1.1.1.6;
commitid	mlISSizlPKvepX7y;

1.1.1.6
date	2016.02.27.22.10.23;	author joerg;	state Exp;
branches
	1.1.1.6.14.1
	1.1.1.6.16.1;
next	1.1.1.7;
commitid	tIimz3oDlh1NpBWy;

1.1.1.7
date	2018.07.17.18.31.27;	author joerg;	state Exp;
branches;
next	1.1.1.8;
commitid	wDzL46ALjrCZgwKA;

1.1.1.8
date	2019.11.13.22.20.15;	author joerg;	state dead;
branches;
next	;
commitid	QD8YATxuNG34YJKB;

1.1.1.2.2.1
date	2014.08.10.07.08.14;	author tls;	state Exp;
branches;
next	;
commitid	t01A1TLTYxkpGMLx;

1.1.1.2.4.1
date	2014.01.15.21.26.09;	author yamt;	state dead;
branches;
next	1.1.1.2.4.2;
commitid	WSrDtL5nYAUyiyBx;

1.1.1.2.4.2
date	2014.05.22.16.18.57;	author yamt;	state Exp;
branches;
next	;
commitid	WSrDtL5nYAUyiyBx;

1.1.1.4.2.1
date	2015.06.04.20.04.34;	author snj;	state Exp;
branches;
next	;
commitid	yRnjq9fueSo6n9oy;

1.1.1.4.4.1
date	2014.08.10.17.08.40;	author tls;	state dead;
branches;
next	1.1.1.4.4.2;
commitid	jTnpym9Qu0o4R1Nx;

1.1.1.4.4.2
date	2014.08.19.23.47.58;	author tls;	state Exp;
branches;
next	;
commitid	jTnpym9Qu0o4R1Nx;

1.1.1.6.14.1
date	2018.07.28.04.33.42;	author pgoyette;	state Exp;
branches;
next	;
commitid	1UP1xAIUxv1ZgRLA;

1.1.1.6.16.1
date	2019.06.10.21.45.52;	author christos;	state Exp;
branches;
next	1.1.1.6.16.2;
commitid	jtc8rnCzWiEEHGqB;

1.1.1.6.16.2
date	2020.04.13.07.47.29;	author martin;	state dead;
branches;
next	;
commitid	X01YhRUPVUDaec4C;


desc
@@


1.1
log
@Initial revision
@
text
@// RUN: %clang_cc1 -emit-llvm %s -o - -mconstructor-aliases -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s

// CHECK: @@llvm.global_ctors = appending global [2 x { i32, void ()* }]
// CHECK: [{ i32, void ()* } { i32 65535, void ()* @@"\01??__Efoo@@?$B@@H@@@@YAXXZ" },
// CHECK:  { i32, void ()* } { i32 65535, void ()* @@_GLOBAL__I_a }]

struct S {
  S();
  ~S();
};

S s;

// CHECK: define internal void @@"\01??__Es@@@@YAXXZ"() [[NUW:#[0-9]+]]
// CHECK: %{{[.0-9A-Z_a-z]+}} = call x86_thiscallcc %struct.S* @@"\01??0S@@@@QAE@@XZ"
// CHECK: call i32 @@atexit(void ()* @@"\01??__Fs@@@@YAXXZ")
// CHECK: ret void

// CHECK: define internal void @@"\01??__Fs@@@@YAXXZ"() [[NUW]] {
// CHECK: call x86_thiscallcc void @@"\01??1S@@@@QAE@@XZ"
// CHECK: ret void

void StaticLocal() {
  static S TheS;
}
// CHECK-LABEL: define void @@"\01?StaticLocal@@@@YAXXZ"()
// CHECK: load i32* @@"\01?$S1@@?1??StaticLocal@@@@YAXXZ@@4IA"
// CHECK: store i32 {{.*}}, i32* @@"\01?$S1@@?1??StaticLocal@@@@YAXXZ@@4IA"
// CHECK: ret

void MultipleStatics() {
  static S S1;
  static S S2;
  static S S3;
  static S S4;
  static S S5;
  static S S6;
  static S S7;
  static S S8;
  static S S9;
  static S S10;
  static S S11;
  static S S12;
  static S S13;
  static S S14;
  static S S15;
  static S S16;
  static S S17;
  static S S18;
  static S S19;
  static S S20;
  static S S21;
  static S S22;
  static S S23;
  static S S24;
  static S S25;
  static S S26;
  static S S27;
  static S S28;
  static S S29;
  static S S30;
  static S S31;
  static S S32;
  static S S33;
  static S S34;
  static S S35;
}
// CHECK-LABEL: define void @@"\01?MultipleStatics@@@@YAXXZ"()
// CHECK: load i32* @@"\01?$S1@@?1??MultipleStatics@@@@YAXXZ@@4IA"
// CHECK: and i32 {{.*}}, 1
// CHECK: and i32 {{.*}}, 2
// CHECK: and i32 {{.*}}, 4
// CHECK: and i32 {{.*}}, 8
// CHECK: and i32 {{.*}}, 16
//   ...
// CHECK: and i32 {{.*}}, -2147483648
// CHECK: load i32* @@"\01?$S1@@?1??MultipleStatics@@@@YAXXZ@@4IA1"
// CHECK: and i32 {{.*}}, 1
// CHECK: and i32 {{.*}}, 2
// CHECK: and i32 {{.*}}, 4
// CHECK: ret

// Force WeakODRLinkage by using templates
class A {
 public:
  A() {}
  ~A() {}
};

template<typename T>
class B {
 public:
  static A foo;
};

template<typename T> A B<T>::foo;

inline S &UnreachableStatic() {
  if (0) {
    static S s; // bit 1
    return s;
  }
  static S s; // bit 2
  return s;
}

// CHECK-LABEL: define linkonce_odr %struct.S* @@"\01?UnreachableStatic@@@@YAAAUS@@@@XZ"()
// CHECK: and i32 {{.*}}, 2
// CHECK: or i32 {{.*}}, 2
// CHECK: ret

inline S &getS() {
  static S TheS;
  return TheS;
}

// CHECK-LABEL: define linkonce_odr %struct.S* @@"\01?getS@@@@YAAAUS@@@@XZ"
// CHECK: load i32* @@"\01??_B?1??getS@@@@YAAAUS@@@@XZ@@51"
// CHECK: and i32 {{.*}}, 1
// CHECK: icmp ne i32 {{.*}}, 0
// CHECK: br i1
//   init:
// CHECK: or i32 {{.*}}, 1
// CHECK: store i32 {{.*}}, i32* @@"\01??_B?1??getS@@@@YAAAUS@@@@XZ@@51"
// CHECK: call x86_thiscallcc %struct.S* @@"\01??0S@@@@QAE@@XZ"(%struct.S* @@"\01?TheS@@?1??getS@@@@YAAAUS@@@@XZ@@4U2@@A")
// CHECK: call i32 @@atexit(void ()* @@"\01??__FTheS@@?1??getS@@@@YAAAUS@@@@XZ@@YAXXZ")
// CHECK: br label
//   init.end:
// CHECK: ret %struct.S* @@"\01?TheS@@?1??getS@@@@YAAAUS@@@@XZ@@4U2@@A"

void force_usage() {
  UnreachableStatic();
  getS();
  (void)B<int>::foo;  // (void) - force usage
}

// CHECK: define internal void @@"\01??__Efoo@@?$B@@H@@@@YAXXZ"() [[NUW]]
// CHECK: %{{[.0-9A-Z_a-z]+}} = call x86_thiscallcc %class.A* @@"\01??0A@@@@QAE@@XZ"
// CHECK: call i32 @@atexit(void ()* @@"\01??__Ffoo@@?$B@@H@@@@YAXXZ")
// CHECK: ret void

// CHECK: define linkonce_odr x86_thiscallcc %class.A* @@"\01??0A@@@@QAE@@XZ"

// CHECK: define linkonce_odr x86_thiscallcc void @@"\01??1A@@@@QAE@@XZ"

// CHECK: define internal void @@"\01??__Ffoo@@?$B@@H@@@@YAXXZ"
// CHECK: call x86_thiscallcc void @@"\01??1A@@@@QAE@@XZ"{{.*}}foo
// CHECK: ret void

// CHECK: define internal void @@_GLOBAL__I_a() [[NUW]] {
// CHECK: call void @@"\01??__Es@@@@YAXXZ"()
// CHECK: ret void

// CHECK: attributes [[NUW]] = { nounwind }
@


1.1.1.1
log
@Import Clang 3.4rc1 r195771.
@
text
@@


1.1.1.2
log
@Import Clang 3.5svn r199312
@
text
@d1 1
a1 1
// RUN: %clang_cc1 -emit-llvm %s -o - -mconstructor-aliases -triple=i386-pc-win32 | FileCheck %s
@


1.1.1.2.2.1
log
@Rebase.
@
text
@d1 1
a1 1
// RUN: %clang_cc1 -fms-extensions -emit-llvm %s -o - -mconstructor-aliases -triple=i386-pc-win32 | FileCheck %s
d3 3
a5 4
// CHECK: @@llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }]
// CHECK: [{ i32, void ()*, i8* } { i32 65535, void ()* @@"\01??__Efoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ",
// CHECK:       i8* bitcast (%class.A* @@"\01?foo@@?$B@@H@@@@2VA@@@@A" to i8*) },
// CHECK:  { i32, void ()*, i8* } { i32 65535, void ()* @@_GLOBAL__sub_I_microsoft_abi_static_initializers.cpp, i8* null }]
d14 2
a15 2
// CHECK: define internal void @@"\01??__Es@@@@YAXXZ"()
// CHECK: call x86_thiscallcc %struct.S* @@"\01??0S@@@@QAE@@XZ"
d19 1
a19 1
// CHECK: define internal void @@"\01??__Fs@@@@YAXXZ"()
a22 13
// These globals should use distinct guard variables, and not different bits of
// the same global.
__declspec(selectany) S selectany1;
__declspec(selectany) S selectany2;
// CHECK: define linkonce_odr void @@"\01??__Eselectany1@@@@YAXXZ"()
// CHECK-NOT: @@"\01??_Bselectany1
// CHECK: call x86_thiscallcc %struct.S* @@"\01??0S@@@@QAE@@XZ"
// CHECK: ret void
// CHECK: define linkonce_odr void @@"\01??__Eselectany2@@@@YAXXZ"()
// CHECK-NOT: @@"\01??_Bselectany2
// CHECK: call x86_thiscallcc %struct.S* @@"\01??0S@@@@QAE@@XZ"
// CHECK: ret void

d27 2
a28 2
// CHECK: load i32* @@"\01?$S1@@?0??StaticLocal@@@@YAXXZ@@4IA"
// CHECK: store i32 {{.*}}, i32* @@"\01?$S1@@?0??StaticLocal@@@@YAXXZ@@4IA"
d69 1
a69 1
// CHECK: load i32* @@"\01?$S1@@?0??MultipleStatics@@@@YAXXZ@@4IA"
d77 1
a77 1
// CHECK: load i32* @@"\01?$S1@@?0??MultipleStatics@@@@YAXXZ@@4IA1"
a87 1
  int a;
d107 1
a107 1
// CHECK-LABEL: define linkonce_odr nonnull %struct.S* @@"\01?UnreachableStatic@@@@YAAAUS@@@@XZ"()
d117 1
a117 1
// CHECK-LABEL: define linkonce_odr nonnull %struct.S* @@"\01?getS@@@@YAAAUS@@@@XZ"
d137 3
a139 5
// CHECK: define linkonce_odr void @@"\01??__Efoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ"()
// CHECK-NOT: and
// CHECK-NOT: ?_Bfoo@@
// CHECK: call x86_thiscallcc %class.A* @@"\01??0A@@@@QAE@@XZ"
// CHECK: call i32 @@atexit(void ()* @@"\01??__Ffoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ")
d146 1
a146 1
// CHECK: define internal void @@"\01??__Ffoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ"
d150 1
a150 1
// CHECK: define internal void @@_GLOBAL__sub_I_microsoft_abi_static_initializers.cpp()
d153 2
@


1.1.1.3
log
@Import Clang 3.5svn r209886.
@
text
@d1 1
a1 1
// RUN: %clang_cc1 -fms-extensions -emit-llvm %s -o - -mconstructor-aliases -triple=i386-pc-win32 | FileCheck %s
d3 3
a5 4
// CHECK: @@llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }]
// CHECK: [{ i32, void ()*, i8* } { i32 65535, void ()* @@"\01??__Efoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ",
// CHECK:       i8* bitcast (%class.A* @@"\01?foo@@?$B@@H@@@@2VA@@@@A" to i8*) },
// CHECK:  { i32, void ()*, i8* } { i32 65535, void ()* @@_GLOBAL__sub_I_microsoft_abi_static_initializers.cpp, i8* null }]
d14 2
a15 2
// CHECK: define internal void @@"\01??__Es@@@@YAXXZ"()
// CHECK: call x86_thiscallcc %struct.S* @@"\01??0S@@@@QAE@@XZ"
d19 1
a19 1
// CHECK: define internal void @@"\01??__Fs@@@@YAXXZ"()
a22 13
// These globals should use distinct guard variables, and not different bits of
// the same global.
__declspec(selectany) S selectany1;
__declspec(selectany) S selectany2;
// CHECK: define linkonce_odr void @@"\01??__Eselectany1@@@@YAXXZ"()
// CHECK-NOT: @@"\01??_Bselectany1
// CHECK: call x86_thiscallcc %struct.S* @@"\01??0S@@@@QAE@@XZ"
// CHECK: ret void
// CHECK: define linkonce_odr void @@"\01??__Eselectany2@@@@YAXXZ"()
// CHECK-NOT: @@"\01??_Bselectany2
// CHECK: call x86_thiscallcc %struct.S* @@"\01??0S@@@@QAE@@XZ"
// CHECK: ret void

d27 2
a28 2
// CHECK: load i32* @@"\01?$S1@@?0??StaticLocal@@@@YAXXZ@@4IA"
// CHECK: store i32 {{.*}}, i32* @@"\01?$S1@@?0??StaticLocal@@@@YAXXZ@@4IA"
d69 1
a69 1
// CHECK: load i32* @@"\01?$S1@@?0??MultipleStatics@@@@YAXXZ@@4IA"
d77 1
a77 1
// CHECK: load i32* @@"\01?$S1@@?0??MultipleStatics@@@@YAXXZ@@4IA1"
a87 1
  int a;
d107 1
a107 1
// CHECK-LABEL: define linkonce_odr nonnull %struct.S* @@"\01?UnreachableStatic@@@@YAAAUS@@@@XZ"()
d117 1
a117 1
// CHECK-LABEL: define linkonce_odr nonnull %struct.S* @@"\01?getS@@@@YAAAUS@@@@XZ"
d137 3
a139 5
// CHECK: define linkonce_odr void @@"\01??__Efoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ"()
// CHECK-NOT: and
// CHECK-NOT: ?_Bfoo@@
// CHECK: call x86_thiscallcc %class.A* @@"\01??0A@@@@QAE@@XZ"
// CHECK: call i32 @@atexit(void ()* @@"\01??__Ffoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ")
d146 1
a146 1
// CHECK: define internal void @@"\01??__Ffoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ"
d150 1
a150 1
// CHECK: define internal void @@_GLOBAL__sub_I_microsoft_abi_static_initializers.cpp()
d153 2
@


1.1.1.4
log
@Import clang 3.6svn r215315.
@
text
@d122 1
a122 1
// CHECK-LABEL: define linkonce_odr dereferenceable({{[0-9]+}}) %struct.S* @@"\01?UnreachableStatic@@@@YAAAUS@@@@XZ"()
d132 1
a132 1
// CHECK-LABEL: define linkonce_odr dereferenceable({{[0-9]+}}) %struct.S* @@"\01?getS@@@@YAAAUS@@@@XZ"
a145 63
inline int enum_in_function() {
  // CHECK-LABEL: define linkonce_odr i32 @@"\01?enum_in_function@@@@YAHXZ"()
  static enum e { foo, bar, baz } x;
  // CHECK: @@"\01?x@@?1??enum_in_function@@@@YAHXZ@@4W4e@@?1??1@@YAHXZ@@A"
  static int y;
  // CHECK: @@"\01?y@@?1??enum_in_function@@@@YAHXZ@@4HA"
  return x + y;
};

struct T {
  enum e { foo, bar, baz };
  int enum_in_struct() {
    // CHECK-LABEL: define linkonce_odr x86_thiscallcc i32 @@"\01?enum_in_struct@@T@@@@QAEHXZ"
    static int x;
    // CHECK: @@"\01?x@@?1??enum_in_struct@@T@@@@QAEHXZ@@4HA"
    return x++;
  }
};

inline int switch_test(int x) {
  // CHECK-LABEL: define linkonce_odr i32 @@"\01?switch_test@@@@YAHH@@Z"(i32 %x)
  switch (x) {
    static int a;
    // CHECK: @@"\01?a@@?3??switch_test@@@@YAHH@@Z@@4HA"
    case 0:
      a++;
      return 1;
    case 1:
      static int b;
      // CHECK: @@"\01?b@@?3??switch_test@@@@YAHH@@Z@@4HA"
      return b++;
    case 2: {
      static int c;
      // CHECK: @@"\01?c@@?4??switch_test@@@@YAHH@@Z@@4HA"
      return b + c++;
    }
  };
}

int f();
inline void switch_test2() {
  // CHECK-LABEL: define linkonce_odr void @@"\01?switch_test2@@@@YAXXZ"()
  // CHECK: @@"\01?x@@?2??switch_test2@@@@YAXXZ@@4HA"
  switch (1) default: static int x = f();
}

namespace DynamicDLLImportInitVSMangling {
  // Failing to pop the ExprEvalContexts when instantiating a dllimport var with
  // dynamic initializer would cause subsequent static local numberings to be
  // incorrect.
  struct NonPOD { NonPOD(); };
  template <typename T> struct A { static NonPOD x; };
  template <typename T> NonPOD A<T>::x;
  template struct __declspec(dllimport) A<int>;

  inline int switch_test3() {
    // CHECK-LABEL: define linkonce_odr i32 @@"\01?switch_test3@@DynamicDLLImportInitVSMangling@@@@YAHXZ"
    static int local;
    // CHECK: @@"\01?local@@?1??switch_test3@@DynamicDLLImportInitVSMangling@@@@YAHXZ@@4HA"
    return local++;
  }
}

a149 5
  enum_in_function();
  (void)&T::enum_in_struct;
  switch_test(1);
  switch_test2();
  DynamicDLLImportInitVSMangling::switch_test3();
@


1.1.1.4.2.1
log
@Update LLVM to 3.6.1, requested by joerg in ticket 824.
@
text
@d3 4
a6 7
// CHECK: @@llvm.global_ctors = appending global [5 x { i32, void ()*, i8* }] [
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"\01??__Eselectany1@@@@YAXXZ", i8* getelementptr inbounds (%struct.S* @@"\01?selectany1@@@@3US@@@@A", i32 0, i32 0) },
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"\01??__Eselectany2@@@@YAXXZ", i8* getelementptr inbounds (%struct.S* @@"\01?selectany2@@@@3US@@@@A", i32 0, i32 0) },
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"\01??__Es@@?$ExportedTemplate@@H@@@@2US@@@@A@@YAXXZ", i8* getelementptr inbounds (%struct.S* @@"\01?s@@?$ExportedTemplate@@H@@@@2US@@@@A", i32 0, i32 0) },
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"\01??__Efoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ", i8* bitcast (%class.A* @@"\01?foo@@?$B@@H@@@@2VA@@@@A" to i8*) },
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@_GLOBAL__sub_I_microsoft_abi_static_initializers.cpp, i8* null }
// CHECK: ]
d24 2
a25 2
// These globals should have initializers comdat associative with the global.
// See @@llvm.global_ctors above.
a36 10
// The implicitly instantiated static data member should have initializer
// comdat associative with the global.
template <typename T> struct __declspec(dllexport) ExportedTemplate {
  static S s;
};
template <typename T> S ExportedTemplate<T>::s;
void useExportedTemplate(ExportedTemplate<int> x) {
  (void)x.s;
}

a39 1

d41 2
a42 2
// CHECK: load i32* @@"\01?$S1@@?1??StaticLocal@@@@YAXXZ@@4IA"
// CHECK: store i32 {{.*}}, i32* @@"\01?$S1@@?1??StaticLocal@@@@YAXXZ@@4IA"
d83 1
a83 1
// CHECK: load i32* @@"\01?$S1@@?1??MultipleStatics@@@@YAXXZ@@4IA"
d91 1
a91 1
// CHECK: load i32* @@"\01?$S1@@?1??MultipleStatics@@@@YAXXZ@@4IA1"
@


1.1.1.5
log
@Import Clang 3.6RC1 r227398.
@
text
@d3 4
a6 7
// CHECK: @@llvm.global_ctors = appending global [5 x { i32, void ()*, i8* }] [
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"\01??__Eselectany1@@@@YAXXZ", i8* getelementptr inbounds (%struct.S* @@"\01?selectany1@@@@3US@@@@A", i32 0, i32 0) },
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"\01??__Eselectany2@@@@YAXXZ", i8* getelementptr inbounds (%struct.S* @@"\01?selectany2@@@@3US@@@@A", i32 0, i32 0) },
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"\01??__Es@@?$ExportedTemplate@@H@@@@2US@@@@A@@YAXXZ", i8* getelementptr inbounds (%struct.S* @@"\01?s@@?$ExportedTemplate@@H@@@@2US@@@@A", i32 0, i32 0) },
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"\01??__Efoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ", i8* bitcast (%class.A* @@"\01?foo@@?$B@@H@@@@2VA@@@@A" to i8*) },
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@_GLOBAL__sub_I_microsoft_abi_static_initializers.cpp, i8* null }
// CHECK: ]
d24 2
a25 2
// These globals should have initializers comdat associative with the global.
// See @@llvm.global_ctors above.
a36 10
// The implicitly instantiated static data member should have initializer
// comdat associative with the global.
template <typename T> struct __declspec(dllexport) ExportedTemplate {
  static S s;
};
template <typename T> S ExportedTemplate<T>::s;
void useExportedTemplate(ExportedTemplate<int> x) {
  (void)x.s;
}

a39 1

d41 2
a42 2
// CHECK: load i32* @@"\01?$S1@@?1??StaticLocal@@@@YAXXZ@@4IA"
// CHECK: store i32 {{.*}}, i32* @@"\01?$S1@@?1??StaticLocal@@@@YAXXZ@@4IA"
d83 1
a83 1
// CHECK: load i32* @@"\01?$S1@@?1??MultipleStatics@@@@YAXXZ@@4IA"
d91 1
a91 1
// CHECK: load i32* @@"\01?$S1@@?1??MultipleStatics@@@@YAXXZ@@4IA1"
@


1.1.1.6
log
@Import Clang 3.8.0rc3 r261930.
@
text
@d1 1
a1 1
// RUN: %clang_cc1 -fms-extensions -fno-threadsafe-statics -emit-llvm %s -o - -mconstructor-aliases -triple=i386-pc-win32 | FileCheck %s
d4 3
a6 3
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"\01??__Eselectany1@@@@YAXXZ", i8* getelementptr inbounds (%struct.S, %struct.S* @@"\01?selectany1@@@@3US@@@@A", i32 0, i32 0) },
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"\01??__Eselectany2@@@@YAXXZ", i8* getelementptr inbounds (%struct.S, %struct.S* @@"\01?selectany2@@@@3US@@@@A", i32 0, i32 0) },
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"\01??__Es@@?$ExportedTemplate@@H@@@@2US@@@@A@@YAXXZ", i8* getelementptr inbounds (%struct.S, %struct.S* @@"\01?s@@?$ExportedTemplate@@H@@@@2US@@@@A", i32 0, i32 0) },
d31 1
a31 1
// CHECK: define linkonce_odr void @@"\01??__Eselectany1@@@@YAXXZ"() {{.*}} comdat
d35 1
a35 1
// CHECK: define linkonce_odr void @@"\01??__Eselectany2@@@@YAXXZ"() {{.*}} comdat
d55 1
a55 1
// CHECK: load i32, i32* @@"\01?$S1@@?1??StaticLocal@@@@YAXXZ@@4IA"
d97 1
a97 1
// CHECK: load i32, i32* @@"\01?$S1@@?1??MultipleStatics@@@@YAXXZ@@4IA"
d105 1
a105 1
// CHECK: load i32, i32* @@"\01?$S1@@?1??MultipleStatics@@@@YAXXZ@@4IA.1"
d136 1
a136 1
// CHECK-LABEL: define linkonce_odr dereferenceable({{[0-9]+}}) %struct.S* @@"\01?UnreachableStatic@@@@YAAAUS@@@@XZ"() {{.*}} comdat
d146 2
a147 2
// CHECK-LABEL: define linkonce_odr dereferenceable({{[0-9]+}}) %struct.S* @@"\01?getS@@@@YAAAUS@@@@XZ"() {{.*}} comdat
// CHECK: load i32, i32* @@"\01??_B?1??getS@@@@YAAAUS@@@@XZ@@51"
d161 1
a161 1
  // CHECK-LABEL: define linkonce_odr i32 @@"\01?enum_in_function@@@@YAHXZ"() {{.*}} comdat
d172 1
a172 1
    // CHECK-LABEL: define linkonce_odr x86_thiscallcc i32 @@"\01?enum_in_struct@@T@@@@QAEHXZ"({{.*}}) {{.*}} comdat
d180 1
a180 1
  // CHECK-LABEL: define linkonce_odr i32 @@"\01?switch_test@@@@YAHH@@Z"(i32 %x) {{.*}} comdat
d201 1
a201 1
  // CHECK-LABEL: define linkonce_odr void @@"\01?switch_test2@@@@YAXXZ"() {{.*}} comdat
d216 1
a216 1
    // CHECK-LABEL: define linkonce_odr i32 @@"\01?switch_test3@@DynamicDLLImportInitVSMangling@@@@YAHXZ"() {{.*}} comdat
d234 1
a234 1
// CHECK: define linkonce_odr void @@"\01??__Efoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ"() {{.*}} comdat
d241 1
a241 1
// CHECK: define linkonce_odr x86_thiscallcc %class.A* @@"\01??0A@@@@QAE@@XZ"({{.*}}) {{.*}} comdat
d243 1
a243 1
// CHECK: define linkonce_odr x86_thiscallcc void @@"\01??1A@@@@QAE@@XZ"({{.*}}) {{.*}} comdat
@


1.1.1.6.16.1
log
@Sync with HEAD
@
text
@d4 4
a7 4
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"??__Eselectany1@@@@YAXXZ", i8* getelementptr inbounds (%struct.S, %struct.S* @@"?selectany1@@@@3US@@@@A", i32 0, i32 0) },
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"??__Eselectany2@@@@YAXXZ", i8* getelementptr inbounds (%struct.S, %struct.S* @@"?selectany2@@@@3US@@@@A", i32 0, i32 0) },
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"??__Es@@?$ExportedTemplate@@H@@@@2US@@@@A@@YAXXZ", i8* getelementptr inbounds (%struct.S, %struct.S* @@"?s@@?$ExportedTemplate@@H@@@@2US@@@@A", i32 0, i32 0) },
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"??__Efoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ", i8* bitcast (%class.A* @@"?foo@@?$B@@H@@@@2VA@@@@A" to i8*) },
d18 3
a20 3
// CHECK: define internal void @@"??__Es@@@@YAXXZ"()
// CHECK: call x86_thiscallcc %struct.S* @@"??0S@@@@QAE@@XZ"
// CHECK: call i32 @@atexit(void ()* @@"??__Fs@@@@YAXXZ")
d23 2
a24 2
// CHECK: define internal void @@"??__Fs@@@@YAXXZ"()
// CHECK: call x86_thiscallcc void @@"??1S@@@@QAE@@XZ"
d31 7
a37 7
// CHECK: define linkonce_odr dso_local void @@"??__Eselectany1@@@@YAXXZ"() {{.*}} comdat
// CHECK-NOT: @@"??_Bselectany1
// CHECK: call x86_thiscallcc %struct.S* @@"??0S@@@@QAE@@XZ"
// CHECK: ret void
// CHECK: define linkonce_odr dso_local void @@"??__Eselectany2@@@@YAXXZ"() {{.*}} comdat
// CHECK-NOT: @@"??_Bselectany2
// CHECK: call x86_thiscallcc %struct.S* @@"??0S@@@@QAE@@XZ"
d54 3
a56 3
// CHECK-LABEL: define dso_local void @@"?StaticLocal@@@@YAXXZ"()
// CHECK: load i32, i32* @@"?$S1@@?1??StaticLocal@@@@YAXXZ@@4IA"
// CHECK: store i32 {{.*}}, i32* @@"?$S1@@?1??StaticLocal@@@@YAXXZ@@4IA"
d96 2
a97 2
// CHECK-LABEL: define dso_local void @@"?MultipleStatics@@@@YAXXZ"()
// CHECK: load i32, i32* @@"?$S1@@?1??MultipleStatics@@@@YAXXZ@@4IA"
d105 1
a105 1
// CHECK: load i32, i32* @@"?$S1@@?1??MultipleStatics@@@@YAXXZ@@4IA.1"
d136 1
a136 1
// CHECK-LABEL: define linkonce_odr dso_local dereferenceable({{[0-9]+}}) %struct.S* @@"?UnreachableStatic@@@@YAAAUS@@@@XZ"() {{.*}} comdat
d146 2
a147 2
// CHECK-LABEL: define linkonce_odr dso_local dereferenceable({{[0-9]+}}) %struct.S* @@"?getS@@@@YAAAUS@@@@XZ"() {{.*}} comdat
// CHECK: load i32, i32* @@"??_B?1??getS@@@@YAAAUS@@@@XZ@@51"
d149 1
a149 1
// CHECK: icmp eq i32 {{.*}}, 0
d153 3
a155 3
// CHECK: store i32 {{.*}}, i32* @@"??_B?1??getS@@@@YAAAUS@@@@XZ@@51"
// CHECK: call x86_thiscallcc %struct.S* @@"??0S@@@@QAE@@XZ"(%struct.S* @@"?TheS@@?1??getS@@@@YAAAUS@@@@XZ@@4U2@@A")
// CHECK: call i32 @@atexit(void ()* @@"??__FTheS@@?1??getS@@@@YAAAUS@@@@XZ@@YAXXZ")
d158 1
a158 1
// CHECK: ret %struct.S* @@"?TheS@@?1??getS@@@@YAAAUS@@@@XZ@@4U2@@A"
d161 1
a161 1
  // CHECK-LABEL: define linkonce_odr dso_local i32 @@"?enum_in_function@@@@YAHXZ"() {{.*}} comdat
d163 1
a163 1
  // CHECK: @@"?x@@?1??enum_in_function@@@@YAHXZ@@4W4e@@?1??1@@YAHXZ@@A"
d165 1
a165 1
  // CHECK: @@"?y@@?1??enum_in_function@@@@YAHXZ@@4HA"
d172 1
a172 1
    // CHECK-LABEL: define linkonce_odr dso_local x86_thiscallcc i32 @@"?enum_in_struct@@T@@@@QAEHXZ"({{.*}}) {{.*}} comdat
d174 1
a174 1
    // CHECK: @@"?x@@?1??enum_in_struct@@T@@@@QAEHXZ@@4HA"
d180 1
a180 1
  // CHECK-LABEL: define linkonce_odr dso_local i32 @@"?switch_test@@@@YAHH@@Z"(i32 %x) {{.*}} comdat
d183 1
a183 1
    // CHECK: @@"?a@@?3??switch_test@@@@YAHH@@Z@@4HA"
d189 1
a189 1
      // CHECK: @@"?b@@?3??switch_test@@@@YAHH@@Z@@4HA"
d193 1
a193 1
      // CHECK: @@"?c@@?4??switch_test@@@@YAHH@@Z@@4HA"
d201 2
a202 2
  // CHECK-LABEL: define linkonce_odr dso_local void @@"?switch_test2@@@@YAXXZ"() {{.*}} comdat
  // CHECK: @@"?x@@?2??switch_test2@@@@YAXXZ@@4HA"
d216 1
a216 1
    // CHECK-LABEL: define linkonce_odr dso_local i32 @@"?switch_test3@@DynamicDLLImportInitVSMangling@@@@YAHXZ"() {{.*}} comdat
d218 1
a218 1
    // CHECK: @@"?local@@?1??switch_test3@@DynamicDLLImportInitVSMangling@@@@YAHXZ@@4HA"
d234 1
a234 1
// CHECK: define linkonce_odr dso_local void @@"??__Efoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ"() {{.*}} comdat
d237 2
a238 2
// CHECK: call x86_thiscallcc %class.A* @@"??0A@@@@QAE@@XZ"
// CHECK: call i32 @@atexit(void ()* @@"??__Ffoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ")
d241 1
a241 1
// CHECK: define linkonce_odr dso_local x86_thiscallcc %class.A* @@"??0A@@@@QAE@@XZ"({{.*}}) {{.*}} comdat
d243 1
a243 1
// CHECK: define linkonce_odr dso_local x86_thiscallcc void @@"??1A@@@@QAE@@XZ"({{.*}}) {{.*}} comdat
d245 2
a246 2
// CHECK: define internal void @@"??__Ffoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ"
// CHECK: call x86_thiscallcc void @@"??1A@@@@QAE@@XZ"{{.*}}foo
d250 1
a250 1
// CHECK: call void @@"??__Es@@@@YAXXZ"()
@


1.1.1.6.16.2
log
@Mostly merge changes from HEAD upto 20200411
@
text
@@


1.1.1.6.14.1
log
@Sync with HEAD
@
text
@d4 4
a7 4
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"??__Eselectany1@@@@YAXXZ", i8* getelementptr inbounds (%struct.S, %struct.S* @@"?selectany1@@@@3US@@@@A", i32 0, i32 0) },
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"??__Eselectany2@@@@YAXXZ", i8* getelementptr inbounds (%struct.S, %struct.S* @@"?selectany2@@@@3US@@@@A", i32 0, i32 0) },
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"??__Es@@?$ExportedTemplate@@H@@@@2US@@@@A@@YAXXZ", i8* getelementptr inbounds (%struct.S, %struct.S* @@"?s@@?$ExportedTemplate@@H@@@@2US@@@@A", i32 0, i32 0) },
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"??__Efoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ", i8* bitcast (%class.A* @@"?foo@@?$B@@H@@@@2VA@@@@A" to i8*) },
d18 3
a20 3
// CHECK: define internal void @@"??__Es@@@@YAXXZ"()
// CHECK: call x86_thiscallcc %struct.S* @@"??0S@@@@QAE@@XZ"
// CHECK: call i32 @@atexit(void ()* @@"??__Fs@@@@YAXXZ")
d23 2
a24 2
// CHECK: define internal void @@"??__Fs@@@@YAXXZ"()
// CHECK: call x86_thiscallcc void @@"??1S@@@@QAE@@XZ"
d31 7
a37 7
// CHECK: define linkonce_odr dso_local void @@"??__Eselectany1@@@@YAXXZ"() {{.*}} comdat
// CHECK-NOT: @@"??_Bselectany1
// CHECK: call x86_thiscallcc %struct.S* @@"??0S@@@@QAE@@XZ"
// CHECK: ret void
// CHECK: define linkonce_odr dso_local void @@"??__Eselectany2@@@@YAXXZ"() {{.*}} comdat
// CHECK-NOT: @@"??_Bselectany2
// CHECK: call x86_thiscallcc %struct.S* @@"??0S@@@@QAE@@XZ"
d54 3
a56 3
// CHECK-LABEL: define dso_local void @@"?StaticLocal@@@@YAXXZ"()
// CHECK: load i32, i32* @@"?$S1@@?1??StaticLocal@@@@YAXXZ@@4IA"
// CHECK: store i32 {{.*}}, i32* @@"?$S1@@?1??StaticLocal@@@@YAXXZ@@4IA"
d96 2
a97 2
// CHECK-LABEL: define dso_local void @@"?MultipleStatics@@@@YAXXZ"()
// CHECK: load i32, i32* @@"?$S1@@?1??MultipleStatics@@@@YAXXZ@@4IA"
d105 1
a105 1
// CHECK: load i32, i32* @@"?$S1@@?1??MultipleStatics@@@@YAXXZ@@4IA.1"
d136 1
a136 1
// CHECK-LABEL: define linkonce_odr dso_local dereferenceable({{[0-9]+}}) %struct.S* @@"?UnreachableStatic@@@@YAAAUS@@@@XZ"() {{.*}} comdat
d146 2
a147 2
// CHECK-LABEL: define linkonce_odr dso_local dereferenceable({{[0-9]+}}) %struct.S* @@"?getS@@@@YAAAUS@@@@XZ"() {{.*}} comdat
// CHECK: load i32, i32* @@"??_B?1??getS@@@@YAAAUS@@@@XZ@@51"
d149 1
a149 1
// CHECK: icmp eq i32 {{.*}}, 0
d153 3
a155 3
// CHECK: store i32 {{.*}}, i32* @@"??_B?1??getS@@@@YAAAUS@@@@XZ@@51"
// CHECK: call x86_thiscallcc %struct.S* @@"??0S@@@@QAE@@XZ"(%struct.S* @@"?TheS@@?1??getS@@@@YAAAUS@@@@XZ@@4U2@@A")
// CHECK: call i32 @@atexit(void ()* @@"??__FTheS@@?1??getS@@@@YAAAUS@@@@XZ@@YAXXZ")
d158 1
a158 1
// CHECK: ret %struct.S* @@"?TheS@@?1??getS@@@@YAAAUS@@@@XZ@@4U2@@A"
d161 1
a161 1
  // CHECK-LABEL: define linkonce_odr dso_local i32 @@"?enum_in_function@@@@YAHXZ"() {{.*}} comdat
d163 1
a163 1
  // CHECK: @@"?x@@?1??enum_in_function@@@@YAHXZ@@4W4e@@?1??1@@YAHXZ@@A"
d165 1
a165 1
  // CHECK: @@"?y@@?1??enum_in_function@@@@YAHXZ@@4HA"
d172 1
a172 1
    // CHECK-LABEL: define linkonce_odr dso_local x86_thiscallcc i32 @@"?enum_in_struct@@T@@@@QAEHXZ"({{.*}}) {{.*}} comdat
d174 1
a174 1
    // CHECK: @@"?x@@?1??enum_in_struct@@T@@@@QAEHXZ@@4HA"
d180 1
a180 1
  // CHECK-LABEL: define linkonce_odr dso_local i32 @@"?switch_test@@@@YAHH@@Z"(i32 %x) {{.*}} comdat
d183 1
a183 1
    // CHECK: @@"?a@@?3??switch_test@@@@YAHH@@Z@@4HA"
d189 1
a189 1
      // CHECK: @@"?b@@?3??switch_test@@@@YAHH@@Z@@4HA"
d193 1
a193 1
      // CHECK: @@"?c@@?4??switch_test@@@@YAHH@@Z@@4HA"
d201 2
a202 2
  // CHECK-LABEL: define linkonce_odr dso_local void @@"?switch_test2@@@@YAXXZ"() {{.*}} comdat
  // CHECK: @@"?x@@?2??switch_test2@@@@YAXXZ@@4HA"
d216 1
a216 1
    // CHECK-LABEL: define linkonce_odr dso_local i32 @@"?switch_test3@@DynamicDLLImportInitVSMangling@@@@YAHXZ"() {{.*}} comdat
d218 1
a218 1
    // CHECK: @@"?local@@?1??switch_test3@@DynamicDLLImportInitVSMangling@@@@YAHXZ@@4HA"
d234 1
a234 1
// CHECK: define linkonce_odr dso_local void @@"??__Efoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ"() {{.*}} comdat
d237 2
a238 2
// CHECK: call x86_thiscallcc %class.A* @@"??0A@@@@QAE@@XZ"
// CHECK: call i32 @@atexit(void ()* @@"??__Ffoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ")
d241 1
a241 1
// CHECK: define linkonce_odr dso_local x86_thiscallcc %class.A* @@"??0A@@@@QAE@@XZ"({{.*}}) {{.*}} comdat
d243 1
a243 1
// CHECK: define linkonce_odr dso_local x86_thiscallcc void @@"??1A@@@@QAE@@XZ"({{.*}}) {{.*}} comdat
d245 2
a246 2
// CHECK: define internal void @@"??__Ffoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ"
// CHECK: call x86_thiscallcc void @@"??1A@@@@QAE@@XZ"{{.*}}foo
d250 1
a250 1
// CHECK: call void @@"??__Es@@@@YAXXZ"()
@


1.1.1.7
log
@Import clang r337282 from trunk
@
text
@d4 4
a7 4
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"??__Eselectany1@@@@YAXXZ", i8* getelementptr inbounds (%struct.S, %struct.S* @@"?selectany1@@@@3US@@@@A", i32 0, i32 0) },
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"??__Eselectany2@@@@YAXXZ", i8* getelementptr inbounds (%struct.S, %struct.S* @@"?selectany2@@@@3US@@@@A", i32 0, i32 0) },
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"??__Es@@?$ExportedTemplate@@H@@@@2US@@@@A@@YAXXZ", i8* getelementptr inbounds (%struct.S, %struct.S* @@"?s@@?$ExportedTemplate@@H@@@@2US@@@@A", i32 0, i32 0) },
// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @@"??__Efoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ", i8* bitcast (%class.A* @@"?foo@@?$B@@H@@@@2VA@@@@A" to i8*) },
d18 3
a20 3
// CHECK: define internal void @@"??__Es@@@@YAXXZ"()
// CHECK: call x86_thiscallcc %struct.S* @@"??0S@@@@QAE@@XZ"
// CHECK: call i32 @@atexit(void ()* @@"??__Fs@@@@YAXXZ")
d23 2
a24 2
// CHECK: define internal void @@"??__Fs@@@@YAXXZ"()
// CHECK: call x86_thiscallcc void @@"??1S@@@@QAE@@XZ"
d31 7
a37 7
// CHECK: define linkonce_odr dso_local void @@"??__Eselectany1@@@@YAXXZ"() {{.*}} comdat
// CHECK-NOT: @@"??_Bselectany1
// CHECK: call x86_thiscallcc %struct.S* @@"??0S@@@@QAE@@XZ"
// CHECK: ret void
// CHECK: define linkonce_odr dso_local void @@"??__Eselectany2@@@@YAXXZ"() {{.*}} comdat
// CHECK-NOT: @@"??_Bselectany2
// CHECK: call x86_thiscallcc %struct.S* @@"??0S@@@@QAE@@XZ"
d54 3
a56 3
// CHECK-LABEL: define dso_local void @@"?StaticLocal@@@@YAXXZ"()
// CHECK: load i32, i32* @@"?$S1@@?1??StaticLocal@@@@YAXXZ@@4IA"
// CHECK: store i32 {{.*}}, i32* @@"?$S1@@?1??StaticLocal@@@@YAXXZ@@4IA"
d96 2
a97 2
// CHECK-LABEL: define dso_local void @@"?MultipleStatics@@@@YAXXZ"()
// CHECK: load i32, i32* @@"?$S1@@?1??MultipleStatics@@@@YAXXZ@@4IA"
d105 1
a105 1
// CHECK: load i32, i32* @@"?$S1@@?1??MultipleStatics@@@@YAXXZ@@4IA.1"
d136 1
a136 1
// CHECK-LABEL: define linkonce_odr dso_local dereferenceable({{[0-9]+}}) %struct.S* @@"?UnreachableStatic@@@@YAAAUS@@@@XZ"() {{.*}} comdat
d146 2
a147 2
// CHECK-LABEL: define linkonce_odr dso_local dereferenceable({{[0-9]+}}) %struct.S* @@"?getS@@@@YAAAUS@@@@XZ"() {{.*}} comdat
// CHECK: load i32, i32* @@"??_B?1??getS@@@@YAAAUS@@@@XZ@@51"
d149 1
a149 1
// CHECK: icmp eq i32 {{.*}}, 0
d153 3
a155 3
// CHECK: store i32 {{.*}}, i32* @@"??_B?1??getS@@@@YAAAUS@@@@XZ@@51"
// CHECK: call x86_thiscallcc %struct.S* @@"??0S@@@@QAE@@XZ"(%struct.S* @@"?TheS@@?1??getS@@@@YAAAUS@@@@XZ@@4U2@@A")
// CHECK: call i32 @@atexit(void ()* @@"??__FTheS@@?1??getS@@@@YAAAUS@@@@XZ@@YAXXZ")
d158 1
a158 1
// CHECK: ret %struct.S* @@"?TheS@@?1??getS@@@@YAAAUS@@@@XZ@@4U2@@A"
d161 1
a161 1
  // CHECK-LABEL: define linkonce_odr dso_local i32 @@"?enum_in_function@@@@YAHXZ"() {{.*}} comdat
d163 1
a163 1
  // CHECK: @@"?x@@?1??enum_in_function@@@@YAHXZ@@4W4e@@?1??1@@YAHXZ@@A"
d165 1
a165 1
  // CHECK: @@"?y@@?1??enum_in_function@@@@YAHXZ@@4HA"
d172 1
a172 1
    // CHECK-LABEL: define linkonce_odr dso_local x86_thiscallcc i32 @@"?enum_in_struct@@T@@@@QAEHXZ"({{.*}}) {{.*}} comdat
d174 1
a174 1
    // CHECK: @@"?x@@?1??enum_in_struct@@T@@@@QAEHXZ@@4HA"
d180 1
a180 1
  // CHECK-LABEL: define linkonce_odr dso_local i32 @@"?switch_test@@@@YAHH@@Z"(i32 %x) {{.*}} comdat
d183 1
a183 1
    // CHECK: @@"?a@@?3??switch_test@@@@YAHH@@Z@@4HA"
d189 1
a189 1
      // CHECK: @@"?b@@?3??switch_test@@@@YAHH@@Z@@4HA"
d193 1
a193 1
      // CHECK: @@"?c@@?4??switch_test@@@@YAHH@@Z@@4HA"
d201 2
a202 2
  // CHECK-LABEL: define linkonce_odr dso_local void @@"?switch_test2@@@@YAXXZ"() {{.*}} comdat
  // CHECK: @@"?x@@?2??switch_test2@@@@YAXXZ@@4HA"
d216 1
a216 1
    // CHECK-LABEL: define linkonce_odr dso_local i32 @@"?switch_test3@@DynamicDLLImportInitVSMangling@@@@YAHXZ"() {{.*}} comdat
d218 1
a218 1
    // CHECK: @@"?local@@?1??switch_test3@@DynamicDLLImportInitVSMangling@@@@YAHXZ@@4HA"
d234 1
a234 1
// CHECK: define linkonce_odr dso_local void @@"??__Efoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ"() {{.*}} comdat
d237 2
a238 2
// CHECK: call x86_thiscallcc %class.A* @@"??0A@@@@QAE@@XZ"
// CHECK: call i32 @@atexit(void ()* @@"??__Ffoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ")
d241 1
a241 1
// CHECK: define linkonce_odr dso_local x86_thiscallcc %class.A* @@"??0A@@@@QAE@@XZ"({{.*}}) {{.*}} comdat
d243 1
a243 1
// CHECK: define linkonce_odr dso_local x86_thiscallcc void @@"??1A@@@@QAE@@XZ"({{.*}}) {{.*}} comdat
d245 2
a246 2
// CHECK: define internal void @@"??__Ffoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ"
// CHECK: call x86_thiscallcc void @@"??1A@@@@QAE@@XZ"{{.*}}foo
d250 1
a250 1
// CHECK: call void @@"??__Es@@@@YAXXZ"()
@


1.1.1.8
log
@Mark old LLVM instance as dead.
@
text
@@


1.1.1.4.4.1
log
@file microsoft-abi-static-initializers.cpp was added on branch tls-maxphys on 2014-08-19 23:47:58 +0000
@
text
@d1 237
@


1.1.1.4.4.2
log
@Rebase to HEAD as of a few days ago.
@
text
@a0 237
// RUN: %clang_cc1 -fms-extensions -emit-llvm %s -o - -mconstructor-aliases -triple=i386-pc-win32 | FileCheck %s

// CHECK: @@llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }]
// CHECK: [{ i32, void ()*, i8* } { i32 65535, void ()* @@"\01??__Efoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ",
// CHECK:       i8* bitcast (%class.A* @@"\01?foo@@?$B@@H@@@@2VA@@@@A" to i8*) },
// CHECK:  { i32, void ()*, i8* } { i32 65535, void ()* @@_GLOBAL__sub_I_microsoft_abi_static_initializers.cpp, i8* null }]

struct S {
  S();
  ~S();
};

S s;

// CHECK: define internal void @@"\01??__Es@@@@YAXXZ"()
// CHECK: call x86_thiscallcc %struct.S* @@"\01??0S@@@@QAE@@XZ"
// CHECK: call i32 @@atexit(void ()* @@"\01??__Fs@@@@YAXXZ")
// CHECK: ret void

// CHECK: define internal void @@"\01??__Fs@@@@YAXXZ"()
// CHECK: call x86_thiscallcc void @@"\01??1S@@@@QAE@@XZ"
// CHECK: ret void

// These globals should use distinct guard variables, and not different bits of
// the same global.
__declspec(selectany) S selectany1;
__declspec(selectany) S selectany2;
// CHECK: define linkonce_odr void @@"\01??__Eselectany1@@@@YAXXZ"()
// CHECK-NOT: @@"\01??_Bselectany1
// CHECK: call x86_thiscallcc %struct.S* @@"\01??0S@@@@QAE@@XZ"
// CHECK: ret void
// CHECK: define linkonce_odr void @@"\01??__Eselectany2@@@@YAXXZ"()
// CHECK-NOT: @@"\01??_Bselectany2
// CHECK: call x86_thiscallcc %struct.S* @@"\01??0S@@@@QAE@@XZ"
// CHECK: ret void

void StaticLocal() {
  static S TheS;
}
// CHECK-LABEL: define void @@"\01?StaticLocal@@@@YAXXZ"()
// CHECK: load i32* @@"\01?$S1@@?0??StaticLocal@@@@YAXXZ@@4IA"
// CHECK: store i32 {{.*}}, i32* @@"\01?$S1@@?0??StaticLocal@@@@YAXXZ@@4IA"
// CHECK: ret

void MultipleStatics() {
  static S S1;
  static S S2;
  static S S3;
  static S S4;
  static S S5;
  static S S6;
  static S S7;
  static S S8;
  static S S9;
  static S S10;
  static S S11;
  static S S12;
  static S S13;
  static S S14;
  static S S15;
  static S S16;
  static S S17;
  static S S18;
  static S S19;
  static S S20;
  static S S21;
  static S S22;
  static S S23;
  static S S24;
  static S S25;
  static S S26;
  static S S27;
  static S S28;
  static S S29;
  static S S30;
  static S S31;
  static S S32;
  static S S33;
  static S S34;
  static S S35;
}
// CHECK-LABEL: define void @@"\01?MultipleStatics@@@@YAXXZ"()
// CHECK: load i32* @@"\01?$S1@@?0??MultipleStatics@@@@YAXXZ@@4IA"
// CHECK: and i32 {{.*}}, 1
// CHECK: and i32 {{.*}}, 2
// CHECK: and i32 {{.*}}, 4
// CHECK: and i32 {{.*}}, 8
// CHECK: and i32 {{.*}}, 16
//   ...
// CHECK: and i32 {{.*}}, -2147483648
// CHECK: load i32* @@"\01?$S1@@?0??MultipleStatics@@@@YAXXZ@@4IA1"
// CHECK: and i32 {{.*}}, 1
// CHECK: and i32 {{.*}}, 2
// CHECK: and i32 {{.*}}, 4
// CHECK: ret

// Force WeakODRLinkage by using templates
class A {
 public:
  A() {}
  ~A() {}
  int a;
};

template<typename T>
class B {
 public:
  static A foo;
};

template<typename T> A B<T>::foo;

inline S &UnreachableStatic() {
  if (0) {
    static S s; // bit 1
    return s;
  }
  static S s; // bit 2
  return s;
}

// CHECK-LABEL: define linkonce_odr dereferenceable({{[0-9]+}}) %struct.S* @@"\01?UnreachableStatic@@@@YAAAUS@@@@XZ"()
// CHECK: and i32 {{.*}}, 2
// CHECK: or i32 {{.*}}, 2
// CHECK: ret

inline S &getS() {
  static S TheS;
  return TheS;
}

// CHECK-LABEL: define linkonce_odr dereferenceable({{[0-9]+}}) %struct.S* @@"\01?getS@@@@YAAAUS@@@@XZ"
// CHECK: load i32* @@"\01??_B?1??getS@@@@YAAAUS@@@@XZ@@51"
// CHECK: and i32 {{.*}}, 1
// CHECK: icmp ne i32 {{.*}}, 0
// CHECK: br i1
//   init:
// CHECK: or i32 {{.*}}, 1
// CHECK: store i32 {{.*}}, i32* @@"\01??_B?1??getS@@@@YAAAUS@@@@XZ@@51"
// CHECK: call x86_thiscallcc %struct.S* @@"\01??0S@@@@QAE@@XZ"(%struct.S* @@"\01?TheS@@?1??getS@@@@YAAAUS@@@@XZ@@4U2@@A")
// CHECK: call i32 @@atexit(void ()* @@"\01??__FTheS@@?1??getS@@@@YAAAUS@@@@XZ@@YAXXZ")
// CHECK: br label
//   init.end:
// CHECK: ret %struct.S* @@"\01?TheS@@?1??getS@@@@YAAAUS@@@@XZ@@4U2@@A"

inline int enum_in_function() {
  // CHECK-LABEL: define linkonce_odr i32 @@"\01?enum_in_function@@@@YAHXZ"()
  static enum e { foo, bar, baz } x;
  // CHECK: @@"\01?x@@?1??enum_in_function@@@@YAHXZ@@4W4e@@?1??1@@YAHXZ@@A"
  static int y;
  // CHECK: @@"\01?y@@?1??enum_in_function@@@@YAHXZ@@4HA"
  return x + y;
};

struct T {
  enum e { foo, bar, baz };
  int enum_in_struct() {
    // CHECK-LABEL: define linkonce_odr x86_thiscallcc i32 @@"\01?enum_in_struct@@T@@@@QAEHXZ"
    static int x;
    // CHECK: @@"\01?x@@?1??enum_in_struct@@T@@@@QAEHXZ@@4HA"
    return x++;
  }
};

inline int switch_test(int x) {
  // CHECK-LABEL: define linkonce_odr i32 @@"\01?switch_test@@@@YAHH@@Z"(i32 %x)
  switch (x) {
    static int a;
    // CHECK: @@"\01?a@@?3??switch_test@@@@YAHH@@Z@@4HA"
    case 0:
      a++;
      return 1;
    case 1:
      static int b;
      // CHECK: @@"\01?b@@?3??switch_test@@@@YAHH@@Z@@4HA"
      return b++;
    case 2: {
      static int c;
      // CHECK: @@"\01?c@@?4??switch_test@@@@YAHH@@Z@@4HA"
      return b + c++;
    }
  };
}

int f();
inline void switch_test2() {
  // CHECK-LABEL: define linkonce_odr void @@"\01?switch_test2@@@@YAXXZ"()
  // CHECK: @@"\01?x@@?2??switch_test2@@@@YAXXZ@@4HA"
  switch (1) default: static int x = f();
}

namespace DynamicDLLImportInitVSMangling {
  // Failing to pop the ExprEvalContexts when instantiating a dllimport var with
  // dynamic initializer would cause subsequent static local numberings to be
  // incorrect.
  struct NonPOD { NonPOD(); };
  template <typename T> struct A { static NonPOD x; };
  template <typename T> NonPOD A<T>::x;
  template struct __declspec(dllimport) A<int>;

  inline int switch_test3() {
    // CHECK-LABEL: define linkonce_odr i32 @@"\01?switch_test3@@DynamicDLLImportInitVSMangling@@@@YAHXZ"
    static int local;
    // CHECK: @@"\01?local@@?1??switch_test3@@DynamicDLLImportInitVSMangling@@@@YAHXZ@@4HA"
    return local++;
  }
}

void force_usage() {
  UnreachableStatic();
  getS();
  (void)B<int>::foo;  // (void) - force usage
  enum_in_function();
  (void)&T::enum_in_struct;
  switch_test(1);
  switch_test2();
  DynamicDLLImportInitVSMangling::switch_test3();
}

// CHECK: define linkonce_odr void @@"\01??__Efoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ"()
// CHECK-NOT: and
// CHECK-NOT: ?_Bfoo@@
// CHECK: call x86_thiscallcc %class.A* @@"\01??0A@@@@QAE@@XZ"
// CHECK: call i32 @@atexit(void ()* @@"\01??__Ffoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ")
// CHECK: ret void

// CHECK: define linkonce_odr x86_thiscallcc %class.A* @@"\01??0A@@@@QAE@@XZ"

// CHECK: define linkonce_odr x86_thiscallcc void @@"\01??1A@@@@QAE@@XZ"

// CHECK: define internal void @@"\01??__Ffoo@@?$B@@H@@@@2VA@@@@A@@YAXXZ"
// CHECK: call x86_thiscallcc void @@"\01??1A@@@@QAE@@XZ"{{.*}}foo
// CHECK: ret void

// CHECK: define internal void @@_GLOBAL__sub_I_microsoft_abi_static_initializers.cpp()
// CHECK: call void @@"\01??__Es@@@@YAXXZ"()
// CHECK: ret void
@


1.1.1.2.4.1
log
@file microsoft-abi-static-initializers.cpp was added on branch yamt-pagecache on 2014-05-22 16:18:57 +0000
@
text
@d1 154
@


1.1.1.2.4.2
log
@sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")
@
text
@a0 154
// RUN: %clang_cc1 -emit-llvm %s -o - -mconstructor-aliases -triple=i386-pc-win32 | FileCheck %s

// CHECK: @@llvm.global_ctors = appending global [2 x { i32, void ()* }]
// CHECK: [{ i32, void ()* } { i32 65535, void ()* @@"\01??__Efoo@@?$B@@H@@@@YAXXZ" },
// CHECK:  { i32, void ()* } { i32 65535, void ()* @@_GLOBAL__I_a }]

struct S {
  S();
  ~S();
};

S s;

// CHECK: define internal void @@"\01??__Es@@@@YAXXZ"() [[NUW:#[0-9]+]]
// CHECK: %{{[.0-9A-Z_a-z]+}} = call x86_thiscallcc %struct.S* @@"\01??0S@@@@QAE@@XZ"
// CHECK: call i32 @@atexit(void ()* @@"\01??__Fs@@@@YAXXZ")
// CHECK: ret void

// CHECK: define internal void @@"\01??__Fs@@@@YAXXZ"() [[NUW]] {
// CHECK: call x86_thiscallcc void @@"\01??1S@@@@QAE@@XZ"
// CHECK: ret void

void StaticLocal() {
  static S TheS;
}
// CHECK-LABEL: define void @@"\01?StaticLocal@@@@YAXXZ"()
// CHECK: load i32* @@"\01?$S1@@?1??StaticLocal@@@@YAXXZ@@4IA"
// CHECK: store i32 {{.*}}, i32* @@"\01?$S1@@?1??StaticLocal@@@@YAXXZ@@4IA"
// CHECK: ret

void MultipleStatics() {
  static S S1;
  static S S2;
  static S S3;
  static S S4;
  static S S5;
  static S S6;
  static S S7;
  static S S8;
  static S S9;
  static S S10;
  static S S11;
  static S S12;
  static S S13;
  static S S14;
  static S S15;
  static S S16;
  static S S17;
  static S S18;
  static S S19;
  static S S20;
  static S S21;
  static S S22;
  static S S23;
  static S S24;
  static S S25;
  static S S26;
  static S S27;
  static S S28;
  static S S29;
  static S S30;
  static S S31;
  static S S32;
  static S S33;
  static S S34;
  static S S35;
}
// CHECK-LABEL: define void @@"\01?MultipleStatics@@@@YAXXZ"()
// CHECK: load i32* @@"\01?$S1@@?1??MultipleStatics@@@@YAXXZ@@4IA"
// CHECK: and i32 {{.*}}, 1
// CHECK: and i32 {{.*}}, 2
// CHECK: and i32 {{.*}}, 4
// CHECK: and i32 {{.*}}, 8
// CHECK: and i32 {{.*}}, 16
//   ...
// CHECK: and i32 {{.*}}, -2147483648
// CHECK: load i32* @@"\01?$S1@@?1??MultipleStatics@@@@YAXXZ@@4IA1"
// CHECK: and i32 {{.*}}, 1
// CHECK: and i32 {{.*}}, 2
// CHECK: and i32 {{.*}}, 4
// CHECK: ret

// Force WeakODRLinkage by using templates
class A {
 public:
  A() {}
  ~A() {}
};

template<typename T>
class B {
 public:
  static A foo;
};

template<typename T> A B<T>::foo;

inline S &UnreachableStatic() {
  if (0) {
    static S s; // bit 1
    return s;
  }
  static S s; // bit 2
  return s;
}

// CHECK-LABEL: define linkonce_odr %struct.S* @@"\01?UnreachableStatic@@@@YAAAUS@@@@XZ"()
// CHECK: and i32 {{.*}}, 2
// CHECK: or i32 {{.*}}, 2
// CHECK: ret

inline S &getS() {
  static S TheS;
  return TheS;
}

// CHECK-LABEL: define linkonce_odr %struct.S* @@"\01?getS@@@@YAAAUS@@@@XZ"
// CHECK: load i32* @@"\01??_B?1??getS@@@@YAAAUS@@@@XZ@@51"
// CHECK: and i32 {{.*}}, 1
// CHECK: icmp ne i32 {{.*}}, 0
// CHECK: br i1
//   init:
// CHECK: or i32 {{.*}}, 1
// CHECK: store i32 {{.*}}, i32* @@"\01??_B?1??getS@@@@YAAAUS@@@@XZ@@51"
// CHECK: call x86_thiscallcc %struct.S* @@"\01??0S@@@@QAE@@XZ"(%struct.S* @@"\01?TheS@@?1??getS@@@@YAAAUS@@@@XZ@@4U2@@A")
// CHECK: call i32 @@atexit(void ()* @@"\01??__FTheS@@?1??getS@@@@YAAAUS@@@@XZ@@YAXXZ")
// CHECK: br label
//   init.end:
// CHECK: ret %struct.S* @@"\01?TheS@@?1??getS@@@@YAAAUS@@@@XZ@@4U2@@A"

void force_usage() {
  UnreachableStatic();
  getS();
  (void)B<int>::foo;  // (void) - force usage
}

// CHECK: define internal void @@"\01??__Efoo@@?$B@@H@@@@YAXXZ"() [[NUW]]
// CHECK: %{{[.0-9A-Z_a-z]+}} = call x86_thiscallcc %class.A* @@"\01??0A@@@@QAE@@XZ"
// CHECK: call i32 @@atexit(void ()* @@"\01??__Ffoo@@?$B@@H@@@@YAXXZ")
// CHECK: ret void

// CHECK: define linkonce_odr x86_thiscallcc %class.A* @@"\01??0A@@@@QAE@@XZ"

// CHECK: define linkonce_odr x86_thiscallcc void @@"\01??1A@@@@QAE@@XZ"

// CHECK: define internal void @@"\01??__Ffoo@@?$B@@H@@@@YAXXZ"
// CHECK: call x86_thiscallcc void @@"\01??1A@@@@QAE@@XZ"{{.*}}foo
// CHECK: ret void

// CHECK: define internal void @@_GLOBAL__I_a() [[NUW]] {
// CHECK: call void @@"\01??__Es@@@@YAXXZ"()
// CHECK: ret void

// CHECK: attributes [[NUW]] = { nounwind }
@


