1 // Verify ubsan vptr does not check down-casts on blacklisted types. 2 // RUN: echo "type:_ZTI3Foo" > %t-type.blacklist 3 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=vptr -fsanitize-recover=vptr -emit-llvm %s -o - | FileCheck %s --check-prefix=DEFAULT 4 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=vptr -fsanitize-recover=vptr -fsanitize-blacklist=%t-type.blacklist -emit-llvm %s -o - | FileCheck %s --check-prefix=TYPE 5 6 class Bar { 7 public: 8 virtual ~Bar() {} 9 }; 10 class Foo : public Bar {}; 11 12 Bar bar; 13 14 // DEFAULT: @_Z7checkmev 15 // TYPE: @_Z7checkmev 16 void checkme() { 17 // DEFAULT: call void @__ubsan_handle_dynamic_type_cache_miss({{.*}} ({{.*}}* @bar to 18 // TYPE-NOT: @__ubsan_handle_dynamic_type_cache_miss 19 Foo* foo = static_cast<Foo*>(&bar); // down-casting 20 // DEFAULT: ret void 21 // TYPE: ret void 22 return; 23 } 24