[PATCH] D137534: [C++20] [Modules] [ClangScanDeps] Allow clang-scan-deps to without specified compilation database in P1689 (3/4)

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 22 18:44:53 PST 2022


ChuanqiXu added a comment.

> Why is it necessary to add new command-line flags for this? Can't the input and output be inherited from the specified Clang command line? Would such command line make sense?

CMake wants to query the dependency information for a single file from time to time due to its current structure. And according to @ben.boeckel , the compilation database can't do very well for the files which don't exist during the configuration time. (Maybe @ben.boeckel can add some additional information).

For the reason why we need `--p1689-targeted-file-name` and  `--p1689-targeted-output` is that `FixedCompilationDatabase` wouldn't generate the input and output entry from the command line. See the inline comments for example. I feel it is easier and simpler to add 2 flags for it. I add the prefix `-p1689` to tell all other users to not use it unintentionally.



================
Comment at: clang/lib/Tooling/CompilationDatabase.cpp:376-378
-  CompileCommands.emplace_back(Directory, StringRef(),
-                               std::move(ToolCommandLine),
-                               StringRef());
----------------
Here: we can find the file path and the output entry are left empty for the FixedCompilationDatabase.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137534/new/

https://reviews.llvm.org/D137534



More information about the cfe-commits mailing list