[PATCH] D97265: [clang] Allow clang-check to customize output file name
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 23 06:12:07 PST 2021
sammccall added a comment.
It looks like either we're in syntax-only mode (and -o will be ignored regardless) or we're in analyzer mode, and want -o.
It seems tempting to just stop stripping it in this case, but then we'll end up with -o foo.o -o foo.html, which is no good.
So the logic of this patch seems sound.
---
I wonder about the CLI though, I think the user will have to pass four flags with different styles to use it!
`clang-check -analyze ... -extra-arg=-Xanalyzer -extra-arg=-analyzer-output=html -output=html_output ....`
(Maybe -analyze should imply -Xanalyzer, and analyzer-output should be promoted to a real flag without the legacy plist default...)
================
Comment at: clang/test/Tooling/clang-check-reset-o.cpp:10
+// CHECK: {{qwerty}}
+// CHECK: C++ requires
+invalid;
----------------
it looks like you're checking for the analysis finding in stdout of clang-check, rather than in the generated html file.
So i'm not sure this test verifies it actually works!
================
Comment at: clang/tools/clang-check/ClangCheck.cpp:80
+static cl::opt<std::string>
+ Output("output", cl::desc(Options.getOptionHelpText(options::OPT_o)),
+ cl::cat(ClangCheckCategory));
----------------
I think this should have a name with clear semantics like -analyzer-output-file (and only be used in analyzer mode).
While it does just append -o to the command-line, I think it will confuse users to treat it as a generic output flag.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97265/new/
https://reviews.llvm.org/D97265
More information about the cfe-commits
mailing list