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

Hans Wennborg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 15 01:48:33 PST 2019


hans added a comment.

Thanks for the update! I think calling ExecuteCC1Tool instead of main is an improvement (there's no need to think about "re-entering" the process, it's really just a function call). I still don't see why it needs to go through a function pointer. I was hoping the code could be something like:

In Command::Execute:
if the tool we're going to execute is cc1 (not the gen-reproducer though),
then instead of forking, call ExecuteCC1Tool with the args directly (inside a context so that we can recover from a crash)

Do you think that's achievable?



================
Comment at: clang/include/clang/Driver/Driver.h:209
+  typedef int(*CC1ToolFunc)(ArrayRef<const char *> argv);
+  static LLVM_THREAD_LOCAL CC1ToolFunc CC1Main;
+
----------------
Why do we need a variable for this? Couldn't the code just invoke the function directly?


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

https://reviews.llvm.org/D69825





More information about the cfe-commits mailing list