[PATCH] D118520: [clang-tidy] Output currently processing check and nodes on crash

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 28 17:32:54 PST 2022


njames93 created this revision.
njames93 added reviewers: aaron.ballman, alexfh, JonasToth, LegalizeAdulthood.
Herald added subscribers: carlosgalvezp, xazax.hun.
njames93 requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

Create a PrettyStackTraceEvent that will dump the current check as well as the bound nodes if a `ClangTidyCheck::check` call results in a segfault.
This should help massively in debugging random crashes users may be experiencing where the check causing the crash is unknown as well as the source location of the crash.

There are definitely some issues to iron out here as well as figuring out how to effectively test an error state.

I did force a check to assert and got this output:

  [build] Stack dump:
  [build] 0.	Program arguments: clang-tidy llvm-project/build/Release/tools/clang/tools/extra/test/clang-tidy/checkers/Output/modernize-concat-nested-namespaces.cpp.tmp.cpp -fix --checks=-*,modernize-concat-nested-namespaces -header-filter=.* -config={} -- -I /home/nathan/src/llvm-project/build/Release/tools/clang/tools/extra/test/clang-tidy/checkers/Output -std=c++17 -nostdinc++
  [build] 1.	Processing check modernize-concat-nested-namespaces
  [build] Node 'namespace' - NamespaceDecl 0x58f780 <llvm-project/build/Release/tools/clang/tools/extra/test/clang-tidy/checkers/Output/modernize-concat-nested-namespaces.h:1:1, line:6:1> line:1:11 nn1
  [build] `-NamespaceDecl 0x58f7f0 <line:2:1, line:5:1> line:2:11 nn2
  [build]   `-FunctionDecl 0x58f8a8 <line:4:1, col:8> col:6 t 'void ()'
  [build]
  [build] 2.	<eof> parser at end of file


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118520

Files:
  clang-tools-extra/clang-tidy/ClangTidyCheck.cpp
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118520.404202.patch
Type: text/x-patch
Size: 5389 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220129/caf47764/attachment.bin>


More information about the cfe-commits mailing list