[PATCH] D69825: [Clang][Driver] Bypass cc1 process and re-enter driver main

Alexandre Ganea via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 5 08:37:56 PST 2019


aganea added a comment.

In D69825#1733958 <https://reviews.llvm.org/D69825#1733958>, @thakis wrote:

> Thanks for sending this out!
>
> Instead of the dynamic lookup of that symbol, what do you think about passing in the function via a normal api? That way, the type checker and linker help us keep things working; dynamic lookup is always a bit subtle and hard to grep for. (llvm-cs wouldn't know about the current use, for example.) See https://reviews.llvm.org/D69848 for a rough sketch.


Absolutely, it make more sense, I can't remember why I used the dynamic lookup :-( I have this patch lying around since last year.

> For robust crash handling, I figured on non-win we'd have a signal handler that on signal self-execs with a "actually, do use a cc1 process" and then use the existing crash machinery, but maybe that's not needed.

Right now on Windows I'm doing about that, not in the exception handler, but a bit later on in `clang/lib/Driver/Driver.cpp, L1338`. The worse that can happen would be a memory corruption, which would crash `Driver::generateCompilationDiagnostics()` and prevent displaying the preprocessed file and the cmd-line. But you would still see the callstack (which is rendered now in the SEH, see `llvm/lib/Support/CrashRecoveryContext.cpp, L194` - I still need to hook that up for the posix implementation). Ideally we could render some of these things in advance (or pre-allocate memory at least) to minimize the risk of a crash when displaying crash diagnostics.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69825





More information about the cfe-commits mailing list