From 1193f2cbc021f040eef6f97ec72dad5fb1efb7b1 Mon Sep 17 00:00:00 2001 From: Ivan Krasin Date: Thu, 13 Aug 2015 04:04:37 +0000 Subject: Add sanitizer blacklists to the rules generated with -M/-MM/-MD/-MMD. Summary: Clang sanitizers, such as AddressSanitizer, ThreadSanitizer, MemorySanitizer, Control Flow Integrity and others, use blacklists to specify which types / functions should not be instrumented to avoid false positives or suppress known failures. This change adds the blacklist filenames to the list of dependencies of the rules, generated with -M/-MM/-MD/-MMD. This lets CMake/Ninja recognize that certain C/C++/ObjC files need to be recompiled (if a blacklist is updated). Reviewers: pcc Subscribers: rsmith, honggyu.kim, pcc, cfe-commits Differential Revision: http://reviews.llvm.org/D11968 llvm-svn: 244867 --- clang/test/Frontend/dependency-gen.c | 11 ++++++++++- clang/test/Frontend/print-header-includes.c | 8 ++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'clang/test/Frontend') diff --git a/clang/test/Frontend/dependency-gen.c b/clang/test/Frontend/dependency-gen.c index 0465dc864e4..4df1f9536ee 100644 --- a/clang/test/Frontend/dependency-gen.c +++ b/clang/test/Frontend/dependency-gen.c @@ -20,7 +20,16 @@ // RUN: cd a/b // RUN: %clang -MD -MF - %s -fsyntax-only -I ./ | FileCheck -check-prefix=CHECK-SIX %s // CHECK-SIX: {{ }}x.h - +// RUN: echo "fun:foo" > %t.blacklist +// RUN: %clang -MD -MF - %s -fsyntax-only -fsanitize=cfi-vcall -flto -fsanitize-blacklist=%t.blacklist -I ./ | FileCheck -check-prefix=CHECK-SEVEN %s +// CHECK-SEVEN: .blacklist +// CHECK-SEVEN: {{ }}x.h +// RUN: %clang -MD -MF - %s -fsyntax-only -fsanitize=address -flto -I . | FileCheck -check-prefix=CHECK-EIGHT %s +// CHECK-EIGHT: asan_blacklist.txt +// CHECK-EIGHT: {{ }}x.h +// RUN: %clang -MD -MF - %s -fsyntax-only -fsanitize=address -flto -I . -fno-sanitize-blacklist | FileCheck -check-prefix=CHECK-NINE %s +// CHECK-NINE-NOT: asan_blacklist.txt +// CHECK-NINE: {{ }}x.h #ifndef INCLUDE_FLAG_TEST #include #endif diff --git a/clang/test/Frontend/print-header-includes.c b/clang/test/Frontend/print-header-includes.c index 966b4af8606..53b3eb09734 100644 --- a/clang/test/Frontend/print-header-includes.c +++ b/clang/test/Frontend/print-header-includes.c @@ -13,4 +13,12 @@ // MS: Note: including file: {{.*test2.h}} // MS-NOT: Note +// RUN: echo "fun:foo" > %t.blacklist +// RUN: %clang_cc1 -fsanitize=address -fsanitize-blacklist=%t.blacklist -E --show-includes -o %t.out %s > %t.stdout +// RUN: FileCheck --check-prefix=MS-BLACKLIST < %t.stdout %s +// MS-BLACKLIST: Note: including file: {{.*\.blacklist}} +// MS-BLACKLIST: Note: including file: {{.*test.h}} +// MS-BLACKLIST: Note: including file: {{.*test2.h}} +// MS-BLACKLIST-NOT: Note + #include "Inputs/test.h" -- cgit v1.2.3