Include sanitize blacklist and other extra deps as part of scan-deps output

Summary:
Clang's -M mode includes these extra dependencies in its output and clang-scan-deps
should have equivalent behavior, so adding these extradeps to output just like
how its being done for ".d" file generation mode.

Reviewers: arphaman, dexonsmith, Bigcheese, jkorous

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69017

llvm-svn: 375074
This commit is contained in:
Kousik Kumar 2019-10-17 02:14:44 +00:00
parent 0f783599a4
commit 962ca076e5
4 changed files with 24 additions and 0 deletions

View File

@ -36,6 +36,8 @@ public:
llvm::sys::path::remove_dots(CanonPath, /*remove_dot_dot=*/true);
C.handleFileDependency(*Opts, CanonPath);
}
for (const auto& ExtraDep : Opts->ExtraDeps)
C.handleFileDependency(*Opts, ExtraDep);
}
private:

View File

@ -0,0 +1,7 @@
[
{
"directory": "DIR",
"command": "clang -E DIR/non-header-dependency_input.cpp -fsanitize=bounds -fsanitize-blacklist=DIR/Inputs/sanitize-blacklist.txt",
"file": "DIR/non-header-dependency_input.cpp"
}
]

View File

@ -0,0 +1 @@
fun:*

View File

@ -0,0 +1,14 @@
// RUN: rm -rf %t.dir
// RUN: rm -rf %t.cdb
// RUN: mkdir -p %t.dir
// RUN: cp %s %t.dir/non-header-dependency_input.cpp
// RUN: mkdir %t.dir/Inputs
// RUN: cp %S/Inputs/sanitize-blacklist.txt %t.dir/Inputs/sanitize-blacklist.txt
// RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/non-header-dependency.json > %t.cdb
//
// RUN: clang-scan-deps -compilation-database %t.cdb -j 1 | FileCheck %s
#define FOO "foo"
// CHECK: Inputs{{/|\\}}sanitize-blacklist.txt
// CHECK-NEXT: non-header-dependency_input.cpp