42 lines · cpp
1// RUN: %clang_cc1 -triple %itanium_abi_triple -fvisibility=hidden -fms-extensions -fsanitize=cfi-vcall -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=NOBL %s2 3// Check that ignore listing cfi and cfi-vcall work correctly4// RUN: echo "[cfi-vcall]" > %t.vcall.txt5// RUN: echo "type:std::*" >> %t.vcall.txt6// RUN: %clang_cc1 -triple %itanium_abi_triple -fvisibility=hidden -fms-extensions -fsanitize=cfi-vcall -fsanitize-ignorelist=%t.vcall.txt -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=NOSTD %s7//8// RUN: echo "[cfi]" > %t.cfi.txt9// RUN: echo "type:std::*" >> %t.cfi.txt10// RUN: %clang_cc1 -triple %itanium_abi_triple -fvisibility=hidden -fms-extensions -fsanitize=cfi-vcall -fsanitize-ignorelist=%t.cfi.txt -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=NOSTD %s11 12// Check that ignore listing non-vcall modes does not affect vcalls13// RUN: echo "[cfi-icall|cfi-nvcall|cfi-cast-strict|cfi-derived-cast|cfi-unrelated-cast]" > %t.other.txt14// RUN: echo "type:std::*" >> %t.other.txt15// RUN: %clang_cc1 -triple %itanium_abi_triple -fvisibility=hidden -fms-extensions -fsanitize=cfi-vcall -fsanitize-ignorelist=%t.other.txt -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=NOBL %s16 17struct S1 {18 virtual void f();19};20 21namespace std {22 23struct S2 {24 virtual void f();25};26 27}28 29// CHECK: define{{.*}}s1f30// NOBL: llvm.type.test31// NOSTD: llvm.type.test32void s1f(S1 *s1) {33 s1->f();34}35 36// CHECK: define{{.*}}s2f37// NOBL: llvm.type.test38// NOSTD-NOT: llvm.type.test39void s2f(std::S2 *s2) {40 s2->f();41}42