[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
Wed Jan 4 01:29:09 PST 2023
ChuanqiXu added inline comments.
================
Comment at: clang/tools/clang-scan-deps/ClangScanDeps.cpp:571-581
+
+ // FIXME: createInvocation will drop the `-o` option since it requires
+ // `-fsyntax-only`. So here we try to parse the output file manually.
+ auto CommandLineIter =
+ std::find(CommandLine.rbegin(), CommandLine.rend(), StringRef("-o"));
+ if (CommandLineIter == CommandLine.rend() ||
+ --CommandLineIter == CommandLine.rend()) {
----------------
Here is the corresponding code: https://github.com/llvm/llvm-project/blob/0e11d65a58da32311b562ecea2b5ba9d4d655659/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp#L39-L43. There is another FIXME.
Simply, we will lost the output file by using `createInvocation` and I feel it is not easy to fix. Then I feel it is not too bad to parse `-o` manually here if we document it clearly. I understand the current style will miss some cases like using `-output=`, `-output` instead of `-o` or missing `-o`. But I don't feel too bad for it.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137534/new/
https://reviews.llvm.org/D137534
More information about the cfe-commits
mailing list