diff options
author | Justin Bogner <mail@justinbogner.com> | 2014-10-20 22:47:23 +0000 |
---|---|---|
committer | Justin Bogner <mail@justinbogner.com> | 2014-10-20 22:47:23 +0000 |
commit | 659ecc3120eb7797ce8ec85d2748e3b2f5065a5a (patch) | |
tree | f09aa7809cdbf3178db661386ef7570ef53bac39 /clang/lib/Driver/Driver.cpp | |
parent | cdb72f369f94be40a4f2651ac36f65caa4034bb5 (diff) | |
download | bcm5719-llvm-659ecc3120eb7797ce8ec85d2748e3b2f5065a5a.tar.gz bcm5719-llvm-659ecc3120eb7797ce8ec85d2748e3b2f5065a5a.zip |
Driver: Consolidate the logic for naming the module crashdump cache
List the module cache we use for crashdumps as a tempfile. This
simplifies how we pick up this directory when generating the actual
crash diagnostic and removes some duplicate logic.
llvm-svn: 220241
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r-- | clang/lib/Driver/Driver.cpp | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 30ae6ffebcb..2e9fcfe0ef5 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -529,27 +529,22 @@ void Driver::generateCompilationDiagnostics(Compilation &C, "PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:\n" "Preprocessed source(s) and associated run script(s) are located at:"; - for (const char *TempFile : TempFiles) + SmallString<128> VFS; + for (const char *TempFile : TempFiles) { Diag(clang::diag::note_drv_command_failed_diag_msg) << TempFile; + if (StringRef(TempFile).endswith(".cache")) { + // In some cases (modules) we'll dump extra data to help with reproducing + // the crash into a directory next to the output. + VFS = llvm::sys::path::filename(TempFile); + llvm::sys::path::append(VFS, "vfs", "vfs.yaml"); + } + } // Assume associated files are based off of the first temporary file. const char *MainFile = TempFiles[0]; - std::string Script = StringRef(MainFile).rsplit('.').first; - - // In some cases (modules) we'll dump extra data to help with reproducing - // the crash into a directory next to the output. - // FIXME: We should be able to generate these as extra temp files now that it - // won't mess up the run script. - SmallString<128> VFS; - if (llvm::sys::fs::exists(Script + ".cache")) { - Diag(clang::diag::note_drv_command_failed_diag_msg) << Script + ".cache"; - VFS = llvm::sys::path::filename(Script + ".cache"); - llvm::sys::path::append(VFS, "vfs", "vfs.yaml"); - } - + std::string Script = StringRef(MainFile).rsplit('.').first.str() + ".sh"; std::error_code EC; - Script += ".sh"; llvm::raw_fd_ostream ScriptOS(Script, EC, llvm::sys::fs::F_Excl); if (EC) { Diag(clang::diag::note_drv_command_failed_diag_msg) |