This is an archive of the discontinued LLVM Phabricator instance.

[Clang] Don't let gen crash diagnostics fail when '#pragma clang __debug crash' is used
ClosedPublic

Authored by aganea on Feb 5 2020, 9:54 AM.

Details

Summary

When #pragma clang __debug crash is used, currently Driver::generateCompilationDiagnostics() doesn't work. The clang -E created for diagnostics would crash again, because it reaches Pragma.cpp, L1043 again.

We simply disable the intended crashing behavior with a new cc1 flag -disable-pragma-debug-crash.

Notes:

  • #pragma clang __debug llvm_report_fatal isn't currently tested below, because it needs exit() to be handled differently in -fintegrated-cc1 mode.
  • This patch is also needed to further test that -MF is removed from the gen crash diagnostic cmd-line (currently not the case).

This patch is point 1. in D73742

Diff Detail

Event Timeline

aganea created this revision.Feb 5 2020, 9:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 5 2020, 9:54 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
hans accepted this revision.Feb 6 2020, 12:59 AM
hans added inline comments.
clang/lib/Lex/Pragma.cpp
1106–1107

Maybe also add to the description that you're removing this one. And does this mean we can drop the CrashRecoveryContext.h include?

This revision is now accepted and ready to land.Feb 6 2020, 12:59 AM
hans added inline comments.Feb 6 2020, 2:46 AM
clang/lib/Lex/Pragma.cpp
1106–1107

Oh, I see, that's in D74063.

This revision was automatically updated to reflect the committed changes.
aganea marked 2 inline comments as done.

FYI, temporarily reverted this in fafddbd956dbe439787f6d717c247e648bb07ff5 since it was causing failures in Clang :: Driver/crash-report.c. I didn't see the failure on all buildbots (otherwise I could have just marked it XFAIL), though I may have been looking in the wrong place.

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

Logs:

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'
^