| 1 |
// RUN: %clang_cc1 -emit-llvm -triple=i386-pc-win32 %s -o - | FileCheck %s |
| 2 |
// RUN: %clang_cc1 -emit-llvm -triple=x86_64-windows-msvc %s -o - | FileCheck %s |
| 3 |
|
| 4 |
struct S { |
| 5 |
static const int NoInit_Ref; |
| 6 |
static const int Inline_NotDef_NotRef = 5; |
| 7 |
static const int Inline_NotDef_Ref = 5; |
| 8 |
static const int Inline_Def_NotRef = 5; |
| 9 |
static const int Inline_Def_Ref = 5; |
| 10 |
static const int OutOfLine_Def_NotRef; |
| 11 |
static const int OutOfLine_Def_Ref; |
| 12 |
}; |
| 13 |
|
| 14 |
const int *foo1() { |
| 15 |
return &S::NoInit_Ref; |
| 16 |
}; |
| 17 |
|
| 18 |
const int *foo2() { |
| 19 |
return &S::Inline_NotDef_Ref; |
| 20 |
}; |
| 21 |
|
| 22 |
const int *foo3() { |
| 23 |
return &S::Inline_Def_Ref; |
| 24 |
}; |
| 25 |
|
| 26 |
const int *foo4() { |
| 27 |
return &S::OutOfLine_Def_Ref; |
| 28 |
}; |
| 29 |
|
| 30 |
const int S::Inline_Def_NotRef; |
| 31 |
const int S::Inline_Def_Ref; |
| 32 |
const int S::OutOfLine_Def_NotRef = 5; |
| 33 |
const int S::OutOfLine_Def_Ref = 5; |
| 34 |
|
| 35 |
|
| 36 |
// No initialization. |
| 37 |
// CHECK-DAG: @"?NoInit_Ref@S@@2HB" = external dso_local constant i32 |
| 38 |
|
| 39 |
// Inline initialization, no real definiton, not referenced. |
| 40 |
// CHECK-NOT: @"?Inline_NotDef_NotRef@S@@2HB" = {{.*}} constant i32 5 |
| 41 |
|
| 42 |
// Inline initialization, no real definiton, referenced. |
| 43 |
// CHECK-DAG: @"?Inline_NotDef_Ref@S@@2HB" = linkonce_odr dso_local constant i32 5, comdat, align 4 |
| 44 |
|
| 45 |
// Inline initialization, real definiton, not referenced. |
| 46 |
// CHECK-NOT: @"?Inline_Def_NotRef@S@@2HB" = dso_local constant i32 5, align 4 |
| 47 |
|
| 48 |
// Inline initialization, real definiton, referenced. |
| 49 |
// CHECK-DAG: @"?Inline_Def_Ref@S@@2HB" = linkonce_odr dso_local constant i32 5, comdat, align 4 |
| 50 |
|
| 51 |
// Out-of-line initialization. |
| 52 |
// CHECK-DAG: @"?OutOfLine_Def_NotRef@S@@2HB" = dso_local constant i32 5, align 4 |
| 53 |
// CHECK-DAG: @"?OutOfLine_Def_Ref@S@@2HB" = dso_local constant i32 5, align 4 |