diff options
author | Serge Pavlov <sepavloff@gmail.com> | 2017-05-11 08:25:22 +0000 |
---|---|---|
committer | Serge Pavlov <sepavloff@gmail.com> | 2017-05-11 08:25:22 +0000 |
commit | 97bb85cddc537798fec107f86d041ebd34d76a48 (patch) | |
tree | 80ad25f2d388b068f514f8c0783575e748d81663 /tools | |
parent | 389e123d9f2ffdd30fe124270b7f4214bdcd0e5f (diff) |
Reverted r302775
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302777 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/driver/driver.cpp | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp index 4bd3b228d0..626d006ac0 100644 --- a/tools/driver/driver.cpp +++ b/tools/driver/driver.cpp @@ -454,41 +454,40 @@ int main(int argc_, const char **argv_) { SetBackdoorDriverOutputsFromEnvVars(TheDriver); std::unique_ptr<Compilation> C(TheDriver.BuildCompilation(argv)); - int Res = 1; - if (C.get()) { - SmallVector<std::pair<int, const Command *>, 4> FailingCommands; + int Res = 0; + SmallVector<std::pair<int, const Command *>, 4> FailingCommands; + if (C.get()) Res = TheDriver.ExecuteCompilation(*C, FailingCommands); - // Force a crash to test the diagnostics. - if (TheDriver.GenReproducer) { - Diags.Report(diag::err_drv_force_crash) + // Force a crash to test the diagnostics. + if (TheDriver.GenReproducer) { + Diags.Report(diag::err_drv_force_crash) << !::getenv("FORCE_CLANG_DIAGNOSTICS_CRASH"); - // Pretend that every command failed. - FailingCommands.clear(); - for (const auto &J : C->getJobs()) - if (const Command *C = dyn_cast<Command>(&J)) - FailingCommands.push_back(std::make_pair(-1, C)); - } + // Pretend that every command failed. + FailingCommands.clear(); + for (const auto &J : C->getJobs()) + if (const Command *C = dyn_cast<Command>(&J)) + FailingCommands.push_back(std::make_pair(-1, C)); + } - for (const auto &P : FailingCommands) { - int CommandRes = P.first; - const Command *FailingCommand = P.second; - if (!Res) - Res = CommandRes; - - // If result status is < 0, then the driver command signalled an error. - // If result status is 70, then the driver command reported a fatal error. - // On Windows, abort will return an exit code of 3. In these cases, - // generate additional diagnostic information if possible. - bool DiagnoseCrash = CommandRes < 0 || CommandRes == 70; + for (const auto &P : FailingCommands) { + int CommandRes = P.first; + const Command *FailingCommand = P.second; + if (!Res) + Res = CommandRes; + + // If result status is < 0, then the driver command signalled an error. + // If result status is 70, then the driver command reported a fatal error. + // On Windows, abort will return an exit code of 3. In these cases, + // generate additional diagnostic information if possible. + bool DiagnoseCrash = CommandRes < 0 || CommandRes == 70; #ifdef LLVM_ON_WIN32 - DiagnoseCrash |= CommandRes == 3; + DiagnoseCrash |= CommandRes == 3; #endif - if (DiagnoseCrash) { - TheDriver.generateCompilationDiagnostics(*C, *FailingCommand); - break; - } + if (DiagnoseCrash) { + TheDriver.generateCompilationDiagnostics(*C, *FailingCommand); + break; } } |