diff options
| author | Alex Lorenz <arphaman@gmail.com> | 2018-04-06 18:30:14 +0000 | 
|---|---|---|
| committer | Alex Lorenz <arphaman@gmail.com> | 2018-04-06 18:30:14 +0000 | 
| commit | 1e720916faa6f632ab8c77fb46f055f1dace96f1 (patch) | |
| tree | a3c81a0395065a49a0eb5e0064f088a7070d84dc /clang/lib | |
| parent | 181501a6b95116f87bb850dc410b855d7ebedc0b (diff) | |
| download | bcm5719-llvm-1e720916faa6f632ab8c77fb46f055f1dace96f1.tar.gz bcm5719-llvm-1e720916faa6f632ab8c77fb46f055f1dace96f1.zip  | |
Generate Libclang invocation reproducers using a new -cc1gen-reproducer
driver option
This commit is a follow up to the previous work that recorded Libclang invocations
into temporary files: r319702.
It adds a new -cc1 mode to clang: -cc1gen-reproducer. The goal of this mode is to generate
Clang reproducer files for Libclang tool invocation. The JSON format in the invocation
files is not really intended to be stable, so Libclang and Clang should be of the same version
when generating reproducers.
The new mode emits the information about the temporary files and Libclang-specific information
to stdout using JSON.
rdar://35322614
Differential Revision: https://reviews.llvm.org/D40983
llvm-svn: 329442
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Driver/Driver.cpp | 12 | 
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 1a62192c1f0..f02230d3364 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -1111,8 +1111,9 @@ bool Driver::getCrashDiagnosticFile(StringRef ReproCrashFilename,  // 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. -void Driver::generateCompilationDiagnostics(Compilation &C, -                                            const Command &FailingCommand) { +void Driver::generateCompilationDiagnostics( +    Compilation &C, const Command &FailingCommand, +    StringRef AdditionalInformation, CompilationDiagnosticReport *Report) {    if (C.getArgs().hasArg(options::OPT_fno_crash_diagnostics))      return; @@ -1238,6 +1239,8 @@ void Driver::generateCompilationDiagnostics(Compilation &C,    SmallString<128> ReproCrashFilename;    for (const char *TempFile : TempFiles) {      Diag(clang::diag::note_drv_command_failed_diag_msg) << TempFile; +    if (Report) +      Report->TemporaryFiles.push_back(TempFile);      if (ReproCrashFilename.empty()) {        ReproCrashFilename = TempFile;        llvm::sys::path::replace_extension(ReproCrashFilename, ".crash"); @@ -1266,6 +1269,11 @@ void Driver::generateCompilationDiagnostics(Compilation &C,      ScriptOS << "# Original command: ";      Cmd.Print(ScriptOS, "\n", /*Quote=*/true);      Cmd.Print(ScriptOS, "\n", /*Quote=*/true, &CrashInfo); +    if (!AdditionalInformation.empty()) +      ScriptOS << "\n# Additional information: " << AdditionalInformation +               << "\n"; +    if (Report) +      Report->TemporaryFiles.push_back(Script);      Diag(clang::diag::note_drv_command_failed_diag_msg) << Script;    }  | 

