diff options
author | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2017-04-12 21:46:20 +0000 |
---|---|---|
committer | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2017-04-12 21:46:20 +0000 |
commit | f2ee5f1a8ec33b9bab98782596fe6872a6da7cc0 (patch) | |
tree | a9f56ab370579b22e9f2feaad036a5e1a026b718 /tools/driver | |
parent | 5e8a35ff84263fd2636595b2cb65054c538a78a2 (diff) |
[Driver] Add compiler option to generate a reproducer
One way to currently test the reproducers is to setup
"FORCE_CLANG_DIAGNOSTICS_CRASH=1" before invoking clang. This simulates
a crash and produces the same contents needed by the reproducers. The
reproducers are specially useful when triaging Modules issues, not only
on crashes, but also for reproducing misleading warnings, errors, etc.
Add a '-gen-reproducer' driver option to clang (or any similar name) and
give users a flag option.
Note that clang already has a -fno-crash-diagnostics, which disables the
crash reproducers. I've decided not to propose "-fcrash-diagnostics"
since it doesn't convey the ideia of reproduction despite a crash.
rdar://problem/24114619
Differential Revision: https://reviews.llvm.org/D27604
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300109 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/driver')
-rw-r--r-- | tools/driver/driver.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp index 6161302862..626d006ac0 100644 --- a/tools/driver/driver.cpp +++ b/tools/driver/driver.cpp @@ -460,8 +460,9 @@ int main(int argc_, const char **argv_) { Res = TheDriver.ExecuteCompilation(*C, FailingCommands); // Force a crash to test the diagnostics. - if (::getenv("FORCE_CLANG_DIAGNOSTICS_CRASH")) { - Diags.Report(diag::err_drv_force_crash) << "FORCE_CLANG_DIAGNOSTICS_CRASH"; + if (TheDriver.GenReproducer) { + Diags.Report(diag::err_drv_force_crash) + << !::getenv("FORCE_CLANG_DIAGNOSTICS_CRASH"); // Pretend that every command failed. FailingCommands.clear(); |