Page MenuHomePhabricator

[libclang] Avoid builtin trap for __debug parser_crash pragma
AbandonedPublic

Authored by arphaman on Dec 21 2017, 3:16 PM.

Details

Reviewers
benlangmuir
Summary

This patch allows libclang to report a parser crash that's caused by #pragma clang __debug parser_crash without using the LLVM_BUILTIN_TRAP. Instead a new flag in PPOpts is used to let libclang know that a simulated crash has occurred. This flag allows clients to test that libclang can report a parser crash (CXError_Crash) when libclang is ran under a debugger that breaks on LLVM_BUILTIN_TRAP.

Diff Detail

Repository
rC Clang

Event Timeline

arphaman created this revision.Dec 21 2017, 3:16 PM

Did you consider just using a different pragma that triggers this behaviour instead of avoiding the crash? I don't really have a strong preference but I'd be interested to hear what you think the pros/cons are.

lib/Parse/ParseDecl.cpp
5657

This should return immediately (and keep exiting until ~ParseAST) or it won't really behave like a trap.

arphaman abandoned this revision.Dec 21 2017, 4:23 PM

It turns out there's already something that works much better: #pragma clang __debug handle_crash. Sorry about the redundant patch!