// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin -emit-llvm -std=c++98 -o - %s | FileCheck %s
// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin -emit-llvm -std=c++11 -o - %s | FileCheck %s
// CHECK: @a = global i32 10
int a = 10;
// CHECK: @ar = constant i32* @a
int &ar = a;
void ;
// CHECK: @fr = constant void ()* @_Z1fv
void = f;
;
// CHECK: @s = global %struct.S { i32* @a }
S s = ;
// PR5581
// We don't expect to fold this in the frontend, but make sure it doesn't crash.
// CHECK: @PR9558 = global float 0.000000e+0
float PR9558 = reinterpret_cast<const float&>;
// An initialized const automatic variable cannot be promoted to a constant
// global if it has a mutable member.
;
int
// Make sure we don't try to fold this in the frontend; the backend can't
// handle it.
// CHECK: @PR11705 = global i128 0
__int128_t PR11705 = &PR11705;
// Make sure we don't try to fold this either.
// CHECK: @_ZZ23UnfoldableAddrLabelDiffvE1x = internal global i128 0
void
// But make sure we do fold this.
// CHECK: @_ZZ21FoldableAddrLabelDiffvE1x = internal global i64 sub (i64 ptrtoint (i8* blockaddress(@_Z21FoldableAddrLabelDiffv
void
// CHECK: @i = constant i32* bitcast (float* @PR9558 to i32*)
int &i = reinterpret_cast<int&>;
int arr;
// CHECK: @pastEnd = constant i32* bitcast (i8* getelementptr (i8, i8* bitcast ([2 x i32]* @arr to i8*), i64 8) to i32*)
int &pastEnd = arr;
// CHECK: @[[WCHAR_STR:.*]] = internal global [2 x i32] [i32 112, i32 0],
// CHECK: @PR51105_a = global i32* {{.*}} @[[WCHAR_STR]],
wchar_t *PR51105_a = ;
// CHECK: @[[CHAR_STR:.*]] = internal global [5 x i8] c"p\00\00\00\00",
// CHECK: @PR51105_b = global i8* {{.*}} @[[CHAR_STR]],
char *PR51105_b = ;
;
long k;
X x = ;
// CHECK: store i8 ptrtoint (i64* @k to i8), i8* getelementptr inbounds (%struct.X, %struct.X* @x, i32 0, i32 0)