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