From: Kousik Kumar Date: Thu, 17 Oct 2019 02:14:44 +0000 (+0000) Subject: Include sanitize blacklist and other extra deps as part of scan-deps output X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5ab89ea40b058a1e68a38e711db3013a9a057daf;p=clang 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@375074 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp b/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp index f382c202f8..70c8b5a082 100644 --- a/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp +++ b/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp @@ -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: diff --git a/test/ClangScanDeps/Inputs/non-header-dependency.json b/test/ClangScanDeps/Inputs/non-header-dependency.json new file mode 100644 index 0000000000..65ffa2c5ee --- /dev/null +++ b/test/ClangScanDeps/Inputs/non-header-dependency.json @@ -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" + } +] diff --git a/test/ClangScanDeps/Inputs/sanitize-blacklist.txt b/test/ClangScanDeps/Inputs/sanitize-blacklist.txt new file mode 100644 index 0000000000..67375d823d --- /dev/null +++ b/test/ClangScanDeps/Inputs/sanitize-blacklist.txt @@ -0,0 +1 @@ +fun:* diff --git a/test/ClangScanDeps/non-header-dependency.cpp b/test/ClangScanDeps/non-header-dependency.cpp new file mode 100644 index 0000000000..a43826375d --- /dev/null +++ b/test/ClangScanDeps/non-header-dependency.cpp @@ -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