[PATCH] D94472: [clang][cli] Command line round-trip for HeaderSearch options
Duncan P. N. Exon Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 29 07:50:36 PST 2021
dexonsmith added inline comments.
================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:684-685
+ if (!GeneratedStringsEqual)
+ llvm::report_fatal_error("Mismatch between arguments generated during "
+ "round-trip");
+
----------------
jansvoboda11 wrote:
> dexonsmith wrote:
> > Another option vs. report_fatal_error would be to create (fatal) clang error diagnostics. That applies here, and to my previous comments. WDYT? (@Bigcheese, any thoughts?)
> >
> > Also, I think `-round-trip-args-debug` might not be super discoverable. Maybe we can add a comment in the code where the errors are reported suggesting adding that.
> If we decide to go with custom diagnostics instead of just using `llvm::errs` and `llvm::report_fatal_error`, we'd need to instantiate a custom `DiagnosticsEngine` here in `RoundTrip`, because we cannot rely on clients passing us reasonable `Diags`.
>
> One such example is `CompilerInvocationTest`, where we don't care what diagnostics get emitted (by using `TextDiagnosticBuffer` consumer). The errors we're emitting here would be still useful to see when testing though.
I'm not entirely following why this would need a custom Diags. If the client wants to ignore diagnostics that should be up to the client, especially in clang-as-a-library situations. In fact, using `errs` or `dbgs` at all is pretty iffy when clang is used as a library.
For CompilerInvocationTest, I imagine we could change the consumer / test fixture / etc. somehow to capture this case.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94472/new/
https://reviews.llvm.org/D94472
More information about the llvm-commits
mailing list