[clang] - 962ca07 - Include sanitize blacklist and other extra deps as part of scan-deps output
Kousik Kumar via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 16 19:13:35 PDT 2019
Author: Kousik Kumar
Date: 2019-10-17T02:14:44Z
New Revision: 962ca076e51c25a7a08f4e0d329c65328a635bdb
URL: https://github.com/llvm/llvm-project/commit/962ca076e51c25a7a08f4e0d329c65328a635bdb
DIFF: https://github.com/llvm/llvm-project/commit/962ca076e51c25a7a08f4e0d329c65328a635bdb.diff
LOG: 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
Added:
clang/test/ClangScanDeps/Inputs/non-header-dependency.json
clang/test/ClangScanDeps/Inputs/sanitize-blacklist.txt
clang/test/ClangScanDeps/non-header-dependency.cpp
Modified:
clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
Removed:
################################################################################
diff --git a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
index f382c202f8c2..70c8b5a082c0 100644
--- a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -36,6 +36,8 @@ class DependencyConsumerForwarder : public DependencyFileGenerator {
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/clang/test/ClangScanDeps/Inputs/non-header-dependency.json b/clang/test/ClangScanDeps/Inputs/non-header-dependency.json
new file mode 100644
index 000000000000..65ffa2c5ee67
--- /dev/null
+++ b/clang/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/clang/test/ClangScanDeps/Inputs/sanitize-blacklist.txt b/clang/test/ClangScanDeps/Inputs/sanitize-blacklist.txt
new file mode 100644
index 000000000000..67375d823d54
--- /dev/null
+++ b/clang/test/ClangScanDeps/Inputs/sanitize-blacklist.txt
@@ -0,0 +1 @@
+fun:*
diff --git a/clang/test/ClangScanDeps/non-header-dependency.cpp b/clang/test/ClangScanDeps/non-header-dependency.cpp
new file mode 100644
index 000000000000..a43826375d3a
--- /dev/null
+++ b/clang/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
More information about the cfe-commits
mailing list