summaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/cfi-blacklist.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2015-07-15 12:15:56 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2015-07-15 12:15:56 +0000
commit82a8792ad361e9443615fc81ee8dd37c76e64dbd (patch)
tree591af7f17ee37bb82ff1b4179f21d00c069a5d1c /test/CodeGenCXX/cfi-blacklist.cpp
parent67e7ef96464acd8cd643fa06bf02b9006f5c4f06 (diff)
downloadclang-82a8792ad361e9443615fc81ee8dd37c76e64dbd.tar.gz
CodeGen: Improve CFI type blacklisting mechanism.
We now use the sanitizer special case list to decide which types to blacklist. We also support a special blacklist entry for types with a uuid attribute, which are generally COM types whose virtual tables are defined externally. Differential Revision: http://reviews.llvm.org/D11096 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242286 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/cfi-blacklist.cpp')
-rw-r--r--test/CodeGenCXX/cfi-blacklist.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/CodeGenCXX/cfi-blacklist.cpp b/test/CodeGenCXX/cfi-blacklist.cpp
new file mode 100644
index 0000000000..32ed05bcc5
--- /dev/null
+++ b/test/CodeGenCXX/cfi-blacklist.cpp
@@ -0,0 +1,30 @@
+// RUN: echo "type:attr:uuid" > %t.txt
+// RUN: %clang_cc1 -fms-extensions -fsanitize=cfi-vcall -fsanitize-blacklist=%t.txt -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=NOUUID %s
+// RUN: echo "type:std::*" > %t.txt
+// RUN: %clang_cc1 -fms-extensions -fsanitize=cfi-vcall -fsanitize-blacklist=%t.txt -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=NOSTD %s
+
+struct __declspec(uuid("00000000-0000-0000-0000-000000000000")) S1 {
+ virtual void f();
+};
+
+namespace std {
+
+struct S2 {
+ virtual void f();
+};
+
+}
+
+// CHECK: define{{.*}}s1f
+// NOSTD: llvm.bitset.test
+// NOUUID-NOT: llvm.bitset.test
+void s1f(S1 *s1) {
+ s1->f();
+}
+
+// CHECK: define{{.*}}s2f
+// NOSTD-NOT: llvm.bitset.test
+// NOUUID: llvm.bitset.test
+void s2f(std::S2 *s2) {
+ s2->f();
+}