]> granicus.if.org Git - clang/commitdiff
[clang-scan-deps] use `-Wno-error` when scanning for dependencies
authorAlex Lorenz <arphaman@gmail.com>
Wed, 3 Jul 2019 18:01:32 +0000 (18:01 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Wed, 3 Jul 2019 18:01:32 +0000 (18:01 +0000)
Warnings can be promoted to errors.
But that shouldn't prevent us from getting the dependencies!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365065 91177308-0d34-0410-b5e6-96231b3b80d8

test/ClangScanDeps/Inputs/no-werror.json [new file with mode: 0644]
test/ClangScanDeps/Inputs/sys-header.h [new file with mode: 0644]
test/ClangScanDeps/no-werror.cpp [new file with mode: 0644]
tools/clang-scan-deps/ClangScanDeps.cpp

diff --git a/test/ClangScanDeps/Inputs/no-werror.json b/test/ClangScanDeps/Inputs/no-werror.json
new file mode 100644 (file)
index 0000000..c9590f8
--- /dev/null
@@ -0,0 +1,7 @@
+[
+{
+  "directory": "DIR",
+  "command": "clang -E DIR/no-werror.cpp -IInputs -std=c++17 -Weverything -Werror",
+  "file": "DIR/no-werror.cpp"
+}
+]
diff --git a/test/ClangScanDeps/Inputs/sys-header.h b/test/ClangScanDeps/Inputs/sys-header.h
new file mode 100644 (file)
index 0000000..948a287
--- /dev/null
@@ -0,0 +1 @@
+#define MACRO 201411
diff --git a/test/ClangScanDeps/no-werror.cpp b/test/ClangScanDeps/no-werror.cpp
new file mode 100644 (file)
index 0000000..4a5eff2
--- /dev/null
@@ -0,0 +1,16 @@
+// RUN: rm -rf %t.dir
+// RUN: rm -rf %t.cdb
+// RUN: mkdir -p %t.dir
+// RUN: cp %s %t.dir/no-werror.cpp
+// RUN: mkdir %t.dir/Inputs
+// RUN: cp %S/Inputs/sys-header.h %t.dir/Inputs/sys-header.h
+// RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/no-werror.json > %t.cdb
+//
+// RUN: clang-scan-deps -compilation-database %t.cdb -j 1 | FileCheck %s
+
+#define MACRO 201411L
+
+#include "sys-header.h"
+
+// CHECK: no-werror.cpp
+// CHECK-NEXT: Inputs{{/|\\}}sys-header.h
index 7432a9eadc5a8fdd067aecd4574af69e04e8860c..5fea09d1a7e8d725e964c1b99b9c51c9c003d558 100644 (file)
@@ -129,6 +129,7 @@ int main(int argc, const char **argv) {
         AdjustedArgs.push_back("-Eonly");
         AdjustedArgs.push_back("-Xclang");
         AdjustedArgs.push_back("-sys-header-deps");
+        AdjustedArgs.push_back("-Wno-error");
         return AdjustedArgs;
       });