summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2015-07-09 06:58:31 +0000
committerJustin Bogner <mail@justinbogner.com>2015-07-09 06:58:31 +0000
commited9cbe015c1227980bf7be198835cf30a8de9285 (patch)
treee53e6043ee09c9f39eb2a7eaa7f38cfedf7c7829 /clang/lib/Driver/Driver.cpp
parentb41d2d3fa37bc0aa9a90ca759bdf4d872081587c (diff)
downloadbcm5719-llvm-ed9cbe015c1227980bf7be198835cf30a8de9285.tar.gz
bcm5719-llvm-ed9cbe015c1227980bf7be198835cf30a8de9285.zip
Driver: Include the driver arguments in crash reports
Similarly to r231989, the driver arguments can be quite helpful in diagnosing a crash. llvm-svn: 241786
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r--clang/lib/Driver/Driver.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 1914a33c0c8..4edca261661 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -398,6 +398,19 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
return C;
}
+static void printArgList(raw_ostream &OS, const llvm::opt::ArgList &Args) {
+ llvm::opt::ArgStringList ASL;
+ for (const auto *A : Args)
+ A->render(Args, ASL);
+
+ for (auto I = ASL.begin(), E = ASL.end(); I != E; ++I) {
+ if (I != ASL.begin())
+ OS << ' ';
+ Command::printArg(OS, *I, true);
+ }
+ OS << '\n';
+}
+
// When clang crashes, produce diagnostic information including the fully
// preprocessed source file(s). Request that the developer attach the
// diagnostic information to a bug report.
@@ -546,7 +559,9 @@ void Driver::generateCompilationDiagnostics(Compilation &C,
<< "Error generating run script: " + Script + " " + EC.message();
} else {
ScriptOS << "# Crash reproducer for " << getClangFullVersion() << "\n"
- << "# Original command: ";
+ << "# Driver args: ";
+ printArgList(ScriptOS, C.getInputArgs());
+ ScriptOS << "# Original command: ";
Cmd.Print(ScriptOS, "\n", /*Quote=*/true);
Cmd.Print(ScriptOS, "\n", /*Quote=*/true, &CrashInfo);
Diag(clang::diag::note_drv_command_failed_diag_msg) << Script;
OpenPOWER on IntegriCloud