[clang] [clang][deps] Support single-file mode for all formats (PR #88764)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 15 11:42:26 PDT 2024


================
@@ -1,23 +1,10 @@
 // RUN: rm -rf %t
 // RUN: split-file %s %t
 
-//--- missing_tu.json.in
-[{
-  "directory": "DIR",
-  "command": "clang -fsyntax-only DIR/missing_tu.c",
-  "file": "DIR/missing_tu.c"
-}]
-//--- missing_header.json.in
-[{
-  "directory": "DIR",
-  "command": "clang -fsyntax-only DIR/missing_header.c",
-  "file": "DIR/missing_header.c"
-}]
 //--- missing_header.c
 #include "missing.h"
 
-// RUN: sed -e "s|DIR|%/t|g" %t/missing_tu.json.in > %t/missing_tu.json
-// RUN: not clang-scan-deps -compilation-database %t/missing_tu.json 2>%t/missing_tu.errs
+// RUN: not clang-scan-deps -- "clang" %t/missing_tu.c 2>%t/missing_tu.errs
----------------
jansvoboda11 wrote:

LIT complains about unquoted `clang` in attempt to nudge people towards using `%clang`. That, however, adds a bunch of default flags to the invocation and I'm not sure I want those in our scanner tests (especially when testing the search path optimization for example).

The "-fsyntax-only" flag was removed because it's unnecessary (it was originally used to prevent the scanner actually generating compilation output files I think) and because it implies no output file (which the per-file mode currently requires). Since the scanner is intended to be run on actual compilation jobs, I think it's even desirable removing stuff like "-fsyntax-only".

https://github.com/llvm/llvm-project/pull/88764


More information about the cfe-commits mailing list