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()) {
----------------
ChuanqiXu wrote:
> 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.
`createInvocation` will be helpful to recognize many cases, e.g., `-MF` in
https://reviews.llvm.org/D139168. I feel it'll be worse if we don't use
`createInvocation `.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137534/new/
https://reviews.llvm.org/D137534
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits