Home | History | Annotate | Download | only in CodeGenCXX
      1 // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
      2 
      3 // CHECK:  @_ZZ4FUNCvEN4SSSSC1ERKf
      4 // CHECK: @_ZZ4FUNCvEN4SSSSC2E_0RKf
      5 // CHECK:  @_ZZ4GORFfEN4SSSSC1ERKf
      6 // CHECK: @_ZZ4GORFfEN4SSSSC2E_0RKf
      7 
      8 void FUNC ()
      9 {
     10   {
     11     float IVAR1 ;
     12 
     13     struct SSSS
     14     {
     15       float bv;
     16       SSSS( const float& from): bv(from) { }
     17     };
     18 
     19     SSSS VAR1(IVAR1);
     20    }
     21 
     22    {
     23     float IVAR2 ;
     24 
     25     struct SSSS
     26     {
     27      SSSS( const float& from) {}
     28     };
     29 
     30     SSSS VAR2(IVAR2);
     31    }
     32 }
     33 
     34 void GORF (float IVAR1)
     35 {
     36   {
     37     struct SSSS
     38     {
     39       float bv;
     40       SSSS( const float& from): bv(from) { }
     41     };
     42 
     43     SSSS VAR1(IVAR1);
     44    }
     45 
     46    {
     47     float IVAR2 ;
     48 
     49     struct SSSS
     50     {
     51      SSSS( const float& from) {}
     52     };
     53 
     54     SSSS VAR2(IVAR2);
     55    }
     56 }
     57 
     58 // CHECK: @_ZZ12OmittingCodefEN4SSSSC1E_0RKf
     59 inline void OmittingCode(float x) {
     60   if (0) {
     61     struct SSSS {
     62       float bv;
     63       SSSS(const float& from): bv(from) { }
     64     };
     65 
     66     SSSS VAR1(x);
     67   }
     68 
     69   struct SSSS {
     70     float bv;
     71     SSSS(const float& from): bv(from) { }
     72   };
     73 
     74   SSSS VAR2(x);
     75 }
     76 void CallOmittingCode() { OmittingCode(1); }
     77 
     78 // CHECK: @_ZZ25LocalTemplateFunctionTestdEN5Local3fooIdEET_S1_
     79 int LocalTemplateFunctionTest(double d) {
     80   struct Local {
     81     template<class T> T foo(T t) {
     82       return t;
     83     }
     84   };
     85   return Local().foo(d);
     86 }
     87 
     88 // CHECK: @_ZZ15LocalAnonStructvENUt0_1gEv
     89 inline void LocalAnonStruct() {
     90   if (0) {
     91     struct { void f() {} } x;
     92     x.f();
     93   }
     94   struct { void g() {} } y;
     95   y.g();
     96 }
     97 void CallLocalAnonStruct() { LocalAnonStruct(); }
     98