#include "clang/Driver/Types.h"
#include "llvm/ADT/StringSet.h"
+#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Path.h"
}
ArgList *Driver::ParseArgStrings(const char **ArgBegin, const char **ArgEnd) {
+ llvm::PrettyStackTraceString CrashInfo("Command line argument parsing");
ArgList *Args = new ArgList(ArgBegin, ArgEnd);
// FIXME: Handle '@' args (or at least error on them).
}
Compilation *Driver::BuildCompilation(int argc, const char **argv) {
+ llvm::PrettyStackTraceString CrashInfo("Compilation construction");
+
// FIXME: Handle environment options which effect driver behavior,
// somewhere (client?). GCC_EXEC_PREFIX, COMPILER_PATH,
// LIBRARY_PATH, LPATH, CC_PRINT_OPTIONS, QA_OVERRIDE_GCC3_OPTIONS.
}
void Driver::BuildUniversalActions(ArgList &Args, ActionList &Actions) const {
+ llvm::PrettyStackTraceString CrashInfo("Building actions for universal build");
// Collect the list of architectures. Duplicates are allowed, but
// should only be handled once (in the order seen).
llvm::StringSet<> ArchNames;
}
void Driver::BuildActions(ArgList &Args, ActionList &Actions) const {
+ llvm::PrettyStackTraceString CrashInfo("Building compilation actions");
// Start by constructing the list of inputs and their types.
// Track the current user specified (-x) input. We also explicitly
Action *Driver::ConstructPhaseAction(const ArgList &Args, phases::ID Phase,
Action *Input) const {
+ llvm::PrettyStackTraceString CrashInfo("Constructing phase actions");
// Build the appropriate action.
switch (Phase) {
case phases::Link: assert(0 && "link action invalid here.");
}
void Driver::BuildJobs(Compilation &C, const ActionList &Actions) const {
+ llvm::PrettyStackTraceString CrashInfo("Building compilation jobs");
bool SaveTemps = C.getArgs().hasArg(options::OPT_save_temps);
bool UsePipes = C.getArgs().hasArg(options::OPT_pipe);
bool AtTopLevel,
const char *LinkingOutput,
InputInfo &Result) const {
+ llvm::PrettyStackTraceString CrashInfo("Building compilation jobs for action");
if (const InputAction *IA = dyn_cast<InputAction>(A)) {
const char *Name = IA->getInputArg().getValue(C.getArgs());
Result = InputInfo(Name, A->getType(), Name);
const JobAction &JA,
const char *BaseInput,
bool AtTopLevel) const {
+ llvm::PrettyStackTraceString CrashInfo("Computing output path");
// Output to a user requested destination?
if (AtTopLevel) {
if (Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o))
}
const HostInfo *Driver::GetHostInfo(const char *Triple) const {
+ llvm::PrettyStackTraceString CrashInfo("Constructing host");
// Dice into arch, platform, and OS. This matches
// arch,platform,os = '(.*?)-(.*?)-(.*?)'
// and missing fields are left empty.
#include "llvm/ADT/OwningPtr.h"
#include "llvm/Config/config.h"
+#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Path.h"
#include "llvm/System/Signals.h"
int main(int argc, const char **argv) {
llvm::sys::PrintStackTraceOnErrorSignal();
+ llvm::PrettyStackTraceProgram X(argc, argv);
llvm::OwningPtr<DiagnosticClient>
DiagClient(new TextDiagnosticPrinter(llvm::errs()));
if (!C.get())
return 0;
- return C->Execute();
+ int res = C->Execute();
+
+ llvm::llvm_shutdown();
+
+ return res;
}