Revert "[Clang][Driver] Remove -M group options ..." and "[Clang] Avoid…

Authored by rupprecht on Feb 6 2020, 5:48 PM.


Revert "[Clang][Driver] Remove -M group options ..." and "[Clang] Avoid crashing when generating crash diagnostics when '#pragma clang __debug ..."

This reverts commits f41ec709d9d388dc43469e6ac7f51b6313f7e4af and 5fedc2b410853a6aef05e8edf19ebfc4e071e28f. On some buildbots, Clang :: Driver/crash-report.c is broken with:

Command Output (stderr):
/home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/crash-report.c:48:11: error: CHECK: expected string not found in input
// CHECK: Preprocessed source(s) and associated run script(s) are located at:
<stdin>:1:1: note: scanning from here
/home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/crash-report.c:50:1: error: unknown type name 'BAZ'

Example: http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/21321/steps/test-stage1-compiler/logs/stdio

Event Timeline

aganea added a subscriber: aganea.Feb 6 2020, 6:07 PM

Yeah I was looking at that now. It seems llvm_unreachable doesn't do anything on some compilers (older gcc?)

It's also dependent on the build mode: https://github.com/llvm/llvm-project/blob/master/llvm/include/llvm/Support/ErrorHandling.h#L134

IIUC, llvm_unreachable is meant for truly unreachable places in code [e.g. it becomes an optimizer hint in release builds], whereas report_fatal_error is meant to always report an error and crash regardless of build configuration.

aganea added a comment.Feb 6 2020, 7:14 PM

Yes you're right, I am always running locally with assertions, I didn't realize my usage of the #pragma clang __debug llvm_unreachable in the test is incorrect without REQUIRES: asserts. I'll remove the llvm_unreachable part from the patch for now and re-land.