r365065 - [clang-scan-deps] use `-Wno-error` when scanning for dependencies

Alex Lorenz via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 3 11:01:33 PDT 2019


Author: arphaman
Date: Wed Jul  3 11:01:32 2019
New Revision: 365065

URL: http://llvm.org/viewvc/llvm-project?rev=365065&view=rev
Log:
[clang-scan-deps] use `-Wno-error` when scanning for dependencies

Warnings can be promoted to errors.
But that shouldn't prevent us from getting the dependencies!

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

Added:
    cfe/trunk/test/ClangScanDeps/Inputs/no-werror.json
    cfe/trunk/test/ClangScanDeps/Inputs/sys-header.h
    cfe/trunk/test/ClangScanDeps/no-werror.cpp
Modified:
    cfe/trunk/tools/clang-scan-deps/ClangScanDeps.cpp

Added: cfe/trunk/test/ClangScanDeps/Inputs/no-werror.json
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ClangScanDeps/Inputs/no-werror.json?rev=365065&view=auto
==============================================================================
--- cfe/trunk/test/ClangScanDeps/Inputs/no-werror.json (added)
+++ cfe/trunk/test/ClangScanDeps/Inputs/no-werror.json Wed Jul  3 11:01:32 2019
@@ -0,0 +1,7 @@
+[
+{
+  "directory": "DIR",
+  "command": "clang -E DIR/no-werror.cpp -IInputs -std=c++17 -Weverything -Werror",
+  "file": "DIR/no-werror.cpp"
+}
+]

Added: cfe/trunk/test/ClangScanDeps/Inputs/sys-header.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ClangScanDeps/Inputs/sys-header.h?rev=365065&view=auto
==============================================================================
--- cfe/trunk/test/ClangScanDeps/Inputs/sys-header.h (added)
+++ cfe/trunk/test/ClangScanDeps/Inputs/sys-header.h Wed Jul  3 11:01:32 2019
@@ -0,0 +1 @@
+#define MACRO 201411

Added: cfe/trunk/test/ClangScanDeps/no-werror.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ClangScanDeps/no-werror.cpp?rev=365065&view=auto
==============================================================================
--- cfe/trunk/test/ClangScanDeps/no-werror.cpp (added)
+++ cfe/trunk/test/ClangScanDeps/no-werror.cpp Wed Jul  3 11:01:32 2019
@@ -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

Modified: cfe/trunk/tools/clang-scan-deps/ClangScanDeps.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-scan-deps/ClangScanDeps.cpp?rev=365065&r1=365064&r2=365065&view=diff
==============================================================================
--- cfe/trunk/tools/clang-scan-deps/ClangScanDeps.cpp (original)
+++ cfe/trunk/tools/clang-scan-deps/ClangScanDeps.cpp Wed Jul  3 11:01:32 2019
@@ -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;
       });
 




More information about the cfe-commits mailing list