<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/82521>82521</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Running a new `clang-tidy` check fails with compilation database
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
moshe-foreflight
</td>
</tr>
</table>
<pre>
I am working on a new `clang-tidy` check and when running it against a compilation database, it fails. I am able to successfully build my check and the tests run (and fail) as expected. What might I do to debug or fix this issue?
Here's my stack trace:
```
Stack dump:
0. Program arguments: /Users/moshe/Developer/llvm-project/build/bin/clang-tidy --checks=readability-inject-singleton-properties /path/to/source-file.m -p .
#0 0x000000010586b774 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x100abf774)
#1 0x000000010586bd58 PrintStackTraceSignalHandler(void*) (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x100abfd58)
#2 0x0000000105869968 llvm::sys::RunSignalHandlers() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x100abd968)
#3 0x000000010586d150 SignalHandler(int) (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x100ac1150)
#4 0x000000018ad06a24 (/usr/lib/system/libsystem_platform.dylib+0x18042ea24)
#5 0x000000018acd7c28 (/usr/lib/system/libsystem_pthread.dylib+0x1803ffc28)
#6 0x000000018abe5ae8 (/usr/lib/system/libsystem_c.dylib+0x18030dae8)
#7 0x000000018abe4e44 (/usr/lib/system/libsystem_c.dylib+0x18030ce44)
#8 0x0000000108e59354 llvm::BitstreamWriter::~BitstreamWriter() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x1040ad354)
#9 0x0000000108e49548 llvm::BitstreamWriter::~BitstreamWriter() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x10409d548)
#10 0x0000000108fae8b8 (anonymous namespace)::SDiagsWriter::SharedState::~SharedState() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x1042028b8)
#11 0x0000000108fae828 (anonymous namespace)::SDiagsWriter::SharedState::~SharedState() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x104202828)
#12 0x0000000108fadbe8 std::__1::__shared_ptr_emplace<(anonymous namespace)::SDiagsWriter::SharedState, std::__1::allocator<(anonymous namespace)::SDiagsWriter::SharedState>>::__on_zero_shared() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x104201be8)
#13 0x0000000105650df8 std::__1::__shared_count::__release_shared[abi:v160006]() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x1008a4df8)
#14 0x0000000105650d98 std::__1::__shared_weak_count::__release_shared[abi:v160006]() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x1008a4d98)
#15 0x0000000108faee84 std::__1::shared_ptr<(anonymous namespace)::SDiagsWriter::SharedState>::~shared_ptr[abi:v160006]() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x104202e84)
#16 0x0000000108faee18 std::__1::shared_ptr<(anonymous namespace)::SDiagsWriter::SharedState>::~shared_ptr[abi:v160006]() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x104202e18)
#17 0x0000000108fbaf0c (anonymous namespace)::SDiagsWriter::~SDiagsWriter() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x10420ef0c)
#18 0x0000000108faceb8 (anonymous namespace)::SDiagsWriter::~SDiagsWriter() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x104200eb8)
#19 0x0000000108facee4 (anonymous namespace)::SDiagsWriter::~SDiagsWriter() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x104200ee4)
#20 0x00000001066f7b68 std::__1::default_delete<clang::DiagnosticConsumer>::operator()[abi:v160006](clang::DiagnosticConsumer*) const (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x10194bb68)
#21 0x00000001066ec088 std::__1::unique_ptr<clang::DiagnosticConsumer, std::__1::default_delete<clang::DiagnosticConsumer>>::reset[abi:v160006](clang::DiagnosticConsumer*) (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x101940088)
#22 0x00000001066f7604 std::__1::unique_ptr<clang::DiagnosticConsumer, std::__1::default_delete<clang::DiagnosticConsumer>>::~unique_ptr[abi:v160006]() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x10194b604)
#23 0x00000001066eb9d0 std::__1::unique_ptr<clang::DiagnosticConsumer, std::__1::default_delete<clang::DiagnosticConsumer>>::~unique_ptr[abi:v160006]() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x10193f9d0)
#24 0x0000000108e6dbf8 clang::ChainedDiagnosticConsumer::~ChainedDiagnosticConsumer() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x1040c1bf8)
#25 0x0000000108e6d9e4 clang::ChainedDiagnosticConsumer::~ChainedDiagnosticConsumer() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x1040c19e4)
#26 0x0000000108e6da10 clang::ChainedDiagnosticConsumer::~ChainedDiagnosticConsumer() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x1040c1a10)
#27 0x00000001066f7b68 std::__1::default_delete<clang::DiagnosticConsumer>::operator()[abi:v160006](clang::DiagnosticConsumer*) const (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x10194bb68)
#28 0x00000001066ec088 std::__1::unique_ptr<clang::DiagnosticConsumer, std::__1::default_delete<clang::DiagnosticConsumer>>::reset[abi:v160006](clang::DiagnosticConsumer*) (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x101940088)
#29 0x00000001066eb69c clang::DiagnosticsEngine::setClient(clang::DiagnosticConsumer*, bool) (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x10193f69c)
#30 0x00000001066eb894 clang::DiagnosticsEngine::~DiagnosticsEngine() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x10193f894)
#31 0x00000001066ebad8 clang::DiagnosticsEngine::~DiagnosticsEngine() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x10193fad8)
#32 0x000000010688b65c llvm::RefCountedBase<clang::DiagnosticsEngine>::Release() const (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x101adf65c)
#33 0x000000010688b5a4 llvm::IntrusiveRefCntPtrInfo<clang::DiagnosticsEngine>::release(clang::DiagnosticsEngine*) (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x101adf5a4)
#34 0x000000010688b57c llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine>::release() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x101adf57c)
#35 0x000000010688b534 llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine>::~IntrusiveRefCntPtr() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x101adf534)
#36 0x00000001068867b0 llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine>::~IntrusiveRefCntPtr() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x101ada7b0)
#37 0x0000000106885174 clang::tooling::ToolInvocation::run() (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x101ad9174)
#38 0x0000000106887bb8 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x101adbbb8)
#39 0x00000001068a7d1c clang::tidy::runClangTidy(clang::tidy::ClangTidyContext&, clang::tooling::CompilationDatabase const&, llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>, bool, bool, llvm::StringRef) (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x101afbd1c)
#40 0x00000001069159c4 clang::tidy::clangTidyMain(int, char const**) (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x101b699c4)
#41 0x0000000104db1044 main (/Users/moshe/Developer/llvm-project/build/bin/clang-tidy+0x100005044)
#42 0x000000018a97ff28
fish: Job 1, '~/Developer/llvm-project/build/…' terminated by signal SIGABRT (Abort)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWl1v2zrS_jXMDZGAor6oC184Tv2evMBii6aLcxnwY2RzK5NekkrqvchvX0iya1Nxc3LaqpuzaGDEtkTOPM_DGQ4tknuvVwZghvJrlN9c8DasrZttrF_DZW0d1I1ercOFsGo3u8V8gx-t-6TNCluDOTbwiFFBZMPN6jJotUMFwXIN8hPmRuHHNRjsWmO6DjpgvuLa-IA5lnaz1Q0P2hqseOCCe0B00TWquW78Fe6dcdEADhb7Vkrwvm6bZodFqxuFN7sTR2ENOIAPvvOGEWXdxc4QohXmHsPnLcgA6gr_vuYBbzpO-BYr2xlXINoVtg7X-jMOa-2x9r4FlC4RuUFkPvz_DRwgWvrOsQ9cfsLBcQkonZ-2QgXZv_qvd31D1W62X9qRK0Sq986uXMfPrdoNmOBROseILv_hwXlEl73-iC5v4AEauwWH6LJpHjaXW2f_CTIguuxV6N61QXR5HAF8ednr4lF644ArLnSjw-5Sm67jpddm1UCwpjO1BRc0-M7zloc1ostgEV162zoJl7Vu4GqDL7f4aoCOEU0JJp_J8JeQnBWiLDPcQesIpnO_88OH906b0NP_2MtE2bGR44_31gcHfINo0Q-7Cd1IIcp-jAiIXpPPCSFc1GWZIVodCSRjAipneIT2Tq8Mb37jRjWdV_ZgtUJ0PhVElbMIIh1BrKqCndP4Q2sipL4HNwlGVRUxxnSEUSU5wWPdJhtWmSQ5ifBkJ3gYV6TgNNs7bn3vQosutHc-wGb4Ony-3zY81NZtrtSub9O5YCSjwGkcOXnkQqpSUvZKF2HdpWLsIa1rSWNRi8iDgJzDKz3IkW2iOMS2y5HtDLJXCvTMtoQsVoadBgODvErz00nhWoch2393OoAbLj6Nr04TuxnhKs1juFUMN6vyjL0ZuJXKs-PIdRNWNOWymgMTbKhx1uw2tvXY8A34bT_NVg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