forked from OSchip/llvm-project
Revert "[clang-scan-deps] Add support for clang-cl"
This reverts commit bb26fa8c28
.
This commit is contained in:
parent
152efbc19a
commit
199c397482
|
@ -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"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
]
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
]
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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: ],
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<StringRef> PrintResourceDirArgs{ClangBinaryName};
|
||||
if (ClangCLMode)
|
||||
PrintResourceDirArgs.push_back("/clang:-print-resource-dir");
|
||||
else
|
||||
PrintResourceDirArgs.push_back("-print-resource-dir");
|
||||
|
||||
std::vector<StringRef> 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));
|
||||
|
|
Loading…
Reference in New Issue