<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/109297>109297</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            vscode clangd crash in envoy dev environment
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ravenblackx
      </td>
    </tr>
</table>

<pre>
    Crashing while work in progress on some envoy code.

I made [a branch](https://github.com/ravenblackx/envoy/tree/cache_upstream_for_clangd) to capture the complete code state at the time of the crash - this occurred within a few seconds of starting up the window with the code in this state and only the [cache_filter.cc](https://github.com/ravenblackx/envoy/blob/cache_upstream_for_clangd/source/extensions/filters/http/cache/cache_filter.cc) tab open.

The compilation database has been freshly generated (I don't know if that's relevant) via envoy's [script for that purpose](https://github.com/ravenblackx/envoy/blob/cache_upstream_for_clangd/tools/vscode/refresh_compdb.sh).

I definitely don't expect it to compile in this half-modified state, but I also would prefer not to expect the clangd server to crash and drop core dumps into my workspace. :)

<details>
<summary>Stack trace and surrounding log</summary>
```
I[14:44:53.854] <-- reply(1)
I[14:44:53.854] --> reply:textDocument/documentSymbol(9) 3439 ms
I[14:44:53.855] --> reply:textDocument/hover(10) 1997 ms, error: Task was cancelled.
I[14:44:53.855] --> reply:textDocument/hover(11) 465 ms, error: Task was cancelled.
I[14:44:53.855] --> textDocument/clangd.fileStatus
[Error - 2:44:53 PM] Request textDocument/hover failed.
[object Object]
[Error - 2:44:53 PM] Request textDocument/hover failed.
[object Object]
 #0 0x000000000053b893 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/llvm/bin/clangd+0x53b893)
 #1 0x000000000053991c llvm::sys::RunSignalHandlers() (/opt/llvm/bin/clangd+0x53991c)
 #2 0x000000000053bbff SignalHandler(int) Signals.cpp:0:0
 #3 0x00007905fa3f0420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00000000006d0a4f clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous namespace)::RecordExprEvaluator, bool>::Visit(clang::Stmt const*) ExprConstant.cpp:0:0
 #5 0x0000000000687e44 EvaluateInPlace(clang::APValue&, (anonymous namespace)::EvalInfo&, (anonymous namespace)::LValue const&, clang::Expr const*, bool) ExprConstant.cpp:0:0
 #6 0x0000000000687ab4 clang::Expr::EvaluateAsConstantExpr(clang::Expr::EvalResult&, clang::ASTContext const&, clang::Expr::ConstantExprKind) const (/opt/llvm/bin/clangd+0x687ab4)
 #7 0x0000000001aa0a90 clang::Sema::PopExpressionEvaluationContext() (/opt/llvm/bin/clangd+0x1aa0a90)
 #8 0x000000000196a9c8 clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool) (/opt/llvm/bin/clangd+0x196a9c8)
 #9 0x00000000016b4c1d clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/llvm/bin/clangd+0x16b4c1d)
#10 0x0000000001613baf clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/llvm/bin/clangd+0x1613baf)
#11 0x000000000162f519 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/llvm/bin/clangd+0x162f519)
#12 0x0000000001612b0b clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/llvm/bin/clangd+0x1612b0b)
#13 0x00000000016125dc clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/llvm/bin/clangd+0x16125dc)
#14 0x0000000001611afe clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/opt/llvm/bin/clangd+0x1611afe)
#15 0x00000000016419a3 clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (/opt/llvm/bin/clangd+0x16419a3)
#16 0x0000000001641582 clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) (/opt/llvm/bin/clangd+0x1641582)
#17 0x00000000016294a9 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributesWithRange&, clang::SourceLocation*) (/opt/llvm/bin/clangd+0x16294a9)
#18 0x00000000016112c3 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/opt/llvm/bin/clangd+0x16112c3)
#19 0x00000000016419a3 clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (/opt/llvm/bin/clangd+0x16419a3)
#20 0x0000000001641582 clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) (/opt/llvm/bin/clangd+0x1641582)
#21 0x00000000016294a9 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributesWithRange&, clang::SourceLocation*) (/opt/llvm/bin/clangd+0x16294a9)
#22 0x00000000016112c3 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/opt/llvm/bin/clangd+0x16112c3)
#23 0x00000000016419a3 clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (/opt/llvm/bin/clangd+0x16419a3)
#24 0x0000000001641582 clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) (/opt/llvm/bin/clangd+0x1641582)
#25 0x00000000016294a9 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributesWithRange&, clang::SourceLocation*) (/opt/llvm/bin/clangd+0x16294a9)
#26 0x00000000016112c3 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/opt/llvm/bin/clangd+0x16112c3)
#27 0x00000000016419a3 clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (/opt/llvm/bin/clangd+0x16419a3)
#28 0x0000000001641582 clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) (/opt/llvm/bin/clangd+0x1641582)
#29 0x00000000016294a9 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributesWithRange&, clang::SourceLocation*) (/opt/llvm/bin/clangd+0x16294a9)
#30 0x00000000016112c3 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/opt/llvm/bin/clangd+0x16112c3)
#31 0x0000000001610218 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) (/opt/llvm/bin/clangd+0x1610218)
#32 0x000000000160fd97 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) (/opt/llvm/bin/clangd+0x160fd97)
#33 0x000000000160c48c clang::ParseAST(clang::Sema&, bool, bool) (/opt/llvm/bin/clangd+0x160c48c)
#34 0x000000000145b719 clang::FrontendAction::Execute() (/opt/llvm/bin/clangd+0x145b719)
#35 0x0000000000c1a2b1 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>) (/opt/llvm/bin/clangd+0xc1a2b1)
#36 0x0000000000c90a37 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)::$_2::operator()() TUScheduler.cpp:0:0
#37 0x0000000000c8c56a clang::clangd::(anonymous namespace)::ASTWorker::runTask(llvm::StringRef, llvm::function_ref<void ()>) TUScheduler.cpp:0:0
#38 0x0000000000c8bfde void llvm::detail::UniqueFunctionBase<void>::CallImpl<clang::clangd::(anonymous namespace)::ASTWorker::create(llvm::StringRef, clang::clangd::GlobalCompilationDatabase const&, clang::clangd::TUScheduler::ASTCache&, clang::clangd::TUScheduler::HeaderIncluderCache&, clang::clangd::AsyncTaskRunner*, clang::clangd::Semaphore&, clang::clangd::TUScheduler::Options const&, clang::clangd::ParsingCallbacks&)::$_6>(void*) TUScheduler.cpp:0:0
#39 0x0000000000e17ef2 void* llvm::thread::ThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::$_1> >(void*) Threading.cpp:0:0
#40 0x00007905fa3e4609 start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x8609)
#41 0x00007905f9f15353 __clone (/lib/x86_64-linux-gnu/libc.so.6+0x11f353)
Signalled during AST worker action: Build AST
  Filename: source/extensions/filters/http/cache/cache_filter.cc
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWl1zo7jS_jXKjSouEGDDRS4cJ95NvfOeSY2zu5cuIRpbJ0JiJeHE__6UBLGBfDk7OR87u1MzGWKk7ud51N1ukKgxfCMBLlByiZKrM9rYrdIXmu5A5oKy-8ezXBX7i4WmZsvlBj9suQD8oP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