This shows the basic idea, using command line arguments. Further work
would be done to plumb through the argument to other tools (llc, lli).
This wouldn't handle things like external scripts (bugpoint's
-compile-command feature) which would need to explicitly opt-in by
passing the argument to any LLVM tools they invoke to avoid the
performance penalty of symbolication.
Alternatively (as suggested by chandlerc@) an environment variable would
be used. This would allow the option to pass transparently through user
scripts, pass to compilers if they happened to be LLVM-ish, etc.
I worry a bit about using cl::opt in the crash handling code - LLVM
might crash early, perhaps before the cl::opt is properly initialized?
Or at least before arguments have been parsed?
I shyed away from doing this with an environment variable when I
realized that would require copying the existing environment and
appending the env variable of interest. But it seems there's no existing
LLVM API for accessing the environment (even the Support tests for
process launching have their own ifdefs for getting the environment). It
could be added, but seemed like a higher bar/untested codepath to
actually add environment variables.
Anyway - so looking for folks thoughts/preferences/etc. This change as
is does fix the original issue I came across, with this change
test/BugPoint/metadata.ll goes from 1m34s to 6.5s (& I think it hits all
the other bugpoint tests too - so I guess they don't have loads of
coverage on the different programs that can be executed, etc)
Especially because this is initialized to false initially, I think it'll be fine even if we crash in weird places.