Skip to content

release/19.x: [clang-tidy] Fix crash in modernize-use-ranges (#100427) #101482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

llvmbot
Copy link
Member

@llvmbot llvmbot commented Aug 1, 2024

Backport 0762db6

Requested by: @njames93

@llvmbot llvmbot added this to the LLVM 19.X Release milestone Aug 1, 2024
@llvmbot
Copy link
Member Author

llvmbot commented Aug 1, 2024

@PiotrZSL What do you think about merging this PR to the release branch?

@llvmbot
Copy link
Member Author

llvmbot commented Aug 1, 2024

@llvm/pr-subscribers-clang-tools-extra

@llvm/pr-subscribers-clang-tidy

Author: None (llvmbot)

Changes

Backport 0762db6

Requested by: @njames93


Full diff: https://github.com/llvm/llvm-project/pull/101482.diff

3 Files Affected:

  • (modified) clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp (+32-32)
  • (modified) clang-tools-extra/clang-tidy/utils/UseRangesCheck.h (+1-1)
  • (modified) clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-ranges/fake_std.h (+10-7)
diff --git a/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp b/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp
index e2daa5010e2ae..aba4d17ccd035 100644
--- a/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp
+++ b/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp
@@ -39,12 +39,6 @@ static constexpr const char ArgName[] = "ArgName";
 
 namespace clang::tidy::utils {
 
-static bool operator==(const UseRangesCheck::Indexes &L,
-                       const UseRangesCheck::Indexes &R) {
-  return std::tie(L.BeginArg, L.EndArg, L.ReplaceArg) ==
-         std::tie(R.BeginArg, R.EndArg, R.ReplaceArg);
-}
-
 static std::string getFullPrefix(ArrayRef<UseRangesCheck::Indexes> Signature) {
   std::string Output;
   llvm::raw_string_ostream OS(Output);
@@ -54,15 +48,6 @@ static std::string getFullPrefix(ArrayRef<UseRangesCheck::Indexes> Signature) {
   return Output;
 }
 
-static llvm::hash_code hash_value(const UseRangesCheck::Indexes &Indexes) {
-  return llvm::hash_combine(Indexes.BeginArg, Indexes.EndArg,
-                            Indexes.ReplaceArg);
-}
-
-static llvm::hash_code hash_value(const UseRangesCheck::Signature &Sig) {
-  return llvm::hash_combine_range(Sig.begin(), Sig.end());
-}
-
 namespace {
 
 AST_MATCHER(Expr, hasSideEffects) {
@@ -123,24 +108,26 @@ makeMatcherPair(StringRef State, const UseRangesCheck::Indexes &Indexes,
 }
 
 void UseRangesCheck::registerMatchers(MatchFinder *Finder) {
-  Replaces = getReplacerMap();
+  auto Replaces = getReplacerMap();
   ReverseDescriptor = getReverseDescriptor();
   auto BeginEndNames = getFreeBeginEndMethods();
   llvm::SmallVector<StringRef, 4> BeginNames{
       llvm::make_first_range(BeginEndNames)};
   llvm::SmallVector<StringRef, 4> EndNames{
       llvm::make_second_range(BeginEndNames)};
-  llvm::DenseSet<ArrayRef<Signature>> Seen;
+  Replacers.clear();
+  llvm::DenseSet<Replacer *> SeenRepl;
   for (auto I = Replaces.begin(), E = Replaces.end(); I != E; ++I) {
-    const ArrayRef<Signature> &Signatures =
-        I->getValue()->getReplacementSignatures();
-    if (!Seen.insert(Signatures).second)
+    auto Replacer = I->getValue();
+    if (!SeenRepl.insert(Replacer.get()).second)
       continue;
-    assert(!Signatures.empty() &&
-           llvm::all_of(Signatures, [](auto Index) { return !Index.empty(); }));
+    Replacers.push_back(Replacer);
+    assert(!Replacer->getReplacementSignatures().empty() &&
+           llvm::all_of(Replacer->getReplacementSignatures(),
+                        [](auto Index) { return !Index.empty(); }));
     std::vector<StringRef> Names(1, I->getKey());
     for (auto J = std::next(I); J != E; ++J)
-      if (J->getValue()->getReplacementSignatures() == Signatures)
+      if (J->getValue() == Replacer)
         Names.push_back(J->getKey());
 
     std::vector<ast_matchers::internal::DynTypedMatcher> TotalMatchers;
@@ -148,7 +135,7 @@ void UseRangesCheck::registerMatchers(MatchFinder *Finder) {
     // signatures in order of length(longest to shortest). This way any
     // signature that is a subset of another signature will be matched after the
     // other.
-    SmallVector<Signature> SigVec(Signatures);
+    SmallVector<Signature> SigVec(Replacer->getReplacementSignatures());
     llvm::sort(SigVec, [](auto &L, auto &R) { return R.size() < L.size(); });
     for (const auto &Signature : SigVec) {
       std::vector<ast_matchers::internal::DynTypedMatcher> Matchers;
@@ -163,7 +150,8 @@ void UseRangesCheck::registerMatchers(MatchFinder *Finder) {
     }
     Finder->addMatcher(
         callExpr(
-            callee(functionDecl(hasAnyName(std::move(Names))).bind(FuncDecl)),
+            callee(functionDecl(hasAnyName(std::move(Names)))
+                       .bind((FuncDecl + Twine(Replacers.size() - 1).str()))),
             ast_matchers::internal::DynTypedMatcher::constructVariadic(
                 ast_matchers::internal::DynTypedMatcher::VO_AnyOf,
                 ASTNodeKind::getFromNodeKind<CallExpr>(),
@@ -205,21 +193,33 @@ static void removeFunctionArgs(DiagnosticBuilder &Diag, const CallExpr &Call,
 }
 
 void UseRangesCheck::check(const MatchFinder::MatchResult &Result) {
-  const auto *Function = Result.Nodes.getNodeAs<FunctionDecl>(FuncDecl);
-  std::string Qualified = "::" + Function->getQualifiedNameAsString();
-  auto Iter = Replaces.find(Qualified);
-  assert(Iter != Replaces.end());
+  Replacer *Replacer = nullptr;
+  const FunctionDecl *Function = nullptr;
+  for (auto [Node, Value] : Result.Nodes.getMap()) {
+    StringRef NodeStr(Node);
+    if (!NodeStr.consume_front(FuncDecl))
+      continue;
+    Function = Value.get<FunctionDecl>();
+    size_t Index;
+    if (NodeStr.getAsInteger(10, Index)) {
+      llvm_unreachable("Unable to extract replacer index");
+    }
+    assert(Index < Replacers.size());
+    Replacer = Replacers[Index].get();
+    break;
+  }
+  assert(Replacer && Function);
   SmallString<64> Buffer;
-  for (const Signature &Sig : Iter->getValue()->getReplacementSignatures()) {
+  for (const Signature &Sig : Replacer->getReplacementSignatures()) {
     Buffer.assign({BoundCall, getFullPrefix(Sig)});
     const auto *Call = Result.Nodes.getNodeAs<CallExpr>(Buffer);
     if (!Call)
       continue;
     auto Diag = createDiag(*Call);
-    if (auto ReplaceName = Iter->getValue()->getReplaceName(*Function))
+    if (auto ReplaceName = Replacer->getReplaceName(*Function))
       Diag << FixItHint::CreateReplacement(Call->getCallee()->getSourceRange(),
                                            *ReplaceName);
-    if (auto Include = Iter->getValue()->getHeaderInclusion(*Function))
+    if (auto Include = Replacer->getHeaderInclusion(*Function))
       Diag << Inserter.createIncludeInsertion(
           Result.SourceManager->getFileID(Call->getBeginLoc()), *Include);
     llvm::SmallVector<unsigned, 3> ToRemove;
diff --git a/clang-tools-extra/clang-tidy/utils/UseRangesCheck.h b/clang-tools-extra/clang-tidy/utils/UseRangesCheck.h
index 927e9694b0ec7..3a454bcf0cf07 100644
--- a/clang-tools-extra/clang-tidy/utils/UseRangesCheck.h
+++ b/clang-tools-extra/clang-tidy/utils/UseRangesCheck.h
@@ -85,7 +85,7 @@ class UseRangesCheck : public ClangTidyCheck {
   std::optional<TraversalKind> getCheckTraversalKind() const override;
 
 private:
-  ReplacerMap Replaces;
+  std::vector<llvm::IntrusiveRefCntPtr<Replacer>> Replacers;
   std::optional<ReverseIteratorDescriptor> ReverseDescriptor;
   IncludeInserter Inserter;
 };
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-ranges/fake_std.h b/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-ranges/fake_std.h
index 6596511c7a38b..69ac9954f4afa 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-ranges/fake_std.h
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-ranges/fake_std.h
@@ -7,8 +7,8 @@ template <typename T> class vector {
 public:
   using iterator = T *;
   using const_iterator = const T *;
-  using reverse_iterator = T*;
-  using reverse_const_iterator = const T*;
+  using reverse_iterator = T *;
+  using reverse_const_iterator = const T *;
 
   constexpr const_iterator begin() const;
   constexpr const_iterator end() const;
@@ -72,8 +72,8 @@ template <typename Container> constexpr auto crend(const Container &Cont) {
   return Cont.crend();
 }
 // Find
-template< class InputIt, class T >
-InputIt find( InputIt first, InputIt last, const T& value );
+template <class InputIt, class T>
+InputIt find(InputIt first, InputIt last, const T &value);
 
 // Reverse
 template <typename Iter> void reverse(Iter begin, Iter end);
@@ -82,6 +82,7 @@ template <typename Iter> void reverse(Iter begin, Iter end);
 template <class InputIt1, class InputIt2>
 bool includes(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2);
 
+inline namespace _V1 {
 // IsPermutation
 template <class ForwardIt1, class ForwardIt2>
 bool is_permutation(ForwardIt1 first1, ForwardIt1 last1, ForwardIt2 first2);
@@ -97,9 +98,10 @@ template <class InputIt1, class InputIt2>
 bool equal(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2);
 
 template <class InputIt1, class InputIt2, class BinaryPred>
-bool equal(InputIt1 first1, InputIt1 last1,
-           InputIt2 first2, InputIt2 last2, BinaryPred p) {
-  // Need a definition to suppress undefined_internal_type when invoked with lambda
+bool equal(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2,
+           BinaryPred p) {
+  // Need a definition to suppress undefined_internal_type when invoked with
+  // lambda
   return true;
 }
 
@@ -108,6 +110,7 @@ void iota(ForwardIt first, ForwardIt last, T value);
 
 template <class ForwardIt>
 ForwardIt rotate(ForwardIt first, ForwardIt middle, ForwardIt last);
+} // namespace _V1
 
 } // namespace std
 

Crash seems to be caused by the check function not handling inline
namespaces correctly for some instances. Changed how the Replacer is got
from the MatchResult now which should alleviate any potential issues

Fixes llvm#100406

(cherry picked from commit 0762db6)
@tru tru merged commit 8d24749 into llvm:release/19.x Aug 5, 2024
3 of 6 checks passed
Copy link

github-actions bot commented Aug 5, 2024

@njames93 (or anyone else). If you would like to add a note about this fix in the release notes (completely optional). Please reply to this comment with a one or two sentence description of the fix. When you are done, please add the release:note label to this PR.

@tupos
Copy link

tupos commented Sep 23, 2024

Hello,

I think there might be some problem with this PR. I updated to 19.1.0 today and started to see crashes with this callstack on different files. So far I was not able to create a minimal working repro to let it reproducibly crashing.

Strangely enough it does not always crash on the file, from which I obtained the crash. However, maybe you could have an idea what is wrong.

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
 #0 0x00000000005bde8b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /cpp/llvm-19.1.0/llvm/lib/Support/Unix/Signals.inc:727:3
 #1 0x00000000005bbb94 llvm::sys::RunSignalHandlers() /cpp/llvm-19.1.0/llvm/lib/Support/Signals.cpp:105:20
 #2 0x00000000005bbf4e SignalHandler(int) /cpp/llvm-19.1.0/llvm/lib/Support/Unix/Signals.inc:413:1
 #3 0x00007f9844ae2910 __restore_rt (/lib64/libpthread.so.0+0x16910)
 #4 0x0000000000586ee6 llvm::StringMapImpl::LookupBucketFor(llvm::StringRef, unsigned int) /cpp/llvm-19.1.0/llvm/lib/Support/StringMap.cpp:102:25
 #5 0x000000000264755f std::pair<llvm::StringMapIterator<llvm::IntrusiveRefCntPtr<clang::tidy::utils::UseRangesCheck::Replacer>>, bool> llvm::StringMap<llvm::IntrusiveRefCntPtr<clang::tidy::utils::UseRangesCheck::Replacer>, llvm::MallocAllocator>::try_emplace_with_hash<llvm::IntrusiveRefCntPtr<clang::tidy::utils::UseRangesCheck::Replacer>&>(llvm::StringRef, unsigned int, llvm::IntrusiveRefCntPtr<clang::tidy::utils::UseRangesCheck::Replacer>&) /cpp/llvm-19.1.0/llvm/include/llvm/ADT/StringMap.h:376:40
 #6 0x000000000264755f std::pair<llvm::StringMapIterator<llvm::IntrusiveRefCntPtr<clang::tidy::utils::UseRangesCheck::Replacer>>, bool> llvm::StringMap<llvm::IntrusiveRefCntPtr<clang::tidy::utils::UseRangesCheck::Replacer>, llvm::MallocAllocator>::try_emplace<llvm::IntrusiveRefCntPtr<clang::tidy::utils::UseRangesCheck::Replacer>&>(llvm::StringRef, llvm::IntrusiveRefCntPtr<clang::tidy::utils::UseRangesCheck::Replacer>&) /cpp/llvm-19.1.0/llvm/include/llvm/ADT/StringMap.h:369:33
 #7 0x000000000264755f clang::tidy::boost::UseRangesCheck::getReplacerMap() const::'lambda'(llvm::IntrusiveRefCntPtr<clang::tidy::utils::UseRangesCheck::Replacer>, std::initializer_list<llvm::StringRef>, llvm::StringRef)::operator()(llvm::IntrusiveRefCntPtr<clang::tidy::utils::UseRangesCheck::Replacer>, std::initializer_list<llvm::StringRef>, llvm::StringRef) const (.constprop.0) /cpp/llvm-19.1.0/clang-tools-extra/clang-tidy/boost/UseRangesCheck.cpp:213:30
 #8 0x0000000002647b1d llvm::RefCountedBase<clang::tidy::utils::UseRangesCheck::Replacer>::Release() const /cpp/llvm-19.1.0/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:102:20
 #9 0x0000000002647b1d llvm::IntrusiveRefCntPtrInfo<clang::tidy::utils::UseRangesCheck::Replacer>::release(clang::tidy::utils::UseRangesCheck::Replacer*) /cpp/llvm-19.1.0/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:164:45
#10 0x0000000002647b1d llvm::IntrusiveRefCntPtr<clang::tidy::utils::UseRangesCheck::Replacer>::release() /cpp/llvm-19.1.0/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:233:41
#11 0x0000000002647b1d llvm::IntrusiveRefCntPtr<clang::tidy::utils::UseRangesCheck::Replacer>::~IntrusiveRefCntPtr() /cpp/llvm-19.1.0/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:196:34
#12 0x0000000002647b1d clang::tidy::boost::UseRangesCheck::getReplacerMap() const::'lambda'(llvm::IntrusiveRefCntPtr<clang::tidy::utils::UseRangesCheck::Replacer>, std::initializer_list<llvm::StringRef>)::operator()(llvm::IntrusiveRefCntPtr<clang::tidy::utils::UseRangesCheck::Replacer>, std::initializer_list<llvm::StringRef>) const (.constprop.0.isra.0) /cpp/llvm-19.1.0/clang-tools-extra/clang-tidy/boost/UseRangesCheck.cpp:220:16
#13 0x0000000002649032 llvm::IntrusiveRefCntPtr<clang::tidy::utils::UseRangesCheck::Replacer>::release() /cpp/llvm-19.1.0/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:232:5
#14 0x0000000002649032 llvm::IntrusiveRefCntPtr<clang::tidy::utils::UseRangesCheck::Replacer>::~IntrusiveRefCntPtr() /cpp/llvm-19.1.0/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:196:34
#15 0x0000000002649032 clang::tidy::boost::UseRangesCheck::getReplacerMap() const /cpp/llvm-19.1.0/clang-tools-extra/clang-tidy/boost/UseRangesCheck.cpp:234:13
#16 0x0000000002c75a6c clang::tidy::utils::UseRangesCheck::registerMatchers(clang::ast_matchers::MatchFinder*) /cpp/llvm-19.1.0/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp:112:43
#17 0x00000000017a86c8 clang::clangd::ParsedAST::build(llvm::StringRef, clang::clangd::ParseInputs const&, std::unique_ptr<clang::CompilerInvocation, std::default_delete<clang::CompilerInvocation>>, llvm::ArrayRef<clang::clangd::Diag>, std::shared_ptr<clang::clangd::PreambleData const>) /cpp/llvm-19.1.0/clang-tools-extra/clangd/ParsedAST.cpp:565:30
#18 0x0000000001823c30 std::unique_ptr<clang::CompilerInvocation, std::default_delete<clang::CompilerInvocation>>::~unique_ptr() /usr/include/c++/13/bits/unique_ptr.h:403:12
#19 0x0000000001823c30 clang::clangd::(anonymous namespace)::ASTWorker::generateDiagnostics(std::unique_ptr<clang::CompilerInvocation, std::default_delete<clang::CompilerInvocation>>, clang::clangd::ParseInputs, std::vector<clang::clangd::Diag, std::allocator<clang::clangd::Diag>>) /cpp/llvm-19.1.0/clang-tools-extra/clangd/TUScheduler.cpp:1211:74
#20 0x000000000182465e std::unique_ptr<clang::CompilerInvocation, std::default_delete<clang::CompilerInvocation>>::~unique_ptr() /usr/include/c++/13/bits/unique_ptr.h:403:12
#21 0x000000000182465e clang::clangd::(anonymous namespace)::ASTWorker::updatePreamble(std::unique_ptr<clang::CompilerInvocation, std::default_delete<clang::CompilerInvocation>>, clang::clangd::ParseInputs, std::shared_ptr<clang::clangd::PreambleData const>, std::vector<clang::clangd::Diag, std::allocator<clang::clangd::Diag>>, clang::clangd::WantDiagnostics)::'lambda'()::operator()() (.part.0) /cpp/llvm-19.1.0/clang-tools-extra/clangd/TUScheduler.cpp:1144:24
#22 0x000000000181a273 clang::clangd::(anonymous namespace)::ASTWorker::runTask(llvm::StringRef, llvm::function_ref<void ()>) /cpp/llvm-19.1.0/clang-tools-extra/clangd/TUScheduler.cpp:1325:1
#23 0x000000000181ca16 clang::clangd::(anonymous namespace)::ASTWorker::run() /cpp/llvm-19.1.0/clang-tools-extra/clangd/TUScheduler.cpp:1459:5
#24 0x00000000019c5fc0 llvm::detail::PunnedPointer<llvm::PointerUnion<llvm::detail::UniqueFunctionBase<void>::TrivialCallback*, llvm::detail::UniqueFunctionBase<void>::NonTrivialCallbacks*>>::asInt() const /cpp/llvm-19.1.0/llvm/include/llvm/ADT/PointerIntPair.h:41:16
#25 0x00000000019c5fc0 llvm::detail::PunnedPointer<llvm::PointerUnion<llvm::detail::UniqueFunctionBase<void>::TrivialCallback*, llvm::detail::UniqueFunctionBase<void>::NonTrivialCallbacks*>>::operator long() const /cpp/llvm-19.1.0/llvm/include/llvm/ADT/PointerIntPair.h:45:53
#26 0x00000000019c5fc0 llvm::PointerIntPair<llvm::PointerUnion<llvm::detail::UniqueFunctionBase<void>::TrivialCallback*, llvm::detail::UniqueFunctionBase<void>::NonTrivialCallbacks*>, 1u, bool, llvm::PointerLikeTypeTraits<llvm::PointerUnion<llvm::detail::UniqueFunctionBase<void>::TrivialCallback*, llvm::detail::UniqueFunctionBase<void>::NonTrivialCallbacks*>>, llvm::PointerIntPairInfo<llvm::PointerUnion<llvm::detail::UniqueFunctionBase<void>::TrivialCallback*, llvm::detail::UniqueFunctionBase<void>::NonTrivialCallbacks*>, 1u, llvm::PointerLikeTypeTraits<llvm::PointerUnion<llvm::detail::UniqueFunctionBase<void>::TrivialCallback*, llvm::detail::UniqueFunctionBase<void>::NonTrivialCallbacks*>>>>::getPointer() const /cpp/llvm-19.1.0/llvm/include/llvm/ADT/PointerIntPair.h:94:57
#27 0x00000000019c5fc0 llvm::detail::UniqueFunctionBase<void>::~UniqueFunctionBase() /cpp/llvm-19.1.0/llvm/include/llvm/ADT/FunctionExtras.h:282:42
#28 0x00000000019c5fc0 llvm::detail::UniqueFunctionBase<void>::operator=(llvm::detail::UniqueFunctionBase<void>&&) /cpp/llvm-19.1.0/llvm/include/llvm/ADT/FunctionExtras.h:335:30
#29 0x00000000019c5fc0 llvm::detail::UniqueFunctionBase<void>::operator=(llvm::detail::UniqueFunctionBase<void>&&) /cpp/llvm-19.1.0/llvm/include/llvm/ADT/FunctionExtras.h:328:23
#30 0x00000000019c5fc0 llvm::unique_function<void ()>::operator=(llvm::unique_function<void ()>&&) /cpp/llvm-19.1.0/llvm/include/llvm/ADT/FunctionExtras.h:372:20
#31 0x00000000019c5fc0 operator() /cpp/llvm-19.1.0/clang-tools-extra/clangd/support/Threading.cpp:103:14
#32 0x00000000019c5fc0 operator()<clang::clangd::AsyncTaskRunner::runAsync(const llvm::Twine&, llvm::unique_function<void()>)::<lambda()>&> /cpp/llvm-19.1.0/llvm/include/llvm/Support/thread.h:43:16
#33 0x00000000019c5fc0 __invoke_impl<void, llvm::thread::GenericThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(const llvm::Twine&, llvm::unique_function<void()>)::<lambda()> > >(void*)::<lambda(auto:4&&, auto:5&& ...)>, clang::clangd::AsyncTaskRunner::runAsync(const llvm::Twine&, llvm::unique_function<void()>)::<lambda()>&> /usr/include/c++/13/bits/invoke.h:61:36
#34 0x00000000019c5fc0 __invoke<llvm::thread::GenericThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(const llvm::Twine&, llvm::unique_function<void()>)::<lambda()> > >(void*)::<lambda(auto:4&&, auto:5&& ...)>, clang::clangd::AsyncTaskRunner::runAsync(const llvm::Twine&, llvm::unique_function<void()>)::<lambda()>&> /usr/include/c++/13/bits/invoke.h:96:40
#35 0x00000000019c5fc0 __apply_impl<llvm::thread::GenericThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(const llvm::Twine&, llvm::unique_function<void()>)::<lambda()> > >(void*)::<lambda(auto:4&&, auto:5&& ...)>, std::tuple<clang::clangd::AsyncTaskRunner::runAsync(const llvm::Twine&, llvm::unique_function<void()>)::<lambda()> >&, 0> /usr/include/c++/13/tuple:2288:27
#36 0x00000000019c5fc0 apply<llvm::thread::GenericThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(const llvm::Twine&, llvm::unique_function<void()>)::<lambda()> > >(void*)::<lambda(auto:4&&, auto:5&& ...)>, std::tuple<clang::clangd::AsyncTaskRunner::runAsync(const llvm::Twine&, llvm::unique_function<void()>)::<lambda()> >&> /usr/include/c++/13/tuple:2299:31
#37 0x00000000019c5fc0 GenericThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(const llvm::Twine&, llvm::unique_function<void()>)::<lambda()> > > /cpp/llvm-19.1.0/llvm/include/llvm/Support/thread.h:41:15
#38 0x00000000019c5fc0 void* llvm::thread::ThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::'lambda0'()>>(void*) /cpp/llvm-19.1.0/llvm/include/llvm/Support/thread.h:55:36
#39 0x00007f9844ad66ea start_thread (/lib64/libpthread.so.0+0xa6ea)
#40 0x00007f984460f58f clone (/lib64/libc.so.6+0x11858f)

@njames93
Copy link
Member

njames93 commented Oct 7, 2024

That crash is addressed in #111318. Basically the check works fine when run in clang-tidy with 1 source file, but failed when ran multiple times from one process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

5 participants