Home | History | Annotate | Download | only in CodeGen
      1 // RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=ITANIUM %s
      2 // RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=MS %s
      3 
      4 // Tests that we assign appropriate identifiers to unprototyped functions.
      5 
      6 // CHECK: define void @f({{.*}} !type [[TVOID:![0-9]+]]
      7 void f() {
      8 }
      9 
     10 void xf();
     11 
     12 // CHECK: define void @g({{.*}} !type [[TINT:![0-9]+]]
     13 void g(int b) {
     14   void (*fp)() = b ? f : xf;
     15   // ITANIUM: call i1 @llvm.type.test(i8* {{.*}}, metadata !"_ZTSFvE")
     16   fp();
     17 }
     18 
     19 // CHECK: declare !type [[TVOID:![0-9]+]] void @xf({{.*}}
     20 
     21 // ITANIUM-DAG: [[TVOID]] = !{i64 0, !"_ZTSFvE"}
     22 // ITANIUM-DAG: [[TINT]] = !{i64 0, !"_ZTSFviE"}
     23 // MS-DAG: [[TVOID]] = !{i64 0, !"?6AX@Z"}
     24 // MS-DAG: [[TINT]] = !{i64 0, !"?6AXH@Z"}
     25