Skip to content
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

clangd crashes on hover #263

Closed
hokein opened this issue Jan 23, 2020 · 1 comment
Closed

clangd crashes on hover #263

hokein opened this issue Jan 23, 2020 · 1 comment
Assignees
Labels
bug

Comments

@hokein
Copy link
Contributor

@hokein hokein commented Jan 23, 2020

namespace std {
  template<typename T>
  class vector {};
}
std::vector<int>* foo();

void kk() {
  au^to *s = foo();
}

stack trace:

  0 0x00000000004ccbcf llvm::sys::PrintStackTrace(llvm::raw_ostream&)   /workspace/llvm-project/llvm/lib/Support/Unix/Signals.inc:564:13
 #1 0x00000000004cacd2 llvm::sys::RunSignalHandlers()   /workspace/llvm-project/llvm/lib/Support/Signals.cpp:69:18
 #2 0x00000000004ccf1c SignalHandler(int)   /workspace/llvm-project/llvm/lib/Support/Unix/Signals.inc:396:3
 #3 0x00007f696eb183a0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x123a0)
 #4 0x00000000009c17ae clang::Decl::getKind() const   /workspace/llvm-project/clang/include/clang/AST/DeclBase.h:432:51
 #5 0x00000000009c17ae clang::NamespaceDecl::classof(clang::Decl const*)   /workspace/llvm-project/clang/include/clang/AST/Decl.h:606:0
 #6 0x00000000009c17ae llvm::isa_impl<clang::NamespaceDecl, clang::NamedDecl, void>::doit(clang::NamedDecl const&)   /workspace/llvm-project/llvm/include/llvm/Support/Casting.h:58:0
 #7 0x00000000009c17ae llvm::isa_impl_cl<clang::NamespaceDecl, clang::NamedDecl const>::doit(clang::NamedDecl const&)   /workspace/llvm-project/llvm/include/llvm/Support/Casting.h:77:0
 #8 0x00000000009c17ae llvm::isa_impl_wrap<clang::NamespaceDecl, clang::NamedDecl const, clang::NamedDecl const>::doit(clang::NamedDecl const&)   /workspace/llvm-project/llvm/include/llvm/Support/Casting.h:132:0
 #9 0x00000000009c17ae bool llvm::isa<clang::NamespaceDecl, clang::NamedDecl>(clang::NamedDecl const&)   /workspace/llvm-project/llvm/include/llvm/Support/Casting.h:142:0
#10 0x00000000009c17ae clang::clangd::getDeclComment[abi:cxx11](clang::ASTContext const&, clang::NamedDecl const&)   /workspace/llvm-project/clang-tools-extra/clangd/CodeCompletionStrings.cpp:74:0
#11 0x0000000000a07872 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/basic_string.h:176:28
#12 0x0000000000a07872 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/basic_string.h:211:0
#13 0x0000000000a07872 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/basic_string.h:747:0
#14 0x0000000000a07872 clang::clangd::(anonymous namespace)::getHoverContents(clang::QualType, clang::ASTContext&, clang::clangd::SymbolIndex const*)   /workspace/llvm-project/clang-tools-extra/clangd/Hover.cpp:389:0
#15 0x0000000000a07872 clang::clangd::getHover(clang::clangd::ParsedAST&, clang::clangd::Position, clang::format::FormatStyle, clang::clangd::SymbolIndex const*)   /workspace/llvm-project/clang-tools-extra/clangd/Hover.cpp:483:0
#16 0x00000000009a19bb llvm::Expected<llvm::Optional<clang::clangd::HoverInfo> >::Expected<llvm::Optional<clang::clangd::HoverInfo> >(llvm::Optional<clang::clangd::HoverInfo>&&, std::enable_if<std::is_convertible<llvm::Optional<clang::clangd::HoverInfo>, llvm::Optional<clang::clangd::HoverInfo> >::value, void>::type*)   /workspace/llvm-project/llvm/include/llvm/Support/Error.h:477:9
#17 0x00000000009a19bb clang::clangd::ClangdServer::findHover(llvm::StringRef, clang::clangd::Position, llvm::unique_function<void (llvm::Expected<llvm::Optional<clang::clangd::HoverInfo> >)>)::$_10::operator()(llvm::Expected<clang::clangd::InputsAndAST>)   /workspace/llvm-project/clang-tools-extra/clangd/ClangdServer.cpp:525:0
@hokein hokein added the bug label Jan 23, 2020
@kadircet
Copy link
Member

@kadircet kadircet commented Jan 27, 2020

This also affects findtarget and typehierarchy, as discussed in https://reviews.llvm.org/D73344. Because this boils down to having incomplete types in the AST.

kadircet added a commit to llvm/llvm-project that referenced this issue Jan 28, 2020
Summary: Fixes clangd/clangd#263

Reviewers: hokein, sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D73344

(cherry picked from commit a31a61d)
arichardson added a commit to arichardson/llvm-project that referenced this issue Apr 1, 2020
Summary: Fixes clangd/clangd#263

Reviewers: hokein, sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D73344
shrouxm pushed a commit to sourcegraph/lsif-clang that referenced this issue Jul 12, 2020
Summary: Fixes clangd/clangd#263

Reviewers: hokein, sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D73344

(cherry picked from commit a31a61dafeaa9110687110fc127ea6f7c91dd3e6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants