From 199c39748292cbc89cd148a0d8364ebb1014ec38 Mon Sep 17 00:00:00 2001 From: Alexandre Ganea Date: Mon, 19 Apr 2021 17:43:24 -0400 Subject: [PATCH] Revert "[clang-scan-deps] Add support for clang-cl" This reverts commit bb26fa8c286bf524ed9235c3e293ad22ecf3e984. --- .../Inputs/has_include_if_elif.json | 5 -- .../Inputs/header_stat_before_open_cdb.json | 5 -- .../Inputs/headerwithdirname.json | 5 -- .../headerwithdirnamefollowedbyinclude.json | 5 -- .../Inputs/modules_cdb_clangcl.json | 22 ----- .../test/ClangScanDeps/Inputs/no-werror.json | 5 -- .../Inputs/regular_cdb_clangcl.json | 17 ---- .../Inputs/static-analyzer-cdb.json | 9 +- .../Inputs/strip_diag_serialize.json | 5 -- .../Inputs/target-filename-cdb.json | 45 ---------- .../ClangScanDeps/Inputs/vfsoverlay_cdb.json | 5 -- clang/test/ClangScanDeps/error.cpp | 5 -- .../ClangScanDeps/has_include_if_elif.cpp | 7 -- .../ClangScanDeps/header_stat_before_open.m | 6 -- .../test/ClangScanDeps/headerwithdirname.cpp | 5 -- .../headerwithdirnamefollowedbyinclude.cpp | 5 -- clang/test/ClangScanDeps/modules-full.cpp | 18 ++-- clang/test/ClangScanDeps/modules.cpp | 13 --- clang/test/ClangScanDeps/no-werror.cpp | 4 - clang/test/ClangScanDeps/regular_cdb.cpp | 23 ----- clang/test/ClangScanDeps/static-analyzer.c | 9 +- .../ClangScanDeps/strip_diag_serialize.cpp | 4 +- clang/test/ClangScanDeps/target-filename.cpp | 27 ------ clang/test/ClangScanDeps/vfsoverlay.cpp | 5 -- clang/tools/clang-scan-deps/ClangScanDeps.cpp | 86 +++++-------------- 25 files changed, 31 insertions(+), 314 deletions(-) delete mode 100644 clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl.json delete mode 100644 clang/test/ClangScanDeps/Inputs/regular_cdb_clangcl.json diff --git a/clang/test/ClangScanDeps/Inputs/has_include_if_elif.json b/clang/test/ClangScanDeps/Inputs/has_include_if_elif.json index 8fcc7ea34a9b..36ca006b0329 100644 --- a/clang/test/ClangScanDeps/Inputs/has_include_if_elif.json +++ b/clang/test/ClangScanDeps/Inputs/has_include_if_elif.json @@ -3,10 +3,5 @@ "directory": "DIR", "command": "clang -E DIR/has_include_if_elif2.cpp -IInputs", "file": "DIR/has_include_if_elif2.cpp" -}, -{ - "directory": "DIR", - "command": "clang-cl /E /IInputs -- DIR/has_include_if_elif2_clangcl.cpp", - "file": "DIR/has_include_if_elif2_clangcl.cpp" } ] diff --git a/clang/test/ClangScanDeps/Inputs/header_stat_before_open_cdb.json b/clang/test/ClangScanDeps/Inputs/header_stat_before_open_cdb.json index b99b541b1298..c5f027e9fd28 100644 --- a/clang/test/ClangScanDeps/Inputs/header_stat_before_open_cdb.json +++ b/clang/test/ClangScanDeps/Inputs/header_stat_before_open_cdb.json @@ -3,10 +3,5 @@ "directory": "DIR", "command": "clang -E DIR/header_stat_before_open_input.m -iframework Inputs/frameworks", "file": "DIR/header_stat_before_open_input.m" -}, -{ - "directory": "DIR", - "command": "clang-cl /E -Xclang -iframework -Xclang Inputs/frameworks -- DIR/header_stat_before_open_input_clangcl.m", - "file": "DIR/header_stat_before_open_input_clangcl.m" } ] diff --git a/clang/test/ClangScanDeps/Inputs/headerwithdirname.json b/clang/test/ClangScanDeps/Inputs/headerwithdirname.json index ac12c92308fd..2ae561935bec 100644 --- a/clang/test/ClangScanDeps/Inputs/headerwithdirname.json +++ b/clang/test/ClangScanDeps/Inputs/headerwithdirname.json @@ -3,10 +3,5 @@ "directory": "DIR", "command": "clang -c -IDIR -IDIR/foodir -IInputs DIR/headerwithdirname_input.cpp", "file": "DIR/headerwithdirname_input.cpp" - }, - { - "directory": "DIR", - "command": "clang-cl /c /IDIR /IDIR/foodir -IInputs -- DIR/headerwithdirname_input_clangcl.cpp", - "file": "DIR/headerwithdirname_input_clangcl.cpp" } ] diff --git a/clang/test/ClangScanDeps/Inputs/headerwithdirnamefollowedbyinclude.json b/clang/test/ClangScanDeps/Inputs/headerwithdirnamefollowedbyinclude.json index 1886328a9c3e..de7759d0b110 100644 --- a/clang/test/ClangScanDeps/Inputs/headerwithdirnamefollowedbyinclude.json +++ b/clang/test/ClangScanDeps/Inputs/headerwithdirnamefollowedbyinclude.json @@ -3,10 +3,5 @@ "directory": "DIR", "command": "clang -c -IDIR -IInputs DIR/headerwithdirname_input.cpp", "file": "DIR/headerwithdirname_input.cpp" - }, - { - "directory": "DIR", - "command": "clang-cl /c /IDIR /IInputs -- DIR/headerwithdirname_input_clangcl.cpp", - "file": "DIR/headerwithdirname_input_clangcl.cpp" } ] diff --git a/clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl.json b/clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl.json deleted file mode 100644 index a1f12867c45d..000000000000 --- a/clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl.json +++ /dev/null @@ -1,22 +0,0 @@ -[ -{ - "directory": "DIR", - "command": "clang-cl /E /IInputs /D INCLUDE_HEADER2 /clang:-MD /clang:-MF /clang:DIR/modules_cdb2_clangcl.d /clang:-fmodules /clang:-fcxx-modules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps -- DIR/modules_cdb_input2.cpp", - "file": "DIR/modules_cdb_input2.cpp" -}, -{ - "directory": "DIR", - "command": "clang-cl /E /IInputs /clang:-fmodules /clang:-fcxx-modules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps -- DIR/modules_cdb_input.cpp", - "file": "DIR/modules_cdb_input.cpp" -}, -{ - "directory": "DIR", - "command": "clang-cl /E /IInputs /clang:-fmodules /clang:-fcxx-modules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps -o a.o -- DIR/modules_cdb_input.cpp", - "file": "DIR/modules_cdb_input.cpp" -}, -{ - "directory": "DIR", - "command": "clang-cl /E /IInputs /clang:-fmodules /clang:-fcxx-modules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps -o b.o -- DIR/modules_cdb_input.cpp", - "file": "DIR/modules_cdb_input.cpp" -} -] diff --git a/clang/test/ClangScanDeps/Inputs/no-werror.json b/clang/test/ClangScanDeps/Inputs/no-werror.json index 7438b670e853..2d1f46cf3af2 100644 --- a/clang/test/ClangScanDeps/Inputs/no-werror.json +++ b/clang/test/ClangScanDeps/Inputs/no-werror.json @@ -3,10 +3,5 @@ "directory": "DIR", "command": "clang -E DIR/no-werror_input.cpp -IInputs -std=c++17 -Weverything -Werror", "file": "DIR/no-werror.cpp" -}, -{ - "directory": "DIR", - "command": "clang-cl /E /IInputs /std:c++17 -Weverything -Werror -- DIR/no-werror_input_clangcl.cpp", - "file": "DIR/no-werror_clangcl.cpp" } ] diff --git a/clang/test/ClangScanDeps/Inputs/regular_cdb_clangcl.json b/clang/test/ClangScanDeps/Inputs/regular_cdb_clangcl.json deleted file mode 100644 index bdb84bc9172f..000000000000 --- a/clang/test/ClangScanDeps/Inputs/regular_cdb_clangcl.json +++ /dev/null @@ -1,17 +0,0 @@ -[ -{ - "directory": "DIR", - "command": "clang --driver-mode=cl /E /IInputs /D INCLUDE_HEADER2 /clang:-MD /clang:-MF /clang:DIR/regular_cdb2_clangcl.d -- DIR/regular_cdb_input2.cpp", - "file": "DIR/regular_cdb_input2.cpp" -}, -{ - "directory": "DIR", - "command": "clang-cl /E /IInputs -- DIR/regular_cdb_input.cpp", - "file": "DIR/regular_cdb_input.cpp" -}, -{ - "directory": "DIR", - "command": "clang-cl /E /IInputs /Foadena.o -- DIR/regular_cdb_input.cpp", - "file": "DIR/regular_cdb_input.cpp" -} -] diff --git a/clang/test/ClangScanDeps/Inputs/static-analyzer-cdb.json b/clang/test/ClangScanDeps/Inputs/static-analyzer-cdb.json index a375f457aecb..a466d87afaa4 100644 --- a/clang/test/ClangScanDeps/Inputs/static-analyzer-cdb.json +++ b/clang/test/ClangScanDeps/Inputs/static-analyzer-cdb.json @@ -1,12 +1,7 @@ [ { "directory": "DIR", - "command": "clang --analyze DIR/static-analyzer_clang.c", - "file": "DIR/static-analyzer_clang.c" -}, -{ - "directory": "DIR", - "command": "clang-cl --analyze -- DIR/static-analyzer_clangcl.c", - "file": "DIR/static-analyzer_clangcl.c" + "command": "clang --analyze DIR/static-analyzer.c", + "file": "DIR/static-analyzer.c" } ] diff --git a/clang/test/ClangScanDeps/Inputs/strip_diag_serialize.json b/clang/test/ClangScanDeps/Inputs/strip_diag_serialize.json index 7af1acdc378a..a774d95a3b02 100644 --- a/clang/test/ClangScanDeps/Inputs/strip_diag_serialize.json +++ b/clang/test/ClangScanDeps/Inputs/strip_diag_serialize.json @@ -3,10 +3,5 @@ "directory": "DIR", "command": "clang -E -fsyntax-only DIR/strip_diag_serialize_input.cpp --serialize-diagnostics /does/not/exist", "file": "DIR/strip_diag_serialize_input.cpp" -}, -{ - "directory": "DIR", - "command": "clang-cl /E --serialize-diagnostics A:/does/not/exist -- DIR/strip_diag_serialize_input_clangcl.cpp", - "file": "DIR/strip_diag_serialize_input_clangcl.cpp" } ] diff --git a/clang/test/ClangScanDeps/Inputs/target-filename-cdb.json b/clang/test/ClangScanDeps/Inputs/target-filename-cdb.json index 90a3c81e57f4..af2e43e4e171 100644 --- a/clang/test/ClangScanDeps/Inputs/target-filename-cdb.json +++ b/clang/test/ClangScanDeps/Inputs/target-filename-cdb.json @@ -18,50 +18,5 @@ "directory": "DIR", "command": "clang -E DIR/target-filename_input.cpp -o first.o -o last.o", "file": "DIR/target-filename_input.cpp" -}, -{ - "directory": "DIR", - "command": "clang-cl /E -- DIR/target-filename_input.cpp", - "file": "DIR/target-filename_input.cpp" -}, -{ - "directory": "DIR", - "command": "clang-cl /E -o clangcl-a.o -- DIR/target-filename_input.cpp", - "file": "DIR/target-filename_input.cpp" -}, -{ - "directory": "DIR", - "command": "clang-cl /E -oclangcl-b.o -- DIR/target-filename_input.cpp", - "file": "DIR/target-filename_input.cpp" -}, -{ - "directory": "DIR", - "command": "clang-cl /E /o clangcl-c.o -- DIR/target-filename_input.cpp", - "file": "DIR/target-filename_input.cpp" -}, -{ - "directory": "DIR", - "command": "clang-cl /E /oclangcl-d.o -- DIR/target-filename_input.cpp", - "file": "DIR/target-filename_input.cpp" -}, -{ - "directory": "DIR", - "command": "clang-cl /E /Foclangcl-e.o -- DIR/target-filename_input.cpp", - "file": "DIR/target-filename_input.cpp" -}, -{ - "directory": "DIR", - "command": "clang-cl /E -o clangcl-firstf.o -o clangcl-lastf.o -- DIR/target-filename_input.cpp", - "file": "DIR/target-filename_input.cpp" -}, -{ - "directory": "DIR", - "command": "clang-cl /E /oclangcl-firstg.o /Foclangcl-lastg.o -- DIR/target-filename_input.cpp", - "file": "DIR/target-filename_input.cpp" -}, -{ - "directory": "DIR", - "command": "clang-cl /E /Foclangcl-firsth.o -o clangcl-midh.o /oclangcl-lasth.o -- DIR/target-filename_input.cpp", - "file": "DIR/target-filename_input.cpp" } ] diff --git a/clang/test/ClangScanDeps/Inputs/vfsoverlay_cdb.json b/clang/test/ClangScanDeps/Inputs/vfsoverlay_cdb.json index 1b501fa7af41..779203bac674 100644 --- a/clang/test/ClangScanDeps/Inputs/vfsoverlay_cdb.json +++ b/clang/test/ClangScanDeps/Inputs/vfsoverlay_cdb.json @@ -3,10 +3,5 @@ "directory": "DIR", "command": "clang -E DIR/vfsoverlay_input.cpp -IInputs -ivfsoverlay DIR/vfsoverlay.yaml", "file": "DIR/vfsoverlay_input.cpp" -}, -{ - "directory": "DIR", - "command": "clang-cl /E /IInputs -Xclang -ivfsoverlay -Xclang DIR/vfsoverlay.yaml -- DIR/vfsoverlay_input_clangcl.cpp", - "file": "DIR/vfsoverlay_input_clangcl.cpp" } ] diff --git a/clang/test/ClangScanDeps/error.cpp b/clang/test/ClangScanDeps/error.cpp index e18bf302af26..e4e052527890 100644 --- a/clang/test/ClangScanDeps/error.cpp +++ b/clang/test/ClangScanDeps/error.cpp @@ -3,16 +3,11 @@ // RUN: mkdir -p %t.dir // RUN: cp %s %t.dir/regular_cdb_input.cpp // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/regular_cdb.json > %t.cdb -// RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/regular_cdb_clangcl.json > %t_clangcl.cdb // // RUN: not clang-scan-deps -compilation-database %t.cdb -j 1 2>%t.dir/errs // RUN: echo EOF >> %t.dir/errs // RUN: FileCheck %s --input-file %t.dir/errs -// RUN: not clang-scan-deps -compilation-database %t_clangcl.cdb -j 1 2>%t.dir/errs_clangcl -// RUN: echo EOF >> %t.dir/errs_clangcl -// RUN: FileCheck %s --input-file %t.dir/errs_clangcl - #include "missing.h" // CHECK: Error while scanning dependencies diff --git a/clang/test/ClangScanDeps/has_include_if_elif.cpp b/clang/test/ClangScanDeps/has_include_if_elif.cpp index 17eda40c1662..dd56ecac69db 100644 --- a/clang/test/ClangScanDeps/has_include_if_elif.cpp +++ b/clang/test/ClangScanDeps/has_include_if_elif.cpp @@ -2,7 +2,6 @@ // RUN: rm -rf %t.cdb // RUN: mkdir -p %t.dir // RUN: cp %s %t.dir/has_include_if_elif2.cpp -// RUN: cp %s %t.dir/has_include_if_elif2_clangcl.cpp // RUN: mkdir %t.dir/Inputs // RUN: cp %S/Inputs/header.h %t.dir/Inputs/header.h // RUN: cp %S/Inputs/header.h %t.dir/Inputs/header2.h @@ -37,9 +36,3 @@ // CHECK-NEXT: Inputs{{/|\\}}header2.h // CHECK-NEXT: Inputs{{/|\\}}header3.h // CHECK-NEXT: Inputs{{/|\\}}header4.h - -// CHECK: has_include_if_elif2_clangcl.cpp -// CHECK-NEXT: Inputs{{/|\\}}header.h -// CHECK-NEXT: Inputs{{/|\\}}header2.h -// CHECK-NEXT: Inputs{{/|\\}}header3.h -// CHECK-NEXT: Inputs{{/|\\}}header4.h diff --git a/clang/test/ClangScanDeps/header_stat_before_open.m b/clang/test/ClangScanDeps/header_stat_before_open.m index ce6f58f434ae..f9f7d240f2c1 100644 --- a/clang/test/ClangScanDeps/header_stat_before_open.m +++ b/clang/test/ClangScanDeps/header_stat_before_open.m @@ -2,7 +2,6 @@ // RUN: rm -rf %t.cdb // RUN: mkdir -p %t.dir // RUN: cp %s %t.dir/header_stat_before_open_input.m -// RUN: cp %s %t.dir/header_stat_before_open_input_clangcl.m // RUN: mkdir %t.dir/Inputs // RUN: cp -R %S/Inputs/frameworks %t.dir/Inputs/frameworks // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/header_stat_before_open_cdb.json > %t.cdb @@ -17,8 +16,3 @@ // CHECK-NEXT: header_stat_before_open_input.m // CHECK-NEXT: Inputs{{/|\\}}frameworks{{/|\\}}Framework.framework{{/|\\}}Headers{{/|\\}}Framework.h // CHECK-NEXT: Inputs{{/|\\}}frameworks{{/|\\}}Framework.framework{{/|\\}}PrivateHeaders{{/|\\}}PrivateHeader.h - -// CHECK: header_stat_before_open_input_clangcl.o -// CHECK-NEXT: header_stat_before_open_input_clangcl.m -// CHECK-NEXT: Inputs{{/|\\}}frameworks{{/|\\}}Framework.framework{{/|\\}}Headers{{/|\\}}Framework.h -// CHECK-NEXT: Inputs{{/|\\}}frameworks{{/|\\}}Framework.framework{{/|\\}}PrivateHeaders{{/|\\}}PrivateHeader.h diff --git a/clang/test/ClangScanDeps/headerwithdirname.cpp b/clang/test/ClangScanDeps/headerwithdirname.cpp index b6c7f796e90e..b0f60333aa4c 100644 --- a/clang/test/ClangScanDeps/headerwithdirname.cpp +++ b/clang/test/ClangScanDeps/headerwithdirname.cpp @@ -4,7 +4,6 @@ // RUN: mkdir -p %t.dir // RUN: mkdir -p %t.dir/foodir // RUN: cp %s %t.dir/headerwithdirname_input.cpp -// RUN: cp %s %t.dir/headerwithdirname_input_clangcl.cpp // RUN: mkdir %t.dir/Inputs // RUN: cp %S/Inputs/foodir %t.dir/Inputs/foodir // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/headerwithdirname.json > %t.cdb @@ -16,7 +15,3 @@ // CHECK: headerwithdirname_input.o // CHECK-NEXT: headerwithdirname_input.cpp // CHECK-NEXT: Inputs{{/|\\}}foodir - -// CHECK: headerwithdirname_input_clangcl.o -// CHECK-NEXT: headerwithdirname_input_clangcl.cpp -// CHECK-NEXT: Inputs{{/|\\}}foodir diff --git a/clang/test/ClangScanDeps/headerwithdirnamefollowedbyinclude.cpp b/clang/test/ClangScanDeps/headerwithdirnamefollowedbyinclude.cpp index 1f9133dc74e8..e8e8a69e82e2 100644 --- a/clang/test/ClangScanDeps/headerwithdirnamefollowedbyinclude.cpp +++ b/clang/test/ClangScanDeps/headerwithdirnamefollowedbyinclude.cpp @@ -7,7 +7,6 @@ // RUN: cp %S/Inputs/header.h %t.dir/foodir/foodirheader.h // RUN: cp %s %t.dir/headerwithdirname_input.cpp -// RUN: cp %s %t.dir/headerwithdirname_input_clangcl.cpp // RUN: mkdir %t.dir/Inputs // RUN: cp %S/Inputs/foodir %t.dir/Inputs/foodir // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/headerwithdirnamefollowedbyinclude.json > %t.cdb @@ -20,7 +19,3 @@ // CHECK: headerwithdirname_input.o // CHECK-NEXT: headerwithdirname_input.cpp // CHECK-NEXT: Inputs{{/|\\}}foodir - -// CHECK: headerwithdirname_input_clangcl.o -// CHECK-NEXT: headerwithdirname_input_clangcl.cpp -// CHECK-NEXT: Inputs{{/|\\}}foodir diff --git a/clang/test/ClangScanDeps/modules-full.cpp b/clang/test/ClangScanDeps/modules-full.cpp index 4337ae9642a5..2ee8387bf4e4 100644 --- a/clang/test/ClangScanDeps/modules-full.cpp +++ b/clang/test/ClangScanDeps/modules-full.cpp @@ -8,18 +8,12 @@ // RUN: cp %S/Inputs/header2.h %t.dir/Inputs/header2.h // RUN: cp %S/Inputs/module.modulemap %t.dir/Inputs/module.modulemap // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/modules_cdb.json > %t.cdb -// RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/modules_cdb_clangcl.json > %t_clangcl.cdb // // RUN: echo %t.dir > %t.result // RUN: clang-scan-deps -compilation-database %t.cdb -j 4 -format experimental-full \ // RUN: -mode preprocess-minimized-sources >> %t.result // RUN: cat %t.result | sed 's/\\/\//g' | FileCheck --check-prefixes=CHECK %s -// RUN: echo %t.dir > %t_clangcl.result -// RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 4 -format experimental-full \ -// RUN: -mode preprocess-minimized-sources >> %t_clangcl.result -// RUN: cat %t_clangcl.result | sed 's/\\/\//g' | FileCheck --check-prefixes=CHECK %s - // FIXME: Backslash issues. // XFAIL: system-windows @@ -38,7 +32,7 @@ // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/Inputs/module.modulemap", // CHECK-NEXT: "command-line": [ // CHECK: "-fmodule-map-file=[[PREFIX]]/Inputs/module.modulemap", -// CHECK: "-fmodule-file=[[PREFIX]]/module-cache{{(_clangcl)?}}/[[CONTEXT_HASH_H1]]/header2-{{[A-Z0-9]+}}.pcm", +// CHECK: "-fmodule-file=[[PREFIX]]/module-cache/[[CONTEXT_HASH_H1]]/header2-{{[A-Z0-9]+}}.pcm", // CHECK-NOT: "-fimplicit-module-maps", // CHECK: "-fno-implicit-modules", // CHECK: ], @@ -90,7 +84,7 @@ // CHECK-NEXT: "command-line": [ // CHECK-NEXT: "-fno-implicit-modules", // CHECK-NEXT: "-fno-implicit-module-maps", -// CHECK-NEXT: "-fmodule-file=[[PREFIX]]/module-cache{{(_clangcl)?}}/[[CONTEXT_HASH_H2]]/header1-{{[A-Z0-9]+}}.pcm", +// CHECK-NEXT: "-fmodule-file=[[PREFIX]]/module-cache/[[CONTEXT_HASH_H2]]/header1-{{[A-Z0-9]+}}.pcm", // CHECK-NEXT: "-fmodule-map-file=[[PREFIX]]/Inputs/module.modulemap" // CHECK-NEXT: ], // CHECK-NEXT: "file-deps": [ @@ -109,7 +103,7 @@ // CHECK-NEXT: "command-line": [ // CHECK-NEXT: "-fno-implicit-modules", // CHECK-NEXT: "-fno-implicit-module-maps", -// CHECK-NEXT: "-fmodule-file=[[PREFIX]]/module-cache{{(_clangcl)?}}/[[CONTEXT_HASH_H2]]/header1-{{[A-Z0-9]+}}.pcm", +// CHECK-NEXT: "-fmodule-file=[[PREFIX]]/module-cache/[[CONTEXT_HASH_H2]]/header1-{{[A-Z0-9]+}}.pcm", // CHECK-NEXT: "-fmodule-map-file=[[PREFIX]]/Inputs/module.modulemap" // CHECK-NEXT: ], // CHECK-NEXT: "file-deps": [ @@ -128,7 +122,7 @@ // CHECK-NEXT: "command-line": [ // CHECK-NEXT: "-fno-implicit-modules", // CHECK-NEXT: "-fno-implicit-module-maps", -// CHECK-NEXT: "-fmodule-file=[[PREFIX]]/module-cache{{(_clangcl)?}}/[[CONTEXT_HASH_H2]]/header1-{{[A-Z0-9]+}}.pcm", +// CHECK-NEXT: "-fmodule-file=[[PREFIX]]/module-cache/[[CONTEXT_HASH_H2]]/header1-{{[A-Z0-9]+}}.pcm", // CHECK-NEXT: "-fmodule-map-file=[[PREFIX]]/Inputs/module.modulemap" // CHECK-NEXT: ], // CHECK-NEXT: "file-deps": [ @@ -147,8 +141,8 @@ // CHECK-NEXT: "command-line": [ // CHECK-NEXT: "-fno-implicit-modules", // CHECK-NEXT: "-fno-implicit-module-maps", -// CHECK-NEXT: "-fmodule-file=[[PREFIX]]/module-cache{{(_clangcl)?}}/[[CONTEXT_HASH_H1]]/header2-{{[A-Z0-9]+}}.pcm", -// CHECK-NEXT: "-fmodule-file=[[PREFIX]]/module-cache{{(_clangcl)?}}/[[CONTEXT_HASH_H1]]/header1-{{[A-Z0-9]+}}.pcm", +// CHECK-NEXT: "-fmodule-file=[[PREFIX]]/module-cache/[[CONTEXT_HASH_H1]]/header2-{{[A-Z0-9]+}}.pcm", +// CHECK-NEXT: "-fmodule-file=[[PREFIX]]/module-cache/[[CONTEXT_HASH_H1]]/header1-{{[A-Z0-9]+}}.pcm", // CHECK-NEXT: "-fmodule-map-file=[[PREFIX]]/Inputs/module.modulemap", // CHECK-NEXT: "-fmodule-map-file=[[PREFIX]]/Inputs/module.modulemap" // CHECK-NEXT: ], diff --git a/clang/test/ClangScanDeps/modules.cpp b/clang/test/ClangScanDeps/modules.cpp index f0d97dc0c5c2..599fcd1b4353 100644 --- a/clang/test/ClangScanDeps/modules.cpp +++ b/clang/test/ClangScanDeps/modules.cpp @@ -1,8 +1,6 @@ // RUN: rm -rf %t.dir // RUN: rm -rf %t.cdb -// RUN: rm -rf %t_clangcl.cdb // RUN: rm -rf %t.module-cache -// RUN: rm -rf %t.module-cache_clangcl // RUN: mkdir -p %t.dir // RUN: cp %s %t.dir/modules_cdb_input.cpp // RUN: cp %s %t.dir/modules_cdb_input2.cpp @@ -11,12 +9,9 @@ // RUN: cp %S/Inputs/header2.h %t.dir/Inputs/header2.h // RUN: cp %S/Inputs/module.modulemap %t.dir/Inputs/module.modulemap // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/modules_cdb.json > %t.cdb -// RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/modules_cdb_clangcl.json > %t_clangcl.cdb // // RUN: clang-scan-deps -compilation-database %t.cdb -j 1 -mode preprocess-minimized-sources | \ // RUN: FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO %s -// RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 1 -mode preprocess-minimized-sources | \ -// RUN: FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO %s // // The output order is non-deterministic when using more than one thread, // so check the output using two runs. Note that the 'NOT' check is not used @@ -25,20 +20,12 @@ // // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess-minimized-sources | \ // RUN: FileCheck --check-prefix=CHECK1 %s -// RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 2 -mode preprocess-minimized-sources | \ -// RUN: FileCheck --check-prefix=CHECK1 %s // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess | \ // RUN: FileCheck --check-prefix=CHECK1 %s -// RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 2 -mode preprocess | \ -// RUN: FileCheck --check-prefix=CHECK1 %s // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess-minimized-sources | \ // RUN: FileCheck --check-prefix=CHECK2 %s -// RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 2 -mode preprocess-minimized-sources | \ -// RUN: FileCheck --check-prefix=CHECK2 %s // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess | \ // RUN: FileCheck --check-prefix=CHECK2 %s -// RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 2 -mode preprocess | \ -// RUN: FileCheck --check-prefix=CHECK2 %s #include "header.h" diff --git a/clang/test/ClangScanDeps/no-werror.cpp b/clang/test/ClangScanDeps/no-werror.cpp index 11f1b718dac5..95407c51b3cc 100644 --- a/clang/test/ClangScanDeps/no-werror.cpp +++ b/clang/test/ClangScanDeps/no-werror.cpp @@ -2,7 +2,6 @@ // RUN: rm -rf %t.cdb // RUN: mkdir -p %t.dir // RUN: cp %s %t.dir/no-werror_input.cpp -// RUN: cp %s %t.dir/no-werror_input_clangcl.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 @@ -15,6 +14,3 @@ // CHECK: no-werror_input.cpp // CHECK-NEXT: Inputs{{/|\\}}sys-header.h - -// CHECK: no-werror_input_clangcl.cpp -// CHECK-NEXT: Inputs{{/|\\}}sys-header.h diff --git a/clang/test/ClangScanDeps/regular_cdb.cpp b/clang/test/ClangScanDeps/regular_cdb.cpp index d7ba2519067e..8fb94350e4c2 100644 --- a/clang/test/ClangScanDeps/regular_cdb.cpp +++ b/clang/test/ClangScanDeps/regular_cdb.cpp @@ -1,6 +1,5 @@ // RUN: rm -rf %t.dir // RUN: rm -rf %t.cdb -// RUN: rm -rf %t_clangcl.cdb // RUN: mkdir -p %t.dir // RUN: cp %s %t.dir/regular_cdb_input.cpp // RUN: cp %s %t.dir/regular_cdb_input2.cpp @@ -8,28 +7,17 @@ // RUN: cp %S/Inputs/header.h %t.dir/Inputs/header.h // RUN: cp %S/Inputs/header2.h %t.dir/Inputs/header2.h // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/regular_cdb.json > %t.cdb -// RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/regular_cdb_clangcl.json > %t_clangcl.cdb // // RUN: clang-scan-deps -compilation-database %t.cdb -j 1 -mode preprocess-minimized-sources | \ // RUN: FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO,CHECK3 %s -// RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 1 -mode preprocess-minimized-sources | \ -// RUN: FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO,CHECK3 %s - // RUN: clang-scan-deps -compilation-database %t.cdb -j 1 -mode preprocess | \ // RUN: FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO,CHECK3 %s -// RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 1 -mode preprocess | \ -// RUN: FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO,CHECK3 %s - // RUN: clang-scan-deps -compilation-database %t.cdb -j 1 -mode preprocess-minimized-sources \ // RUN: -skip-excluded-pp-ranges=0 | FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO,CHECK3 %s -// RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 1 -mode preprocess-minimized-sources \ -// RUN: -skip-excluded-pp-ranges=0 | FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO,CHECK3 %s // // Make sure we didn't produce any dependency files! // RUN: not cat %t.dir/regular_cdb.d -// RUN: not cat %t.dir/regular_cdb_clangcl.d // RUN: not cat %t.dir/regular_cdb2.d -// RUN: not cat %t.dir/regular_cdb2_clangcl.d // // The output order is non-deterministic when using more than one thread, // so check the output using two runs. Note that the 'NOT' check is not used @@ -38,23 +26,12 @@ // // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess-minimized-sources | \ // RUN: FileCheck --check-prefix=CHECK1 %s -// RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 2 -mode preprocess-minimized-sources | \ -// RUN: FileCheck --check-prefix=CHECK1 %s - // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess | \ // RUN: FileCheck --check-prefix=CHECK1 %s -// RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 2 -mode preprocess | \ -// RUN: FileCheck --check-prefix=CHECK1 %s - // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess-minimized-sources | \ // RUN: FileCheck --check-prefix=CHECK2 %s -// RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 2 -mode preprocess-minimized-sources | \ -// RUN: FileCheck --check-prefix=CHECK2 %s - // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess | \ // RUN: FileCheck --check-prefix=CHECK2 %s -// RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 2 -mode preprocess | \ -// RUN: FileCheck --check-prefix=CHECK2 %s #include "header.h" diff --git a/clang/test/ClangScanDeps/static-analyzer.c b/clang/test/ClangScanDeps/static-analyzer.c index 8edbf3eaae20..c4af9b076bb2 100644 --- a/clang/test/ClangScanDeps/static-analyzer.c +++ b/clang/test/ClangScanDeps/static-analyzer.c @@ -1,9 +1,7 @@ // RUN: rm -rf %t.dir // RUN: rm -rf %t-cdb.json // RUN: mkdir -p %t.dir -// Change file name to avoid false positives in CHECK, since "static-analyzer.c" is found in %S. -// RUN: cp %s %t.dir/static-analyzer_clang.c -// RUN: cp %s %t.dir/static-analyzer_clangcl.c +// RUN: cp %s %t.dir/static-analyzer.c // RUN: mkdir %t.dir/Inputs // RUN: cp %S/Inputs/header.h %t.dir/Inputs/analyze_header_input.h // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/static-analyzer-cdb.json > %t-cdb.json @@ -14,8 +12,5 @@ #include "Inputs/analyze_header_input.h" #endif -// CHECK: static-analyzer_clang.c -// CHECK-NEXT: analyze_header_input.h +// CHECK: analyze_header_input.h -// CHECK: static-analyzer_clangcl.c -// CHECK-NEXT: analyze_header_input.h diff --git a/clang/test/ClangScanDeps/strip_diag_serialize.cpp b/clang/test/ClangScanDeps/strip_diag_serialize.cpp index d9f758882027..ec62e7513481 100644 --- a/clang/test/ClangScanDeps/strip_diag_serialize.cpp +++ b/clang/test/ClangScanDeps/strip_diag_serialize.cpp @@ -2,12 +2,10 @@ // RUN: rm -rf %t.cdb // RUN: mkdir -p %t.dir // RUN: cp %s %t.dir/strip_diag_serialize_input.cpp -// RUN: cp %s %t.dir/strip_diag_serialize_input_clangcl.cpp // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/strip_diag_serialize.json > %t.cdb // -// RUN: clang-scan-deps -compilation-database %t.cdb -j 1 2>&1 | FileCheck %s +// RUN: clang-scan-deps -compilation-database %t.cdb 2>&1 | FileCheck %s // CHECK-NOT: unable to open file // CHECK: strip_diag_serialize_input.cpp -// CHECK: strip_diag_serialize_input_clangcl.cpp #warning "diagnostic" diff --git a/clang/test/ClangScanDeps/target-filename.cpp b/clang/test/ClangScanDeps/target-filename.cpp index 02084ee9b372..c47166b21e4e 100644 --- a/clang/test/ClangScanDeps/target-filename.cpp +++ b/clang/test/ClangScanDeps/target-filename.cpp @@ -18,30 +18,3 @@ // CHECK-NEXT: last.o: // CHECK-NEXT: target-filename_input.cpp - -// CHECK: target-filename_input.o: -// CHECK-NEXT: target-filename_input.cpp - -// CHECK-NEXT: clangcl-a.o: -// CHECK-NEXT: target-filename_input.cpp - -// CHECK-NEXT: clangcl-b.o: -// CHECK-NEXT: target-filename_input.cpp - -// CHECK-NEXT: clangcl-c.o: -// CHECK-NEXT: target-filename_input.cpp - -// CHECK-NEXT: clangcl-d.o: -// CHECK-NEXT: target-filename_input.cpp - -// CHECK-NEXT: clangcl-e.o: -// CHECK-NEXT: target-filename_input.cpp - -// CHECK-NEXT: clangcl-lastf.o: -// CHECK-NEXT: target-filename_input.cpp - -// CHECK-NEXT: clangcl-lastg.o: -// CHECK-NEXT: target-filename_input.cpp - -// CHECK-NEXT: clangcl-lasth.o: -// CHECK-NEXT: target-filename_input.cpp diff --git a/clang/test/ClangScanDeps/vfsoverlay.cpp b/clang/test/ClangScanDeps/vfsoverlay.cpp index b3a2b23daad7..517738943ab5 100644 --- a/clang/test/ClangScanDeps/vfsoverlay.cpp +++ b/clang/test/ClangScanDeps/vfsoverlay.cpp @@ -2,7 +2,6 @@ // RUN: rm -rf %t.cdb // RUN: mkdir -p %t.dir // RUN: cp %s %t.dir/vfsoverlay_input.cpp -// RUN: cp %s %t.dir/vfsoverlay_input_clangcl.cpp // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/vfsoverlay.yaml > %t.dir/vfsoverlay.yaml // RUN: mkdir %t.dir/Inputs // RUN: cp %S/Inputs/header.h %t.dir/Inputs/header.h @@ -16,7 +15,3 @@ // CHECK: vfsoverlay_input.o // CHECK-NEXT: vfsoverlay_input.cpp // CHECK-NEXT: Inputs{{/|\\}}header.h - -// CHECK: vfsoverlay_input_clangcl.o -// CHECK-NEXT: vfsoverlay_input_clangcl.cpp -// CHECK-NEXT: Inputs{{/|\\}}header.h diff --git a/clang/tools/clang-scan-deps/ClangScanDeps.cpp b/clang/tools/clang-scan-deps/ClangScanDeps.cpp index 00cbc0f2fce1..4b96c81542ef 100644 --- a/clang/tools/clang-scan-deps/ClangScanDeps.cpp +++ b/clang/tools/clang-scan-deps/ClangScanDeps.cpp @@ -12,8 +12,6 @@ #include "clang/Tooling/DependencyScanning/DependencyScanningTool.h" #include "clang/Tooling/DependencyScanning/DependencyScanningWorker.h" #include "clang/Tooling/JSONCompilationDatabase.h" -#include "llvm/ADT/STLExtras.h" -#include "llvm/ADT/Twine.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileUtilities.h" #include "llvm/Support/InitLLVM.h" @@ -51,8 +49,7 @@ public: /// option and cache the results for reuse. \returns resource directory path /// associated with the given invocation command or empty string if the /// compiler path is NOT an absolute path. - StringRef findResourceDir(const tooling::CommandLineArguments &Args, - bool ClangCLMode) { + StringRef findResourceDir(const tooling::CommandLineArguments &Args) { if (Args.size() < 1) return ""; @@ -68,12 +65,8 @@ public: if (CachedResourceDir != Cache.end()) return CachedResourceDir->second; - std::vector PrintResourceDirArgs{ClangBinaryName}; - if (ClangCLMode) - PrintResourceDirArgs.push_back("/clang:-print-resource-dir"); - else - PrintResourceDirArgs.push_back("-print-resource-dir"); - + std::vector PrintResourceDirArgs{ClangBinaryName, + "-print-resource-dir"}; llvm::SmallString<64> OutputFile, ErrorFile; llvm::sys::fs::createTemporaryFile("print-resource-dir-output", "" /*no-suffix*/, OutputFile); @@ -416,52 +409,24 @@ int main(int argc, const char **argv) { bool HasMQ = false; bool HasMD = false; bool HasResourceDir = false; - bool ClangCLMode = false; auto FlagsEnd = llvm::find(Args, "--"); if (FlagsEnd != Args.begin()) { - ClangCLMode = - llvm::sys::path::stem(Args[0]).contains_lower("clang-cl") || - llvm::is_contained(Args, "--driver-mode=cl"); - // Reverse scan, starting at the end or at the element before "--". auto R = llvm::make_reverse_iterator(FlagsEnd); for (auto I = R, E = Args.rend(); I != E; ++I) { StringRef Arg = *I; - if (ClangCLMode) { - if (LastO.empty()) { - // With clang-cl, the output obj file can be specified with - // "/opath", "/o path", "/Fopath", and the dash counterparts. - // Also, clang-cl adds ".obj" extension if none is found. - if ((Arg == "-o" || Arg == "/o") && I != R) - LastO = I[-1]; // Next argument (reverse iterator) - else if (Arg.startswith("/Fo") || Arg.startswith("-Fo")) - LastO = Arg.drop_front(3).str(); - else if (Arg.startswith("/o") || Arg.startswith("-o")) - LastO = Arg.drop_front(2).str(); - - if (!LastO.empty() && !llvm::sys::path::has_extension(LastO)) - LastO.append(".obj"); - } - if (Arg == "/clang:-MT") - HasMT = true; - if (Arg == "/clang:-MQ") - HasMQ = true; - if (Arg == "/clang:-MD") - HasMD = true; - } else { - if (LastO.empty()) { - if (Arg == "-o" && I != R) - LastO = I[-1]; // Next argument (reverse iterator) - else if (Arg.startswith("-o")) - LastO = Arg.drop_front(2).str(); - } - if (Arg == "-MT") - HasMT = true; - if (Arg == "-MQ") - HasMQ = true; - if (Arg == "-MD") - HasMD = true; + if (LastO.empty()) { + if (Arg == "-o" && I != R) + LastO = I[-1]; // Next argument (reverse iterator) + else if (Arg.startswith("-o")) + LastO = Arg.drop_front(2).str(); } + if (Arg == "-MT") + HasMT = true; + if (Arg == "-MQ") + HasMQ = true; + if (Arg == "-MD") + HasMD = true; if (Arg == "-resource-dir") HasResourceDir = true; } @@ -470,29 +435,18 @@ int main(int argc, const char **argv) { // -o option. tooling::CommandLineArguments AdjustedArgs(Args.begin(), FlagsEnd); AdjustedArgs.push_back("-o"); -#ifdef _WIN32 - AdjustedArgs.push_back("nul"); -#else AdjustedArgs.push_back("/dev/null"); -#endif if (!HasMT && !HasMQ) { + AdjustedArgs.push_back("-M"); + AdjustedArgs.push_back("-MT"); // We're interested in source dependencies of an object file. - std::string FileNameArg; if (!HasMD) { // FIXME: We are missing the directory unless the -o value is an // absolute path. - FileNameArg = !LastO.empty() ? LastO : getObjFilePath(FileName); + AdjustedArgs.push_back(!LastO.empty() ? LastO + : getObjFilePath(FileName)); } else { - FileNameArg = std::string(FileName); - } - if (ClangCLMode) { - AdjustedArgs.push_back("/clang:-M"); - AdjustedArgs.push_back("/clang:-MT"); - AdjustedArgs.push_back(Twine("/clang:", FileNameArg).str()); - } else { - AdjustedArgs.push_back("-M"); - AdjustedArgs.push_back("-MT"); - AdjustedArgs.push_back(std::move(FileNameArg)); + AdjustedArgs.push_back(std::string(FileName)); } } AdjustedArgs.push_back("-Xclang"); @@ -503,7 +457,7 @@ int main(int argc, const char **argv) { if (!HasResourceDir) { StringRef ResourceDir = - ResourceDirCache.findResourceDir(Args, ClangCLMode); + ResourceDirCache.findResourceDir(Args); if (!ResourceDir.empty()) { AdjustedArgs.push_back("-resource-dir"); AdjustedArgs.push_back(std::string(ResourceDir));