Home | History | Annotate | Download | only in CodeGenCXX
      1 // RUN: %clang_cc1 %s -triple i386-unknown-unknown -emit-llvm -o - | FileCheck %s
      2 
      3 // CHECK: @var1 = external global i32
      4 // CHECK: @_ZN1N4var2E = external global i32
      5 // CHECK: @var5 = external global i32
      6 // CHECK: @_ZN1N4var3E = external global i32
      7 // CHECK: @_ZN1N4var4E = external global i32
      8 
      9 // CHECK: declare i32 @_Z5func1v()
     10 // CHECK: declare i32 @_ZN1N5func2Ev()
     11 // CHECK: declare i32 @func4()
     12 // CHECK: declare i32 @_ZN1N5func3Ev()
     13 
     14 int f1() {
     15   extern int var1, func1();
     16   return var1 + func1();
     17 }
     18 
     19 namespace N {
     20 
     21 int f2() {
     22   extern int var2, func2();
     23   return var2 + func2();
     24 }
     25 
     26 struct S {
     27   static int f3() {
     28     extern int var3, func3();
     29     struct LC { int localfunc() { extern int var4; return var4; } };
     30     LC localobj;
     31     return var3 + func3() + localobj.localfunc();
     32   }
     33 };
     34 
     35 int anchorf3() { return S::f3(); }
     36 
     37 extern "C" {
     38 int f4() {
     39   extern int var5, func4();
     40   return var5 + func4();
     41 }
     42 }
     43 
     44 }
     45 
     46