llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.93k stars 11.53k forks source link

segfault in bugprone-forwarding-reference-overload check #106333

Open HighCommander4 opened 2 weeks ago

HighCommander4 commented 2 weeks ago

Steps to reproduce

test.cpp:

template <template <class> typename T, typename U>
struct test
{
    test(U && arg1, T<int> arg2) {}
};
$ clang-tidy --checks=bugprone-forwarding-reference-overload test.cpp 
Error while trying to load a compilation database:
Could not auto-detect compilation database for file "test.cpp"
No compilation database found in /workspace or any parent directory
fixed-compilation-database: Error while opening fixed database: No such file or directory
json-compilation-database: Error while opening JSON database: No such file or directory
Running without flags.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: clang-tidy --checks=bugprone-forwarding-reference-overload test.cpp
1.      <eof> parser at end of file
2.      ASTMatcher: Matching 'bugprone-forwarding-reference-overload' against:
        CXXConstructorDecl test::test<T, U> : </workspace/test.cpp:4:5, col:35>
 #0 0x00007fed2ada9a3d llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) llvm/lib/Support/Unix/Signals.inc:723:11
 #1 0x00007fed2ada9f2b PrintStackTraceSignalHandler(void*) llvm/lib/Support/Unix/Signals.inc:798:1
 #2 0x00007fed2ada7fb6 llvm::sys::RunSignalHandlers() llvm/lib/Support/Signals.cpp:105:5
 #3 0x00007fed2adaa6b5 SignalHandler(int) llvm/lib/Support/Unix/Signals.inc:413:1
 #4 0x00007fed31176140 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x13140)
 #5 0x00007fed2c188214 llvm::detail::PunnedPointer<void*>::asInt() const llvm/include/llvm/ADT/PointerIntPair.h:41:5
 #6 0x00007fed2c189ab5 llvm::detail::PunnedPointer<void*>::operator long() const llvm/include/llvm/ADT/PointerIntPair.h:45:41
 #7 0x00007fed2c193135 llvm::PointerIntPair<void*, 1u, int, llvm::pointer_union_detail::PointerUnionUIntTraits<clang::DeclContext*, clang::Decl::MultipleDC*>, llvm::PointerIntPairInfo<void*, 1u, llvm::pointer_union_detail::PointerUnionUIntTraits<clang::DeclContext*, clang::Decl::MultipleDC*>>>::getInt() const llvm/include/llvm/ADT/PointerIntPair.h:96:57
 #8 0x00007fed2c193105 bool llvm::CastInfoPointerUnionImpl<clang::DeclContext*, clang::Decl::MultipleDC*>::isPossible<clang::DeclContext*>(llvm::PointerUnion<clang::DeclContext*, clang::Decl::MultipleDC*>&) llvm/include/llvm/ADT/PointerUnion.h:230:12
 #9 0x00007fed2c1930e5 llvm::CastInfo<clang::DeclContext*, llvm::PointerUnion<clang::DeclContext*, clang::Decl::MultipleDC*>, void>::isPossible(llvm::PointerUnion<clang::DeclContext*, clang::Decl::MultipleDC*>&) llvm/include/llvm/ADT/PointerUnion.h:248:5
#10 0x00007fed2c1930c5 llvm::ConstStrippingForwardingCast<clang::DeclContext*, llvm::PointerUnion<clang::DeclContext*, clang::Decl::MultipleDC*> const, llvm::CastInfo<clang::DeclContext*, llvm::PointerUnion<clang::DeclContext*, clang::Decl::MultipleDC*>, void>>::isPossible(llvm::PointerUnion<clang::DeclContext*, clang::Decl::MultipleDC*> const&) llvm/include/llvm/Support/Casting.h:396:5
#11 0x00007fed2c1930a5 bool llvm::isa<clang::DeclContext*, llvm::PointerUnion<clang::DeclContext*, clang::Decl::MultipleDC*>>(llvm::PointerUnion<clang::DeclContext*, clang::Decl::MultipleDC*> const&) llvm/include/llvm/Support/Casting.h:549:3
#12 0x00007fed2c193085 bool llvm::PointerUnion<clang::DeclContext*, clang::Decl::MultipleDC*>::is<clang::DeclContext*>() const llvm/include/llvm/ADT/PointerUnion.h:150:50
#13 0x00007fed2c193019 clang::Decl::isInSemaDC() const clang/include/clang/AST/DeclBase.h:274:29
#14 0x00007fed2c192fb9 clang::Decl::getDeclContext() clang/include/clang/AST/DeclBase.h:455:9
#15 0x00007fed2c186ad5 clang::Decl::getDeclContext() const clang/include/clang/AST/DeclBase.h:460:5
#16 0x00007fed2c65a4e5 clang::Decl::isInStdNamespace() const clang/lib/AST/DeclBase.cpp:426:22
#17 0x00007fed2fb9b869 clang::tidy::bugprone::(anonymous namespace)::internal::matcher_isEnableIfMatcher::matches(clang::QualType const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const::'lambda'(clang::TemplateSpecializationType const*)::operator()(clang::TemplateSpecializationType const*) const clang-tools-extra/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp:27:22
#18 0x00007fed2fb9b72f clang::tidy::bugprone::(anonymous namespace)::internal::matcher_isEnableIfMatcher::matches(clang::QualType const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang-tools-extra/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp:42:7
#19 0x00007fed2f83015e clang::ast_matchers::internal::MatcherInterface<clang::QualType>::dynMatches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/include/clang/ASTMatchers/ASTMatchersInternal.h:374:5
#20 0x00007fed2d181f2e clang::ast_matchers::internal::DynTypedMatcher::matches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/lib/ASTMatchers/ASTMatchersInternal.cpp:303:7
#21 0x00007fed310cc202 clang::ast_matchers::internal::Matcher<clang::QualType>::matches(clang::QualType const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/include/clang/ASTMatchers/ASTMatchersInternal.h:609:5
#22 0x00007fed311133f7 clang::ast_matchers::internal::matcher_hasType0Matcher<clang::ParmVarDecl, clang::ast_matchers::internal::Matcher<clang::QualType>>::matches(clang::ParmVarDecl const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/include/clang/ASTMatchers/ASTMatchers.h:3999:5
#23 0x00007fed310d8dfe clang::ast_matchers::internal::MatcherInterface<clang::ParmVarDecl>::dynMatches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/include/clang/ASTMatchers/ASTMatchersInternal.h:374:5
#24 0x00007fed2d181f2e clang::ast_matchers::internal::DynTypedMatcher::matches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/lib/ASTMatchers/ASTMatchersInternal.cpp:303:7
#25 0x00007fed2fb71ad2 clang::ast_matchers::internal::Matcher<clang::ParmVarDecl>::matches(clang::ParmVarDecl const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/include/clang/ASTMatchers/ASTMatchersInternal.h:609:5
#26 0x00007fed2fba4ada clang::ParmVarDecl* const* clang::ast_matchers::internal::matchesFirstInPointerRange<clang::ast_matchers::internal::Matcher<clang::ParmVarDecl>, clang::ParmVarDecl* const*>(clang::ast_matchers::internal::Matcher<clang::ParmVarDecl> const&, clang::ParmVarDecl* const*, clang::ParmVarDecl* const*, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) clang/include/clang/ASTMatchers/ASTMatchersInternal.h:863:9
#27 0x00007fed2fba4a52 clang::ast_matchers::internal::matcher_hasAnyParameter0Matcher<clang::CXXConstructorDecl, clang::ast_matchers::internal::Matcher<clang::ParmVarDecl>>::matches(clang::CXXConstructorDecl const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/include/clang/ASTMatchers/ASTMatchers.h:5278:10
#28 0x00007fed2f83254e clang::ast_matchers::internal::MatcherInterface<clang::CXXConstructorDecl>::dynMatches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/include/clang/ASTMatchers/ASTMatchersInternal.h:374:5
#29 0x00007fed2d181f2e clang::ast_matchers::internal::DynTypedMatcher::matches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/lib/ASTMatchers/ASTMatchersInternal.cpp:303:7
#30 0x00007fed2d185cc6 clang::ast_matchers::internal::notUnaryOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>) clang/lib/ASTMatchers/ASTMatchersInternal.cpp:384:10
#31 0x00007fed2d185dba clang::ast_matchers::internal::(anonymous namespace)::VariadicMatcher<&clang::ast_matchers::internal::notUnaryOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)>::dynMatches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/lib/ASTMatchers/ASTMatchersInternal.cpp:123:5
#32 0x00007fed2d182142 clang::ast_matchers::internal::DynTypedMatcher::matchesNoKindCheck(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/lib/ASTMatchers/ASTMatchersInternal.cpp:332:7
#33 0x00007fed2d18568e clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0::operator()(clang::ast_matchers::internal::DynTypedMatcher const&) const clang/lib/ASTMatchers/ASTMatchersInternal.cpp:395:5
#34 0x00007fed2d18564d bool __gnu_cxx::__ops::_Iter_negate<clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0>::operator()<clang::ast_matchers::internal::DynTypedMatcher const*>(clang::ast_matchers::internal::DynTypedMatcher const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/predefined_ops.h:393:11
#35 0x00007fed2d185473 clang::ast_matchers::internal::DynTypedMatcher const* std::__find_if<clang::ast_matchers::internal::DynTypedMatcher const*, __gnu_cxx::__ops::_Iter_negate<clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0>>(clang::ast_matchers::internal::DynTypedMatcher const*, clang::ast_matchers::internal::DynTypedMatcher const*, __gnu_cxx::__ops::_Iter_negate<clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0>, std::random_access_iterator_tag) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_algobase.h:1937:8
#36 0x00007fed2d185357 clang::ast_matchers::internal::DynTypedMatcher const* std::__find_if_not<clang::ast_matchers::internal::DynTypedMatcher const*, __gnu_cxx::__ops::_Iter_pred<clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0>>(clang::ast_matchers::internal::DynTypedMatcher const*, clang::ast_matchers::internal::DynTypedMatcher const*, __gnu_cxx::__ops::_Iter_pred<clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0>) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_algo.h:106:7
#37 0x00007fed2d1852ab clang::ast_matchers::internal::DynTypedMatcher const* std::find_if_not<clang::ast_matchers::internal::DynTypedMatcher const*, clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0>(clang::ast_matchers::internal::DynTypedMatcher const*, clang::ast_matchers::internal::DynTypedMatcher const*, clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_algo.h:513:7
#38 0x00007fed2d1851fd bool std::all_of<clang::ast_matchers::internal::DynTypedMatcher const*, clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0>(clang::ast_matchers::internal::DynTypedMatcher const*, clang::ast_matchers::internal::DynTypedMatcher const*, clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_algo.h:453:24
#39 0x00007fed2d18518e bool llvm::all_of<llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>&, clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0>(llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>&, clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0) llvm/include/llvm/ADT/STLExtras.h:1723:3
#40 0x00007fed2d18502a clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>) clang/lib/ASTMatchers/ASTMatchersInternal.cpp:394:3
#41 0x00007fed2d18510a clang::ast_matchers::internal::(anonymous namespace)::VariadicMatcher<&clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)>::dynMatches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/lib/ASTMatchers/ASTMatchersInternal.cpp:123:5
#42 0x00007fed2d183b0e clang::ast_matchers::internal::(anonymous namespace)::IdDynMatcher::dynMatches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/lib/ASTMatchers/ASTMatchersInternal.cpp:138:10
#43 0x00007fed2d181f2e clang::ast_matchers::internal::DynTypedMatcher::matches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/lib/ASTMatchers/ASTMatchersInternal.cpp:303:7
#44 0x00007fed2d0326f3 clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::matchWithFilter(clang::DynTypedNode const&) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1064:11
#45 0x00007fed2d032402 clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::matchDispatch(clang::Decl const*) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1086:5
#46 0x00007fed2d03220d void clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::match<clang::Decl>(clang::Decl const&) clang/lib/ASTMatchers/ASTMatchFinder.cpp:731:3
#47 0x00007fed2d0352ad clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1470:3
#48 0x00007fed2d09e208 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDeclContextHelper(clang::DeclContext*) clang/include/clang/AST/RecursiveASTVisitor.h:1535:7
#49 0x00007fed2d03e4c5 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseCXXRecordDecl(clang::CXXRecordDecl*) clang/include/clang/AST/RecursiveASTVisitor.h:2051:1
#50 0x00007fed2d035d77 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDecl(clang::Decl*) build/tools/clang/include/clang/AST/DeclNodes.inc:414:1
#51 0x00007fed2d0352ba clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1471:3
#52 0x00007fed2d040671 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseClassTemplateDecl(clang::ClassTemplateDecl*) clang/include/clang/AST/RecursiveASTVisitor.h:1938:1
#53 0x00007fed2d035fa6 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDecl(clang::Decl*) build/tools/clang/include/clang/AST/DeclNodes.inc:524:1
#54 0x00007fed2d0352ba clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1471:3
#55 0x00007fed2d09e208 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDeclContextHelper(clang::DeclContext*) clang/include/clang/AST/RecursiveASTVisitor.h:1535:7
#56 0x00007fed2d036521 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseTranslationUnitDecl(clang::TranslationUnitDecl*) clang/include/clang/AST/RecursiveASTVisitor.h:1635:1
#57 0x00007fed2d03540f clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDecl(clang::Decl*) build/tools/clang/include/clang/AST/DeclNodes.inc:24:1
#58 0x00007fed2d0352ba clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1471:3
#59 0x00007fed2cfa71e2 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseAST(clang::ASTContext&) clang/include/clang/AST/RecursiveASTVisitor.h:190:5
#60 0x00007fed2cfa703c clang::ast_matchers::MatchFinder::matchAST(clang::ASTContext&) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1700:11
#61 0x00007fed2d034d12 clang::ast_matchers::internal::(anonymous namespace)::MatchASTConsumer::HandleTranslationUnit(clang::ASTContext&) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1563:3
#62 0x00007fed262f9e53 clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) clang/lib/Frontend/MultiplexConsumer.cpp:326:23
#63 0x00007fed1fdad2c9 clang::ParseAST(clang::Sema&, bool, bool) clang/lib/Parse/ParseAST.cpp:183:12
#64 0x00007fed262b1841 clang::ASTFrontendAction::ExecuteAction() clang/lib/Frontend/FrontendAction.cpp:1194:1
#65 0x00007fed262b125c clang::FrontendAction::Execute() clang/lib/Frontend/FrontendAction.cpp:1082:7
#66 0x00007fed261a7b69 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:1061:23
#67 0x00007fed2d3bd913 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) clang/lib/Tooling/Tooling.cpp:465:14
#68 0x00007fed2d4b8c2e clang::tidy::runClangTidy(clang::tidy::ClangTidyContext&, clang::tooling::CompilationDatabase const&, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>, bool, bool, llvm::StringRef)::ActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) clang-tools-extra/clang-tidy/ClangTidy.cpp:581:37
#69 0x00007fed2d3bd7bc clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) clang/lib/Tooling/Tooling.cpp:440:18
#70 0x00007fed2d3bc954 clang::tooling::ToolInvocation::run() clang/lib/Tooling/Tooling.cpp:425:3
#71 0x00007fed2d3beb55 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) clang/lib/Tooling/Tooling.cpp:623:11
#72 0x00007fed2d4b6104 clang::tidy::runClangTidy(clang::tidy::ClangTidyContext&, clang::tooling::CompilationDatabase const&, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>, bool, bool, llvm::StringRef) clang-tools-extra/clang-tidy/ClangTidy.cpp:602:8
#73 0x00007fed31149ed0 clang::tidy::clangTidyMain(int, char const**) clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp:674:7
#74 0x0000555bd5f75e02 main clang-tools-extra/clang-tidy/tool/ClangTidyToolMain.cpp:20:3
#75 0x00007fed2a4dbd0a __libc_start_main ./csu/../csu/libc-start.c:308:16
#76 0x0000555bd5f75d1a _start (build/bin/clang-tidy+0x1d1a)
Segmentation fault

Tested with a local assertions-enabled build of https://github.com/llvm/llvm-project/commit/99c43e3ce3142a93bbad4f9efeace254d9a8442c.

Originally reported at https://github.com/clangd/clangd/issues/2119.

llvmbot commented 2 weeks ago

@llvm/issue-subscribers-clang-tidy

Author: Nathan Ridge (HighCommander4)

**Steps to reproduce** test.cpp: ```c++ template <template <class> typename T, typename U> struct test { test(U && arg1, T<int> arg2) {} }; ``` ```console $ clang-tidy --checks=bugprone-forwarding-reference-overload test.cpp Error while trying to load a compilation database: Could not auto-detect compilation database for file "test.cpp" No compilation database found in /workspace or any parent directory fixed-compilation-database: Error while opening fixed database: No such file or directory json-compilation-database: Error while opening JSON database: No such file or directory Running without flags. PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. Stack dump: 0. Program arguments: clang-tidy --checks=bugprone-forwarding-reference-overload test.cpp 1. <eof> parser at end of file 2. ASTMatcher: Matching 'bugprone-forwarding-reference-overload' against: CXXConstructorDecl test::test<T, U> : </workspace/test.cpp:4:5, col:35> #0 0x00007fed2ada9a3d llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) llvm/lib/Support/Unix/Signals.inc:723:11 #1 0x00007fed2ada9f2b PrintStackTraceSignalHandler(void*) llvm/lib/Support/Unix/Signals.inc:798:1 #2 0x00007fed2ada7fb6 llvm::sys::RunSignalHandlers() llvm/lib/Support/Signals.cpp:105:5 #3 0x00007fed2adaa6b5 SignalHandler(int) llvm/lib/Support/Unix/Signals.inc:413:1 #4 0x00007fed31176140 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x13140) #5 0x00007fed2c188214 llvm::detail::PunnedPointer<void*>::asInt() const llvm/include/llvm/ADT/PointerIntPair.h:41:5 #6 0x00007fed2c189ab5 llvm::detail::PunnedPointer<void*>::operator long() const llvm/include/llvm/ADT/PointerIntPair.h:45:41 #7 0x00007fed2c193135 llvm::PointerIntPair<void*, 1u, int, llvm::pointer_union_detail::PointerUnionUIntTraits<clang::DeclContext*, clang::Decl::MultipleDC*>, llvm::PointerIntPairInfo<void*, 1u, llvm::pointer_union_detail::PointerUnionUIntTraits<clang::DeclContext*, clang::Decl::MultipleDC*>>>::getInt() const llvm/include/llvm/ADT/PointerIntPair.h:96:57 #8 0x00007fed2c193105 bool llvm::CastInfoPointerUnionImpl<clang::DeclContext*, clang::Decl::MultipleDC*>::isPossible<clang::DeclContext*>(llvm::PointerUnion<clang::DeclContext*, clang::Decl::MultipleDC*>&) llvm/include/llvm/ADT/PointerUnion.h:230:12 #9 0x00007fed2c1930e5 llvm::CastInfo<clang::DeclContext*, llvm::PointerUnion<clang::DeclContext*, clang::Decl::MultipleDC*>, void>::isPossible(llvm::PointerUnion<clang::DeclContext*, clang::Decl::MultipleDC*>&) llvm/include/llvm/ADT/PointerUnion.h:248:5 #10 0x00007fed2c1930c5 llvm::ConstStrippingForwardingCast<clang::DeclContext*, llvm::PointerUnion<clang::DeclContext*, clang::Decl::MultipleDC*> const, llvm::CastInfo<clang::DeclContext*, llvm::PointerUnion<clang::DeclContext*, clang::Decl::MultipleDC*>, void>>::isPossible(llvm::PointerUnion<clang::DeclContext*, clang::Decl::MultipleDC*> const&) llvm/include/llvm/Support/Casting.h:396:5 #11 0x00007fed2c1930a5 bool llvm::isa<clang::DeclContext*, llvm::PointerUnion<clang::DeclContext*, clang::Decl::MultipleDC*>>(llvm::PointerUnion<clang::DeclContext*, clang::Decl::MultipleDC*> const&) llvm/include/llvm/Support/Casting.h:549:3 #12 0x00007fed2c193085 bool llvm::PointerUnion<clang::DeclContext*, clang::Decl::MultipleDC*>::is<clang::DeclContext*>() const llvm/include/llvm/ADT/PointerUnion.h:150:50 #13 0x00007fed2c193019 clang::Decl::isInSemaDC() const clang/include/clang/AST/DeclBase.h:274:29 #14 0x00007fed2c192fb9 clang::Decl::getDeclContext() clang/include/clang/AST/DeclBase.h:455:9 #15 0x00007fed2c186ad5 clang::Decl::getDeclContext() const clang/include/clang/AST/DeclBase.h:460:5 #16 0x00007fed2c65a4e5 clang::Decl::isInStdNamespace() const clang/lib/AST/DeclBase.cpp:426:22 #17 0x00007fed2fb9b869 clang::tidy::bugprone::(anonymous namespace)::internal::matcher_isEnableIfMatcher::matches(clang::QualType const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const::'lambda'(clang::TemplateSpecializationType const*)::operator()(clang::TemplateSpecializationType const*) const clang-tools-extra/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp:27:22 #18 0x00007fed2fb9b72f clang::tidy::bugprone::(anonymous namespace)::internal::matcher_isEnableIfMatcher::matches(clang::QualType const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang-tools-extra/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp:42:7 #19 0x00007fed2f83015e clang::ast_matchers::internal::MatcherInterface<clang::QualType>::dynMatches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/include/clang/ASTMatchers/ASTMatchersInternal.h:374:5 #20 0x00007fed2d181f2e clang::ast_matchers::internal::DynTypedMatcher::matches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/lib/ASTMatchers/ASTMatchersInternal.cpp:303:7 #21 0x00007fed310cc202 clang::ast_matchers::internal::Matcher<clang::QualType>::matches(clang::QualType const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/include/clang/ASTMatchers/ASTMatchersInternal.h:609:5 #22 0x00007fed311133f7 clang::ast_matchers::internal::matcher_hasType0Matcher<clang::ParmVarDecl, clang::ast_matchers::internal::Matcher<clang::QualType>>::matches(clang::ParmVarDecl const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/include/clang/ASTMatchers/ASTMatchers.h:3999:5 #23 0x00007fed310d8dfe clang::ast_matchers::internal::MatcherInterface<clang::ParmVarDecl>::dynMatches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/include/clang/ASTMatchers/ASTMatchersInternal.h:374:5 #24 0x00007fed2d181f2e clang::ast_matchers::internal::DynTypedMatcher::matches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/lib/ASTMatchers/ASTMatchersInternal.cpp:303:7 #25 0x00007fed2fb71ad2 clang::ast_matchers::internal::Matcher<clang::ParmVarDecl>::matches(clang::ParmVarDecl const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/include/clang/ASTMatchers/ASTMatchersInternal.h:609:5 #26 0x00007fed2fba4ada clang::ParmVarDecl* const* clang::ast_matchers::internal::matchesFirstInPointerRange<clang::ast_matchers::internal::Matcher<clang::ParmVarDecl>, clang::ParmVarDecl* const*>(clang::ast_matchers::internal::Matcher<clang::ParmVarDecl> const&, clang::ParmVarDecl* const*, clang::ParmVarDecl* const*, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) clang/include/clang/ASTMatchers/ASTMatchersInternal.h:863:9 #27 0x00007fed2fba4a52 clang::ast_matchers::internal::matcher_hasAnyParameter0Matcher<clang::CXXConstructorDecl, clang::ast_matchers::internal::Matcher<clang::ParmVarDecl>>::matches(clang::CXXConstructorDecl const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/include/clang/ASTMatchers/ASTMatchers.h:5278:10 #28 0x00007fed2f83254e clang::ast_matchers::internal::MatcherInterface<clang::CXXConstructorDecl>::dynMatches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/include/clang/ASTMatchers/ASTMatchersInternal.h:374:5 #29 0x00007fed2d181f2e clang::ast_matchers::internal::DynTypedMatcher::matches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/lib/ASTMatchers/ASTMatchersInternal.cpp:303:7 #30 0x00007fed2d185cc6 clang::ast_matchers::internal::notUnaryOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>) clang/lib/ASTMatchers/ASTMatchersInternal.cpp:384:10 #31 0x00007fed2d185dba clang::ast_matchers::internal::(anonymous namespace)::VariadicMatcher<&clang::ast_matchers::internal::notUnaryOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)>::dynMatches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/lib/ASTMatchers/ASTMatchersInternal.cpp:123:5 #32 0x00007fed2d182142 clang::ast_matchers::internal::DynTypedMatcher::matchesNoKindCheck(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/lib/ASTMatchers/ASTMatchersInternal.cpp:332:7 #33 0x00007fed2d18568e clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0::operator()(clang::ast_matchers::internal::DynTypedMatcher const&) const clang/lib/ASTMatchers/ASTMatchersInternal.cpp:395:5 #34 0x00007fed2d18564d bool __gnu_cxx::__ops::_Iter_negate<clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0>::operator()<clang::ast_matchers::internal::DynTypedMatcher const*>(clang::ast_matchers::internal::DynTypedMatcher const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/predefined_ops.h:393:11 #35 0x00007fed2d185473 clang::ast_matchers::internal::DynTypedMatcher const* std::__find_if<clang::ast_matchers::internal::DynTypedMatcher const*, __gnu_cxx::__ops::_Iter_negate<clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0>>(clang::ast_matchers::internal::DynTypedMatcher const*, clang::ast_matchers::internal::DynTypedMatcher const*, __gnu_cxx::__ops::_Iter_negate<clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0>, std::random_access_iterator_tag) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_algobase.h:1937:8 #36 0x00007fed2d185357 clang::ast_matchers::internal::DynTypedMatcher const* std::__find_if_not<clang::ast_matchers::internal::DynTypedMatcher const*, __gnu_cxx::__ops::_Iter_pred<clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0>>(clang::ast_matchers::internal::DynTypedMatcher const*, clang::ast_matchers::internal::DynTypedMatcher const*, __gnu_cxx::__ops::_Iter_pred<clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0>) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_algo.h:106:7 #37 0x00007fed2d1852ab clang::ast_matchers::internal::DynTypedMatcher const* std::find_if_not<clang::ast_matchers::internal::DynTypedMatcher const*, clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0>(clang::ast_matchers::internal::DynTypedMatcher const*, clang::ast_matchers::internal::DynTypedMatcher const*, clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_algo.h:513:7 #38 0x00007fed2d1851fd bool std::all_of<clang::ast_matchers::internal::DynTypedMatcher const*, clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0>(clang::ast_matchers::internal::DynTypedMatcher const*, clang::ast_matchers::internal::DynTypedMatcher const*, clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_algo.h:453:24 #39 0x00007fed2d18518e bool llvm::all_of<llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>&, clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0>(llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>&, clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)::$_0) llvm/include/llvm/ADT/STLExtras.h:1723:3 #40 0x00007fed2d18502a clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>) clang/lib/ASTMatchers/ASTMatchersInternal.cpp:394:3 #41 0x00007fed2d18510a clang::ast_matchers::internal::(anonymous namespace)::VariadicMatcher<&clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>)>::dynMatches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/lib/ASTMatchers/ASTMatchersInternal.cpp:123:5 #42 0x00007fed2d183b0e clang::ast_matchers::internal::(anonymous namespace)::IdDynMatcher::dynMatches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/lib/ASTMatchers/ASTMatchersInternal.cpp:138:10 #43 0x00007fed2d181f2e clang::ast_matchers::internal::DynTypedMatcher::matches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const clang/lib/ASTMatchers/ASTMatchersInternal.cpp:303:7 #44 0x00007fed2d0326f3 clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::matchWithFilter(clang::DynTypedNode const&) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1064:11 #45 0x00007fed2d032402 clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::matchDispatch(clang::Decl const*) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1086:5 #46 0x00007fed2d03220d void clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::match<clang::Decl>(clang::Decl const&) clang/lib/ASTMatchers/ASTMatchFinder.cpp:731:3 #47 0x00007fed2d0352ad clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1470:3 #48 0x00007fed2d09e208 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDeclContextHelper(clang::DeclContext*) clang/include/clang/AST/RecursiveASTVisitor.h:1535:7 #49 0x00007fed2d03e4c5 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseCXXRecordDecl(clang::CXXRecordDecl*) clang/include/clang/AST/RecursiveASTVisitor.h:2051:1 #50 0x00007fed2d035d77 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDecl(clang::Decl*) build/tools/clang/include/clang/AST/DeclNodes.inc:414:1 #51 0x00007fed2d0352ba clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1471:3 #52 0x00007fed2d040671 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseClassTemplateDecl(clang::ClassTemplateDecl*) clang/include/clang/AST/RecursiveASTVisitor.h:1938:1 #53 0x00007fed2d035fa6 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDecl(clang::Decl*) build/tools/clang/include/clang/AST/DeclNodes.inc:524:1 #54 0x00007fed2d0352ba clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1471:3 #55 0x00007fed2d09e208 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDeclContextHelper(clang::DeclContext*) clang/include/clang/AST/RecursiveASTVisitor.h:1535:7 #56 0x00007fed2d036521 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseTranslationUnitDecl(clang::TranslationUnitDecl*) clang/include/clang/AST/RecursiveASTVisitor.h:1635:1 #57 0x00007fed2d03540f clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDecl(clang::Decl*) build/tools/clang/include/clang/AST/DeclNodes.inc:24:1 #58 0x00007fed2d0352ba clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1471:3 #59 0x00007fed2cfa71e2 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseAST(clang::ASTContext&) clang/include/clang/AST/RecursiveASTVisitor.h:190:5 #60 0x00007fed2cfa703c clang::ast_matchers::MatchFinder::matchAST(clang::ASTContext&) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1700:11 #61 0x00007fed2d034d12 clang::ast_matchers::internal::(anonymous namespace)::MatchASTConsumer::HandleTranslationUnit(clang::ASTContext&) clang/lib/ASTMatchers/ASTMatchFinder.cpp:1563:3 #62 0x00007fed262f9e53 clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) clang/lib/Frontend/MultiplexConsumer.cpp:326:23 #63 0x00007fed1fdad2c9 clang::ParseAST(clang::Sema&, bool, bool) clang/lib/Parse/ParseAST.cpp:183:12 #64 0x00007fed262b1841 clang::ASTFrontendAction::ExecuteAction() clang/lib/Frontend/FrontendAction.cpp:1194:1 #65 0x00007fed262b125c clang::FrontendAction::Execute() clang/lib/Frontend/FrontendAction.cpp:1082:7 #66 0x00007fed261a7b69 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:1061:23 #67 0x00007fed2d3bd913 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) clang/lib/Tooling/Tooling.cpp:465:14 #68 0x00007fed2d4b8c2e clang::tidy::runClangTidy(clang::tidy::ClangTidyContext&, clang::tooling::CompilationDatabase const&, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>, bool, bool, llvm::StringRef)::ActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) clang-tools-extra/clang-tidy/ClangTidy.cpp:581:37 #69 0x00007fed2d3bd7bc clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) clang/lib/Tooling/Tooling.cpp:440:18 #70 0x00007fed2d3bc954 clang::tooling::ToolInvocation::run() clang/lib/Tooling/Tooling.cpp:425:3 #71 0x00007fed2d3beb55 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) clang/lib/Tooling/Tooling.cpp:623:11 #72 0x00007fed2d4b6104 clang::tidy::runClangTidy(clang::tidy::ClangTidyContext&, clang::tooling::CompilationDatabase const&, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>, bool, bool, llvm::StringRef) clang-tools-extra/clang-tidy/ClangTidy.cpp:602:8 #73 0x00007fed31149ed0 clang::tidy::clangTidyMain(int, char const**) clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp:674:7 #74 0x0000555bd5f75e02 main clang-tools-extra/clang-tidy/tool/ClangTidyToolMain.cpp:20:3 #75 0x00007fed2a4dbd0a __libc_start_main ./csu/../csu/libc-start.c:308:16 #76 0x0000555bd5f75d1a _start (build/bin/clang-tidy+0x1d1a) Segmentation fault ``` Tested with a local assertions-enabled build of https://github.com/llvm/llvm-project/commit/99c43e3ce3142a93bbad4f9efeace254d9a8442c. Originally reported at https://github.com/clangd/clangd/issues/2119.