Home | History | Annotate | Download | only in CodeGen
      1 // RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
      2 // END.
      3 
      4 // CHECK: private unnamed_addr constant [8 x i8] c"v_ann_{{.}}\00", section "llvm.metadata"
      5 // CHECK: private unnamed_addr constant [8 x i8] c"v_ann_{{.}}\00", section "llvm.metadata"
      6 
      7 struct foo {
      8     int v __attribute__((annotate("v_ann_0"))) __attribute__((annotate("v_ann_1")));
      9 };
     10 
     11 static struct foo gf;
     12 
     13 int main(int argc, char **argv) {
     14     struct foo f;
     15     f.v = argc;
     16 // CHECK: getelementptr inbounds %struct.foo, %struct.foo* %f, i32 0, i32 0
     17 // CHECK-NEXT: bitcast i32* {{.*}} to i8*
     18 // CHECK-NEXT: call i8* @llvm.ptr.annotation.p0i8({{.*}}str{{.*}}str{{.*}}i32 8)
     19 // CHECK-NEXT: bitcast i8* {{.*}} to i32*
     20 // CHECK-NEXT: bitcast i32* {{.*}} to i8*
     21 // CHECK-NEXT: call i8* @llvm.ptr.annotation.p0i8({{.*}}str{{.*}}str{{.*}}i32 8)
     22 // CHECK-NEXT: bitcast i8* {{.*}} to i32*
     23     gf.v = argc;
     24 // CHECK: bitcast i32* getelementptr inbounds (%struct.foo, %struct.foo* @gf, i32 0, i32 0) to i8*
     25 // CHECK-NEXT: call i8* @llvm.ptr.annotation.p0i8({{.*}}str{{.*}}str{{.*}}i32 8)
     26     return 0;
     27 }
     28