dhr412 wrote:

> It's not clear me to yet that individual LSP requests are the best place to 
> have this check.
> 
> (For example, what makes `textDocument/documentSymbol` different from 
> `textDocument/definition` that one needs this check and the other doesn't?)
> 
> Were you able to reproduce the crash locally in a debug build? Can you post a 
> crash stacktrace from the debug build, so we can better understand what 
> exactly is crashing and why?

Yes, I made a relwithdebinfo build with assertions enabled, The following is 
the backtrace:

0  llvm::DenseMapBase<llvm::DenseMap<clang::FileEntryRef, 
clang::SrcMgr::ContentCache*, llvm::DenseMapInfo<clang::FileEntryRef, void>, 
llvm::detail::DenseMapPair<clang::FileEntryRef, clang::SrcMgr::ContentCache*> 
>, clang::FileEntryRef, clang::SrcMgr::ContentCache*, 
llvm::DenseMapInfo<clang::FileEntryRef, void>, 
llvm::detail::DenseMapPair<clang::FileEntryRef, clang::SrcMgr::ContentCache*> 
>::LookupBucketFor<clang::FileEntryRef> (this=this@entry=0x76e6100114d8,
    FoundBucket=@0x76e6357f64c8: 0x0, Val=...) at 
/data/llvm/include/llvm/ADT/DenseMap.h:667
1  0x00005923ebd448ca in llvm::DenseMapBase<llvm::DenseMap<clang::FileEntryRef, 
clang::SrcMgr::ContentCache*, llvm::DenseMapInfo<clang::FileEntryRef, void>, 
llvm::detail::DenseMapPair<clang::FileEntryRef, clang::SrcMgr::ContentCache*> 
>, clang::FileEntryRef, clang::SrcMgr::ContentCache*, 
llvm::DenseMapInfo<clang::FileEntryRef, void>, 
llvm::detail::DenseMapPair<clang::FileEntryRef, clang::SrcMgr::ContentCache*> 
>::findBucketForInsertion<clang::FileEntryRef> (
    this=0x76e6100114d8, Lookup=<synthetic pointer>..., TheBucket=<optimized 
out>) at /data/llvm/include/llvm/ADT/DenseMap.h:600
2  llvm::DenseMapBase<llvm::DenseMap<clang::FileEntryRef, 
clang::SrcMgr::ContentCache*, llvm::DenseMapInfo<clang::FileEntryRef, void>, 
llvm::detail::DenseMapPair<clang::FileEntryRef, clang::SrcMgr::ContentCache*> 
>, clang::FileEntryRef, clang::SrcMgr::ContentCache*, 
llvm::DenseMapInfo<clang::FileEntryRef, void>, 
llvm::detail::DenseMapPair<clang::FileEntryRef, clang::SrcMgr::ContentCache*> 
>::lookupOrInsertIntoBucket<clang::FileEntryRef const&> (
    this=0x76e6100114d8, Key=<synthetic pointer>...) at 
/data/llvm/include/llvm/ADT/DenseMap.h:510
3  llvm::DenseMapBase<llvm::DenseMap<clang::FileEntryRef, 
clang::SrcMgr::ContentCache*, llvm::DenseMapInfo<clang::FileEntryRef, void>, 
llvm::detail::DenseMapPair<clang::FileEntryRef, clang::SrcMgr::ContentCache*> 
>, clang::FileEntryRef, clang::SrcMgr::ContentCache*, 
llvm::DenseMapInfo<clang::FileEntryRef, void>, 
llvm::detail::DenseMapPair<clang::FileEntryRef, clang::SrcMgr::ContentCache*> 
>::operator[] (this=0x76e6100114d8, Key=<synthetic pointer>...)
    at /data/llvm/include/llvm/ADT/DenseMap.h:350
4  clang::SourceManager::getOrCreateContentCache (this=0x76e610011460, 
FileEnt=..., isSystemFile=<optimized out>)
    at /data/clang/lib/Basic/SourceManager.cpp:392
5  0x00005923ebd48cf3 in clang::SourceManager::createFileID 
(this=0x76e610011460, SourceFile=..., IncludePos=..., 
FileCharacter=clang::SrcMgr::C_User,
    LoadedID=0, LoadedOffset=0) at /data/clang/lib/Basic/SourceManager.cpp:543
6  0x00005923ebd49353 in clang::SourceManagerForFile::SourceManagerForFile 
(this=this@entry=0x76e6357f6640, FileName=..., Content=...)
    at /data/clang/include/clang/Basic/SourceLocation.h:90
7  0x00005923edcbdce6 in clang::tooling::(anonymous 
namespace)::withLexer<clang::tooling::(anonymous 
namespace)::getOffsetAfterTokenSequence(llvm::StringRef, llvm::StringRef, const 
clang::tooling::IncludeStyle&, llvm::function_ref<unsigned int(const 
clang::SourceManager&, clang::Lexer&, clang::Token&)>)::<lambda(const 
clang::SourceManager&, clang::Lexer&)> >(llvm::StringRef, llvm::StringRef, 
struct {...} &&, const clang::tooling::IncludeStyle &) (FileName=...,
    Code=..., Callback=..., Style=...) at 
/data/clang/lib/Tooling/Inclusions/HeaderIncludes.cpp:43
8  0x00005923edcc072e in clang::tooling::(anonymous 
namespace)::getOffsetAfterTokenSequence (FileName=..., Code=..., Style=...,
    GetOffsetAfterSequence=...) at 
/data/clang/lib/Tooling/Inclusions/HeaderIncludes.cpp:59
9  operator() (__closure=<synthetic pointer>, Consume=...) at 
/data/clang/lib/Tooling/Inclusions/HeaderIncludes.cpp:115
10 clang::tooling::(anonymous namespace)::getMinHeaderInsertionOffset 
(FileName=..., Code=..., Style=...)
    at /data/clang/lib/Tooling/Inclusions/HeaderIncludes.cpp:124
11 clang::tooling::HeaderIncludes::HeaderIncludes 
(this=this@entry=0x76e610001e20, FileName=..., Code=..., Style=...)
    at /data/clang/lib/Tooling/Inclusions/HeaderIncludes.cpp:356
12 0x00005923eca8b313 in clang::clangd::IncludeInserter::IncludeInserter 
(this=0x76e610001dd0, FileName=..., Code=..., Style=..., BuildDir=...,
    HeaderSearchInfo=<optimized out>, QuotedHeaders=..., AngledHeaders=...) at 
/data/clang-tools-extra/clangd/Headers.h:220
13 std::_Construct<clang::clangd::IncludeInserter, llvm::StringRef&, 
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > 
const&, clang::format::FormatStyle&, std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> >&, clang::HeaderSearch*, 
std::vector<std::function<bool(llvm::StringRef)>, 
std::allocator<std::function<bool(llvm::StringRef)> > > const&, 
std::vector<std::function<bool(llvm::StringRef)>, 
std::allocator<std::function<bool(llvm::StringRef)> > > const&> 
(__p=0x76e610001dd0) at /usr/include/c++/14/bits/stl_construct.h:119
14 std::allocator_traits<std::allocator<void> 
>::construct<clang::clangd::IncludeInserter, llvm::StringRef&, 
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > 
const&, clang::format::FormatStyle&, std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> >&, cla--Type <RET> for more, q to 
quit, c to continue without paging--
ng::HeaderSearch*, std::vector<std::function<bool(llvm::StringRef)>, 
std::allocator<std::function<bool(llvm::StringRef)> > > const&, 
std::vector<std::function<bool(llvm::StringRef)>, 
std::allocator<std::function<bool(llvm::StringRef)> > > const&> 
(__p=0x76e610001dd0)
    at /usr/include/c++/14/bits/alloc_traits.h:706
15 std::_Sp_counted_ptr_inplace<clang::clangd::IncludeInserter, 
std::allocator<void>, 
(__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<llvm::StringRef&, 
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > 
const&, clang::format::FormatStyle&, std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> >&, clang::HeaderSearch*, 
std::vector<std::function<bool(llvm::StringRef)>, 
std::allocator<std::function<bool(llvm::StringRef)> > > const&, 
std::vector<std::function<bool(llvm::StringRef)>, 
std::allocator<std::function<bool(llvm::StringRef)> > > const&> (
    this=0x76e610001dc0, __a=...) at 
/usr/include/c++/14/bits/shared_ptr_base.h:607
16 
std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<clang::clangd::IncludeInserter,
 std::allocator<void>, llvm::StringRef&, std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const&, 
clang::format::FormatStyle&, std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> >&, clang::HeaderSearch*, 
std::vector<std::function<bool(llvm::StringRef)>, 
std::allocator<std::function<bool(llvm::StringRef)> > > const&, 
std::vector<std::function<bool(llvm::StringRef)>, 
std::allocator<std::function<bool(llvm::StringRef)> > > const&> 
(this=<synthetic pointer>,
    __p=<synthetic pointer>: <optimized out>, __a=...) at 
/usr/include/c++/14/bits/shared_ptr_base.h:969
17 std::__shared_ptr<clang::clangd::IncludeInserter, 
(__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<void>, 
llvm::StringRef&, std::__cxx11::basic_string<char, std::char_traits<char>, 
std::allocator<char> > const&, clang::format::FormatStyle&, 
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> 
>&, clang::HeaderSearch*, std::vector<std::function<bool(llvm::StringRef)>, 
std::allocator<std::function<bool(llvm::StringRef)> > > const&, 
std::vector<std::function<bool(llvm::StringRef)>, 
std::allocator<std::function<bool(llvm::StringRef)> > > const&> 
(this=<synthetic pointer>, __tag=...)
    at /usr/include/c++/14/bits/shared_ptr_base.h:1713
18 
std::shared_ptr<clang::clangd::IncludeInserter>::shared_ptr<std::allocator<void>,
 llvm::StringRef&, std::__cxx11::basic_string<char, std::char_traits<char>, 
std::allocator<char> > const&, clang::format::FormatStyle&, 
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> 
>&, clang::HeaderSearch*, std::vector<std::function<bool(llvm::StringRef)>, 
std::allocator<std::function<bool(llvm::StringRef)> > > const&, 
std::vector<std::function<bool(llvm::StringRef)>, 
std::allocator<std::function<bool(llvm::StringRef)> > > const&> 
(this=<synthetic pointer>, __tag=...)
    at /usr/include/c++/14/bits/shared_ptr.h:463
19 std::make_shared<clang::clangd::IncludeInserter, llvm::StringRef&, 
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > 
const&, clang::format::FormatStyle&, std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> >&, clang::HeaderSearch*, 
std::vector<std::function<bool(llvm::StringRef)>, 
std::allocator<std::function<bool(llvm::StringRef)> > > const&, 
std::vector<std::function<bool(llvm::StringRef)>, 
std::allocator<std::function<bool(llvm::StringRef)> > > const&> () at 
/usr/include/c++/14/bits/shared_ptr.h:1008
20 clang::clangd::ParsedAST::build (Filename=..., Inputs=..., 
CI=std::unique_ptr<clang::CompilerInvocation> = {...}, 
CompilerInvocationDiags=...,
    Preamble=std::shared_ptr<const clang::clangd::PreambleData> (empty) = 
{...}) at /data/clang-tools-extra/clangd/ParsedAST.cpp:644
21 0x00005923ecb0df5c in operator() (__closure=0x59240a531dc0) at 
/data/clang-tools-extra/clangd/TUScheduler.cpp:998
22 0x00005923ecb06736 in llvm::function_ref<void()>::operator() 
(this=<synthetic pointer>) at 
/data/llvm/include/llvm/ADT/STLFunctionalExtras.h:68
23 clang::clangd::(anonymous namespace)::ASTWorker::runTask 
(this=this@entry=0x59240a530c50, Name=..., Task=...)
    at /data/clang-tools-extra/clangd/TUScheduler.cpp:1327
24 0x00005923ecb085c6 in clang::clangd::(anonymous namespace)::ASTWorker::run 
(this=0x59240a530c50) at /data/clang-tools-extra/clangd/TUScheduler.cpp:1461
25 0x00005923eccc77fe in llvm::unique_function<void()>::operator() 
(this=0x59240a539140) at /data/llvm/include/llvm/ADT/FunctionExtras.h:364
26 operator() (__closure=0x59240a539120) at 
/data/clang-tools-extra/clangd/support/Threading.cpp:101
27 operator()<clang::clangd::AsyncTaskRunner::runAsync(const llvm::Twine&, 
llvm::unique_function<void()>)::<lambda()>&> (__closure=<optimized out>, F=...)
    at /data/llvm/include/llvm/Support/thread.h:46
28 std::__invoke_impl<void, 
llvm::thread::GenericThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(const
 llvm::Twine&, llvm::unique_function<void()>)::<lambda()> > 
>(void*)::<lambda(auto:5&&, auto:6&& ...)>, 
clang::clangd::AsyncTaskRunner::runAsync(const llvm::Twine&, 
llvm::unique_function<void()>)::<lambda()>&> (__f=...) at 
/usr/include/c++/14/bits/invoke.h:61
--Type <RET> for more, q to quit, c to continue without paging--
29 
std::__invoke<llvm::thread::GenericThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(const
 llvm::Twine&, llvm::unique_function<void()>)::<lambda()> > 
>(void*)::<lambda(auto:5&&, auto:6&& ...)>, 
clang::clangd::AsyncTaskRunner::runAsync(const llvm::Twine&, 
llvm::unique_function<void()>)::<lambda()>&> (__fn=...) at 
/usr/include/c++/14/bits/invoke.h:96
30 
std::__apply_impl<llvm::thread::GenericThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(const
 llvm::Twine&, llvm::unique_function<void()>)::<lambda()> > 
>(void*)::<lambda(auto:5&&, auto:6&& ...)>, 
std::tuple<clang::clangd::AsyncTaskRunner::runAsync(const llvm::Twine&, 
llvm::unique_function<void()>)::<lambda()> >&, 0> (__f=..., __t=std::tuple 
containing = {...}) at /usr/include/c++/14/tuple:2923
31 
std::apply<llvm::thread::GenericThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(const
 llvm::Twine&, llvm::unique_function<void()>)::<lambda()> > 
>(void*)::<lambda(auto:5&&, auto:6&& ...)>, 
std::tuple<clang::clangd::AsyncTaskRunner::runAsync(const llvm::Twine&, 
llvm::unique_function<void()>)::<lambda()> >&> (__f=..., __t=std::tuple 
containing = {...}) at /usr/include/c++/14/tuple:2938
32 
llvm::thread::GenericThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(const
 llvm::Twine&, llvm::unique_function<void()>)::<lambda()> > >
    (Ptr=0x59240a539120) at /data/llvm/include/llvm/Support/thread.h:44
33 
llvm::thread::ThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(const
 llvm::Twine&, llvm::unique_function<void()>)::<lambda()> > >(void *) 
(Ptr=0x59240a539120) at /data/llvm/include/llvm/Support/thread.h:62
34 0x000076e63e1c2b7b in ?? () from /lib/x86_64-linux-gnu/libc.so.6
35 0x000076e63e2405f0 in clone () from /lib/x86_64-linux-gnu/libc.so.6

https://github.com/llvm/llvm-project/pull/177834
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to