[clang][deps] NFC: De-duplicate clang-cl tests
In D92191, a bunch of test cases were added to check `clang-scan-deps` works in `clang-cl` mode as well. We don't need to duplicate all test cases, though. Testing the few special cases we have in `clang-scan-deps` for `clang-cl` should be good enough: 1. Deducing output path (and therefore target name in our make output). 2. Ignoring `-Xclang` arguments in step 1. 3. Deducing resource directory by invoking the compiler executuable. This test de-duplicates the extra clang-cl test cases. Reviewed By: dexonsmith, saudi Differential Revision: https://reviews.llvm.org/D121812
This commit is contained in:
@@ -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"
|
||||
}
|
||||
]
|
||||
@@ -1,12 +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 /clang:-x /clang:c++ --",
|
||||
"file": ""
|
||||
},
|
||||
{
|
||||
"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 /clang:-x /clang:c++ --",
|
||||
"file": ""
|
||||
},
|
||||
]
|
||||
@@ -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"
|
||||
}
|
||||
]
|
||||
@@ -3,10 +3,5 @@
|
||||
"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"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -23,45 +23,5 @@
|
||||
"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"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -4,9 +4,4 @@
|
||||
"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"
|
||||
}
|
||||
]
|
||||
|
||||
87
clang/test/ClangScanDeps/cl-output.c
Normal file
87
clang/test/ClangScanDeps/cl-output.c
Normal file
@@ -0,0 +1,87 @@
|
||||
// This test checks that the output path is correctly deduced/recognized in clang-cl mode.
|
||||
|
||||
// RUN: rm -rf %t
|
||||
// RUN: split-file %s %t
|
||||
|
||||
//--- deduce-cdb.json.template
|
||||
[{
|
||||
"file": "DIR/test.c",
|
||||
"directory": "DIR",
|
||||
"command": "clang --driver-mode=cl /c -- DIR/test.c"
|
||||
},{
|
||||
"file": "DIR/test.c",
|
||||
"directory": "DIR",
|
||||
"command": "clang-cl /c -- DIR/test.c"
|
||||
}]
|
||||
|
||||
//--- recognize-cdb.json.template
|
||||
[{
|
||||
"file": "DIR/test.c",
|
||||
"directory": "DIR",
|
||||
"command": "clang-cl /c -o DIR/test.o -- DIR/test.c"
|
||||
},{
|
||||
"file": "DIR/test.c",
|
||||
"directory": "DIR",
|
||||
"command": "clang-cl /c /o DIR/test.o -- DIR/test.c"
|
||||
},{
|
||||
"file": "DIR/test.c",
|
||||
"directory": "DIR",
|
||||
"command": "clang-cl /c -oDIR/test.o -- DIR/test.c"
|
||||
},{
|
||||
"file": "DIR/test.c",
|
||||
"directory": "DIR",
|
||||
"command": "clang-cl /c /oDIR/test.o -- DIR/test.c"
|
||||
},{
|
||||
"file": "DIR/test.c",
|
||||
"directory": "DIR",
|
||||
"command": "clang-cl /c -FoDIR/test.o -- DIR/test.c"
|
||||
},{
|
||||
"file": "DIR/test.c",
|
||||
"directory": "DIR",
|
||||
"command": "clang-cl /c /FoDIR/test.o -- DIR/test.c"
|
||||
}]
|
||||
|
||||
//--- last-arg-cdb.json.template
|
||||
[{
|
||||
"file": "DIR/test.c",
|
||||
"directory": "DIR",
|
||||
"command": "clang-cl /c -o DIR/test.o -o DIR/last.o -- DIR/test.c"
|
||||
}]
|
||||
|
||||
//--- test.c
|
||||
|
||||
// Check that missing output path is deduced (with both clang-cl executable and driver mode flag):
|
||||
//
|
||||
// RUN: sed -e "s|DIR|%/t|g" %t/deduce-cdb.json.template > %t/deduce-cdb.json
|
||||
// RUN: clang-scan-deps -compilation-database %t/deduce-cdb.json -j 1 > %t/deduce-result.d
|
||||
// RUN: cat %t/deduce-result.d | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t --check-prefix=CHECK-DEDUCE
|
||||
// CHECK-DEDUCE: test.obj:
|
||||
// CHECK-DEDUCE-NEXT: [[PREFIX]]/test.c
|
||||
// CHECK-DEDUCE-NEXT: test.obj:
|
||||
// CHECK-DEDUCE-NEXT: [[PREFIX]]/test.c
|
||||
|
||||
// Check that all the different ways to specify output file are recognized:
|
||||
//
|
||||
// RUN: sed -e "s|DIR|%/t|g" %t/recognize-cdb.json.template > %t/recognize-cdb.json
|
||||
// RUN: clang-scan-deps -compilation-database %t/recognize-cdb.json -j 1 > %t/recognize-result.d
|
||||
// RUN: cat %t/recognize-result.d | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t --check-prefix=CHECK-RECOGNIZE
|
||||
// CHECK-RECOGNIZE: [[PREFIX]]/test.o:
|
||||
// CHECK-RECOGNIZE-NEXT: [[PREFIX]]/test.c
|
||||
// CHECK-RECOGNIZE-NEXT: [[PREFIX]]/test.o:
|
||||
// CHECK-RECOGNIZE-NEXT: [[PREFIX]]/test.c
|
||||
// CHECK-RECOGNIZE-NEXT: [[PREFIX]]/test.o:
|
||||
// CHECK-RECOGNIZE-NEXT: [[PREFIX]]/test.c
|
||||
// CHECK-RECOGNIZE-NEXT: [[PREFIX]]/test.o:
|
||||
// CHECK-RECOGNIZE-NEXT: [[PREFIX]]/test.c
|
||||
// CHECK-RECOGNIZE-NEXT: [[PREFIX]]/test.o:
|
||||
// CHECK-RECOGNIZE-NEXT: [[PREFIX]]/test.c
|
||||
// CHECK-RECOGNIZE-NEXT: [[PREFIX]]/test.o:
|
||||
// CHECK-RECOGNIZE-NEXT: [[PREFIX]]/test.c
|
||||
|
||||
// Check that the last argument specifying the output path wins.
|
||||
//
|
||||
// RUN: sed -e "s|DIR|%/t|g" %t/last-arg-cdb.json.template > %t/last-arg-cdb.json
|
||||
// RUN: clang-scan-deps -compilation-database %t/last-arg-cdb.json > %t/last-arg-result.d
|
||||
// RUN: cat %t/last-arg-result.d | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t --check-prefix=CHECK-LAST
|
||||
// CHECK-LAST: [[PREFIX]]/last.o:
|
||||
// CHECK-LAST-NEXT: [[PREFIX]]/test.c
|
||||
34
clang/test/ClangScanDeps/cl-resource-dir.c
Normal file
34
clang/test/ClangScanDeps/cl-resource-dir.c
Normal file
@@ -0,0 +1,34 @@
|
||||
// This test checks that the clang-cl compiler is correctly invoked to deduce resource directory.
|
||||
|
||||
// REQUIRES: shell
|
||||
|
||||
// RUN: rm -rf %t
|
||||
// RUN: split-file %s %t
|
||||
|
||||
//--- cdb.json.template
|
||||
[{
|
||||
"file": "DIR/test.c",
|
||||
"directory": "DIR",
|
||||
"command": "DIR/clang-cl /c /o DIR/test.o -- DIR/test.c"
|
||||
}]
|
||||
|
||||
//--- clang-cl
|
||||
#!/bin/sh
|
||||
|
||||
# This is a fake compiler that should be invoked the clang-cl way to print the resource directory.
|
||||
|
||||
if [ "$1" = "/clang:-print-resource-dir" ]; then
|
||||
echo "/pass"
|
||||
else
|
||||
echo "/fail"
|
||||
fi;
|
||||
|
||||
//--- test.c
|
||||
|
||||
// RUN: chmod +x %t/clang-cl
|
||||
// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
|
||||
// RUN: clang-scan-deps -compilation-database %t/cdb.json --resource-dir-recipe invoke-compiler \
|
||||
// RUN: --format experimental-full > %t/result.json
|
||||
// RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s
|
||||
// CHECK: "-resource-dir"
|
||||
// CHECK-NEXT: "/pass"
|
||||
20
clang/test/ClangScanDeps/cl-xclang.c
Normal file
20
clang/test/ClangScanDeps/cl-xclang.c
Normal file
@@ -0,0 +1,20 @@
|
||||
// This test checks that '-Xclang' arguments are ignored during the clang-cl command line adjustment.
|
||||
// This prevents interpreting '-Xclang -I -Xclang /opt/include' as '/o pt/include' (output path).
|
||||
|
||||
// RUN: rm -rf %t
|
||||
// RUN: split-file %s %t
|
||||
|
||||
//--- cdb.json.template
|
||||
[{
|
||||
"file": "DIR/test.c",
|
||||
"directory": "DIR",
|
||||
"command": "clang-cl /c /o DIR/test.o -Xclang -I -Xclang /opt/include -- DIR/test.c"
|
||||
}]
|
||||
|
||||
//--- test.c
|
||||
|
||||
// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
|
||||
// RUN: clang-scan-deps -compilation-database %t/cdb.json > %t/result.d
|
||||
// RUN: cat %t/result.d | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
|
||||
// CHECK: [[PREFIX]]/test.o:
|
||||
// CHECK-NEXT: [[PREFIX]]/test.c
|
||||
@@ -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|.*\.s}}
|
||||
// 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|.*\.s}}
|
||||
// CHECK-NEXT: headerwithdirname_input.cpp
|
||||
// CHECK-NEXT: Inputs{{/|\\}}foodir
|
||||
|
||||
// CHECK: headerwithdirname_input_clangcl.o
|
||||
// CHECK-NEXT: headerwithdirname_input_clangcl.cpp
|
||||
// CHECK-NEXT: Inputs{{/|\\}}foodir
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
// CHECK-NEXT: "command-line": [
|
||||
// CHECK: "-fno-implicit-modules"
|
||||
// CHECK-NEXT: "-fno-implicit-module-maps"
|
||||
// CHECK-NEXT: "-fmodule-file=[[PREFIX]]/module-cache{{(_clangcl)?}}/[[HASH_H2]]/header2-{{[A-Z0-9]+}}.pcm"
|
||||
// CHECK-NEXT: "-fmodule-file=[[PREFIX]]/module-cache/[[HASH_H2]]/header2-{{[A-Z0-9]+}}.pcm"
|
||||
// CHECK-NEXT: ],
|
||||
// CHECK-NEXT: "file-deps": [
|
||||
// CHECK-NEXT: "[[PREFIX]]/modules-fmodule-name-no-module-built.m"
|
||||
|
||||
@@ -9,15 +9,10 @@
|
||||
// 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_by_mod_name.json > %t.cdb
|
||||
// RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/modules_cdb_clangcl_by_mod_name.json > %t_clangcl.cdb
|
||||
//
|
||||
// RUN: clang-scan-deps -compilation-database %t.cdb -j 4 -format experimental-full \
|
||||
// RUN: -mode preprocess-minimized-sources -module-name=header1 > %t.result
|
||||
// RUN: cat %t.result | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t.dir --check-prefixes=CHECK %s
|
||||
//
|
||||
// RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 4 -format experimental-full \
|
||||
// RUN: -mode preprocess-minimized-sources -module-name=header1 > %t_clangcl.result
|
||||
// RUN: cat %t_clangcl.result | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t.dir --check-prefixes=CHECK %s
|
||||
|
||||
// CHECK: {
|
||||
// CHECK-NEXT: "modules": [
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
// 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 4 -format experimental-full \
|
||||
// RUN: -mode preprocess-minimized-sources > %t.result
|
||||
@@ -22,10 +21,6 @@
|
||||
// RUN: -generate-modules-path-args -module-files-dir %t.dir/custom \
|
||||
// RUN: -mode preprocess-minimized-sources > %t.result
|
||||
// RUN: cat %t.result | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t.dir --check-prefixes=CHECK,CHECK-CUSTOM %s
|
||||
//
|
||||
// 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 -DPREFIX=%/t.dir --check-prefixes=CHECK,CHECK-NO-ABS %s
|
||||
|
||||
#include "header.h"
|
||||
|
||||
@@ -43,7 +38,7 @@
|
||||
// CHECK-NEXT: "-cc1"
|
||||
// CHECK: "-emit-module"
|
||||
// CHECK-NO-ABS-NOT: "-fmodule-file={{.*}}"
|
||||
// CHECK-ABS: "-fmodule-file=[[PREFIX]]/module-cache{{(_clangcl)?}}/[[HASH_H2_DINCLUDE]]/header2-{{[A-Z0-9]+}}.pcm"
|
||||
// CHECK-ABS: "-fmodule-file=[[PREFIX]]/module-cache/[[HASH_H2_DINCLUDE]]/header2-{{[A-Z0-9]+}}.pcm"
|
||||
// CHECK-CUSTOM: "-fmodule-file=[[PREFIX]]/custom/[[HASH_H2_DINCLUDE]]/header2-{{[A-Z0-9]+}}.pcm"
|
||||
// CHECK-NOT: "-fimplicit-module-maps"
|
||||
// CHECK: "-fmodule-name=header1"
|
||||
@@ -104,7 +99,7 @@
|
||||
// CHECK: "-fno-implicit-modules"
|
||||
// CHECK-NEXT: "-fno-implicit-module-maps"
|
||||
// CHECK-NO-ABS-NOT: "-fmodule-file={{.*}}"
|
||||
// CHECK-ABS-NEXT: "-fmodule-file=[[PREFIX]]/module-cache{{(_clangcl)?}}/[[HASH_H1]]/header1-{{[A-Z0-9]+}}.pcm"
|
||||
// CHECK-ABS-NEXT: "-fmodule-file=[[PREFIX]]/module-cache/[[HASH_H1]]/header1-{{[A-Z0-9]+}}.pcm"
|
||||
// CHECK-CUSTOM-NEXT: "-fmodule-file=[[PREFIX]]/custom/[[HASH_H1]]/header1-{{[A-Z0-9]+}}.pcm"
|
||||
// CHECK-NEXT: ],
|
||||
// CHECK-NEXT: "file-deps": [
|
||||
@@ -124,7 +119,7 @@
|
||||
// CHECK: "-fno-implicit-modules"
|
||||
// CHECK-NEXT: "-fno-implicit-module-maps"
|
||||
// CHECK-NO-ABS-NOT: "-fmodule-file={{.*}},
|
||||
// CHECK-ABS-NEXT: "-fmodule-file=[[PREFIX]]/module-cache{{(_clangcl)?}}/[[HASH_H1]]/header1-{{[A-Z0-9]+}}.pcm"
|
||||
// CHECK-ABS-NEXT: "-fmodule-file=[[PREFIX]]/module-cache/[[HASH_H1]]/header1-{{[A-Z0-9]+}}.pcm"
|
||||
// CHECK-CUSTOM-NEXT: "-fmodule-file=[[PREFIX]]/custom/[[HASH_H1]]/header1-{{[A-Z0-9]+}}.pcm"
|
||||
// CHECK-NEXT: ],
|
||||
// CHECK-NEXT: "file-deps": [
|
||||
@@ -144,7 +139,7 @@
|
||||
// CHECK: "-fno-implicit-modules"
|
||||
// CHECK-NEXT: "-fno-implicit-module-maps"
|
||||
// CHECK-NO-ABS-NOT: "-fmodule-file={{.*}}"
|
||||
// CHECK-ABS-NEXT: "-fmodule-file=[[PREFIX]]/module-cache{{(_clangcl)?}}/[[HASH_H1]]/header1-{{[A-Z0-9]+}}.pcm"
|
||||
// CHECK-ABS-NEXT: "-fmodule-file=[[PREFIX]]/module-cache/[[HASH_H1]]/header1-{{[A-Z0-9]+}}.pcm"
|
||||
// CHECK-CUSTOM-NEXT: "-fmodule-file=[[PREFIX]]/custom/[[HASH_H1]]/header1-{{[A-Z0-9]+}}.pcm"
|
||||
// CHECK-NEXT: ],
|
||||
// CHECK-NEXT: "file-deps": [
|
||||
@@ -164,7 +159,7 @@
|
||||
// CHECK: "-fno-implicit-modules"
|
||||
// CHECK-NEXT: "-fno-implicit-module-maps"
|
||||
// CHECK-NO-ABS-NOT: "-fmodule-file={{.*}}"
|
||||
// CHECK-ABS-NEXT: "-fmodule-file=[[PREFIX]]/module-cache{{(_clangcl)?}}/[[HASH_H1_DINCLUDE]]/header1-{{[A-Z0-9]+}}.pcm"
|
||||
// CHECK-ABS-NEXT: "-fmodule-file=[[PREFIX]]/module-cache/[[HASH_H1_DINCLUDE]]/header1-{{[A-Z0-9]+}}.pcm"
|
||||
// CHECK-CUSTOM-NEXT: "-fmodule-file=[[PREFIX]]/custom/[[HASH_H1_DINCLUDE]]/header1-{{[A-Z0-9]+}}.pcm"
|
||||
// CHECK-NEXT: ],
|
||||
// CHECK-NEXT: "file-deps": [
|
||||
|
||||
@@ -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,19 @@
|
||||
// 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 +28,15 @@
|
||||
//
|
||||
// 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"
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// 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: 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
|
||||
@@ -16,6 +15,3 @@
|
||||
|
||||
// CHECK: static-analyzer_clang.c
|
||||
// CHECK-NEXT: analyze_header_input.h
|
||||
|
||||
// CHECK: static-analyzer_clangcl.c
|
||||
// CHECK-NEXT: analyze_header_input.h
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// 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
|
||||
|
||||
@@ -21,27 +21,3 @@
|
||||
|
||||
// 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
|
||||
|
||||
Reference in New Issue
Block a user