[ASTMatchers] Output currently processing match and nodes on crash
authorNathan James <n.james93@hotmail.co.uk>
Mon, 21 Mar 2022 19:13:35 +0000 (19:13 +0000)
committerNathan James <n.james93@hotmail.co.uk>
Mon, 21 Mar 2022 19:13:36 +0000 (19:13 +0000)
commitd89f9e963e4979466193dc6a15fe091bf7ca5c47
tree02dac84b0cf14fae559f62c37e6fe60d0894885c
parent6b2335cace8378f499b401bcda3f6a862812539a
[ASTMatchers] Output currently processing match and nodes on crash

Create a PrettyStackTraceEvent that will dump the current `MatchCallback` id as well as the `BoundNodes` if the 'run' method of a `MatchCallback` results in a crash.
The purpose of this is sometimes clang-tidy checks can crash in the `check` method. And in a large codebase with alot of checks enabled and in a release build, it can be near impossible to figure out which check as well as the source code that caused the crash. Without that information a reproducer is very hard to create.
This is a more generalised version of D118520 which has a nicer integration and should be useful to clients other than clang-tidy.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D120185
clang-tools-extra/docs/ReleaseNotes.rst
clang/lib/ASTMatchers/ASTMatchFinder.cpp
clang/unittests/ASTMatchers/ASTMatchersInternalTest.cpp