Skip to content

[clang-tidy] crash in cppcoreguidelines-owning-memory when capturing unique_ptr in lambda #106444

@deeedob

Description

@deeedob

Hey, this just happened to me on:

clangd --version
clangd version 18.1.3 (https://github.com/llvm/llvm-project c13b748)
Features: linux+grpc
Platform: x86_64-unknown-linux-gnu

I could boil it down to the following:

#include <memory>

int main(int argc, char* argv[])
{
    const auto uptr = std::make_unique<int>(250);
    [uptr](){
    }();

    return 0;
}

this code instantly crashes clangd with signal 11. It has to be something specifically about {unique, smart}_ptrs? no crash when capturing primitives at least...

Debug log + stack trace:

[START][2024-08-28 21:29:10] LSP logging initiated
[INFO][2024-08-28 21:29:10] .../vim/lsp/rpc.lua:733	"Starting RPC client"	{  cmd = { "/home/ddob/.local/share/nvim/mason/bin/clangd", "--all-scopes-completion", "--clang-tidy", "--header-insertion=never", "--completion-style=detailed", "--header-insertion=iwyu", "--function-arg-placeholders", "--enable-config", "-j=16", "--malloc-trim", "--background-index", "--pch-storage=memory", "--compile-commands-dir=/home/ddob/Coding/clangd_lambda_capture_cash/out/${variant:buildType}" },  extra = {    cwd = "/home/ddob/Coding/clangd_lambda_capture_cash"  }}
[DEBUG][2024-08-28 21:29:10] .../vim/lsp/rpc.lua:286	"rpc.send"	{  id = 1,  jsonrpc = "2.0",  method = "initialize",  params = {    capabilities = {      general = {        positionEncodings = { "utf-16" }      },      offsetEncoding = { "utf-8", "utf-16" },      textDocument = {        callHierarchy = {          dynamicRegistration = false        },        codeAction = {          codeActionLiteralSupport = {            codeActionKind = {              valueSet = { "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }            }          },          dataSupport = true,          dynamicRegistration = true,          isPreferredSupport = true,          resolveSupport = {            properties = { "edit" }          }        },        completion = {          completionItem = {            commitCharactersSupport = true,            deprecatedSupport = true,            documentationFormat = { "markdown", "plaintext" },            insertReplaceSupport = true,            insertTextModeSupport = {              valueSet = { 1, 2 }            },            labelDetailsSupport = true,            preselectSupport = true,            resolveSupport = {              properties = { "documentation", "detail", "additionalTextEdits", "sortText", "filterText", "insertText", "textEdit", "insertTextFormat", "insertTextMode" }            },            snippetSupport = true,            tagSupport = {              valueSet = { 1 }            }          },          completionItemKind = {            valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }          },          completionList = {            itemDefaults = { "commitCharacters", "editRange", "insertTextFormat", "insertTextMode", "data" }          },          contextSupport = true,          dynamicRegistration = false,          editsNearCursor = true,          insertTextMode = 1        },        declaration = {          linkSupport = true        },        definition = {          dynamicRegistration = true,          linkSupport = true        },        diagnostic = {          dynamicRegistration = false        },        documentHighlight = {          dynamicRegistration = false        },        documentSymbol = {          dynamicRegistration = false,          hierarchicalDocumentSymbolSupport = true,          symbolKind = {            valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }          }        },        formatting = {          dynamicRegistration = true        },        hover = {          contentFormat = { "markdown", "plaintext" },          dynamicRegistration = true        },        implementation = {          linkSupport = true        },        inlayHint = {          dynamicRegistration = true,          resolveSupport = {            properties = { "textEdits", "tooltip", "location", "command" }          }        },        publishDiagnostics = {          dataSupport = true,          relatedInformation = true,          tagSupport = {            valueSet = { 1, 2 }          }        },        rangeFormatting = {          dynamicRegistration = true,          rangesSupport = true        },        references = {          dynamicRegistration = false        },        rename = {          dynamicRegistration = true,          prepareSupport = true        },        semanticTokens = {          augmentsSyntaxTokens = true,          dynamicRegistration = false,          formats = { "relative" },          multilineTokenSupport = false,          overlappingTokenSupport = true,          requests = {            full = {              delta = true            },            range = false          },          serverCancelSupport = false,          tokenModifiers = { "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" },          tokenTypes = { "namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "operator", "decorator" }        },        signatureHelp = {          dynamicRegistration = false,          signatureInformation = {            activeParameterSupport = true,            documentationFormat = { "markdown", "plaintext" },            parameterInformation = {              labelOffsetSupport = true            }          }        },        synchronization = {          didSave = true,          dynamicRegistration = false,          willSave = true,          willSaveWaitUntil = true        },        typeDefinition = {          linkSupport = true        }      },      window = {        showDocument = {          support = true        },        showMessage = {          messageActionItem = {            additionalPropertiesSupport = false          }        },        workDoneProgress = true      },      workspace = {        applyEdit = true,        configuration = true,        didChangeConfiguration = {          dynamicRegistration = false        },        didChangeWatchedFiles = {          dynamicRegistration = false,          relativePatternSupport = true        },        inlayHint = {          refreshSupport = true        },        semanticTokens = {          refreshSupport = true        },        symbol = {          dynamicRegistration = false,          symbolKind = {            valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }          }        },        workspaceEdit = {          resourceOperations = { "rename", "create", "delete" }        },        workspaceFolders = true      }    },    clientInfo = {      name = "Neovim",      version = "0.11.0-dev+g5de2ae2bce"    },    initializationOptions = {      completeUnimported = true,      usePlaceholders = true    },    processId = 17709,    rootPath = vim.NIL,    rootUri = vim.NIL,    trace = "off",    workDoneToken = "1",    workspaceFolders = vim.NIL  }}
[DEBUG][2024-08-28 21:29:10] .../vim/lsp/rpc.lua:408	"rpc.receive"	{  id = 1,  jsonrpc = "2.0",  result = {    capabilities = {      astProvider = true,      callHierarchyProvider = true,      clangdInlayHintsProvider = true,      codeActionProvider = {        codeActionKinds = { "quickfix", "refactor", "info" }      },      compilationDatabase = {        automaticReload = true      },      completionProvider = {        resolveProvider = false,        triggerCharacters = { ".", "<", ">", ":", '"', "/", "*" }      },      declarationProvider = true,      definitionProvider = true,      documentFormattingProvider = true,      documentHighlightProvider = true,      documentLinkProvider = {        resolveProvider = false      },      documentOnTypeFormattingProvider = {        firstTriggerCharacter = "
",        moreTriggerCharacter = {}      },      documentRangeFormattingProvider = true,      documentSymbolProvider = true,      executeCommandProvider = {        commands = { "clangd.applyFix", "clangd.applyTweak" }      },      foldingRangeProvider = true,      hoverProvider = true,      implementationProvider = true,      inactiveRegionsProvider = true,      inlayHintProvider = true,      memoryUsageProvider = true,      referencesProvider = true,      renameProvider = {        prepareProvider = true      },      selectionRangeProvider = true,      semanticTokensProvider = {        full = {          delta = true        },        legend = {          tokenModifiers = { "declaration", "definition", "deprecated", "deduced", "readonly", "static", "abstract", "virtual", "dependentName", "defaultLibrary", "usedAsMutableReference", "usedAsMutablePointer", "constructorOrDestructor", "userDefined", "functionScope", "classScope", "fileScope", "globalScope" },          tokenTypes = { "variable", "variable", "parameter", "function", "method", "function", "property", "variable", "class", "interface", "enum", "enumMember", "type", "type", "unknown", "namespace", "typeParameter", "concept", "type", "macro", "modifier", "operator", "bracket", "label", "comment" }        },        range = false      },      signatureHelpProvider = {        triggerCharacters = { "(", ")", "{", "}", "<", ">", "," }      },      standardTypeHierarchyProvider = true,      textDocumentSync = {        change = 2,        openClose = true,        save = true      },      typeDefinitionProvider = true,      typeHierarchyProvider = true,      workspaceSymbolProvider = true    },    offsetEncoding = "utf-8",    serverInfo = {      name = "clangd",      version = "clangd version 18.1.3 (https://github.com/llvm/llvm-project c13b7485b87909fcf739f62cfa382b55407433c0) linux+grpc x86_64-unknown-linux-gnu"    }  }}
[ERROR][2024-08-28 21:29:10] .../vim/lsp/rpc.lua:772	"rpc"	"/home/ddob/.local/share/nvim/mason/bin/clangd"	"stderr"	"I[21:29:10.737] clangd version 18.1.3 (https://github.com/llvm/llvm-project c13b7485b87909fcf739f62cfa382b55407433c0)
I[21:29:10.737] Features: linux+grpc
I[21:29:10.737] PID: 17714
I[21:29:10.737] Working directory: /home/ddob/Coding/clangd_lambda_capture_cash
I[21:29:10.737] argv[0]: /home/ddob/.local/share/nvim/mason/bin/clangd
I[21:29:10.737] argv[1]: --all-scopes-completion
I[21:29:10.737] argv[2]: --clang-tidy
I[21:29:10.737] argv[3]: --header-insertion=never
I[21:29:10.737] argv[4]: --completion-style=detailed
I[21:29:10.737] argv[5]: --header-insertion=iwyu
I[21:29:10.737] argv[6]: --function-arg-placeholders
I[21:29:10.737] argv[7]: --enable-config
I[21:29:10.737] argv[8]: -j=16
I[21:29:10.737] argv[9]: --malloc-trim
I[21:29:10.737] argv[10]: --background-index
I[21:29:10.737] argv[11]: --pch-storage=memory
I[21:29:10.737] argv[12]: --compile-commands-dir=/home/ddob/Coding/clangd_lambda_capture_cash/out/${variant:buildType}
E[21:29:10.737] Path specified by --compile-commands-dir does not exist. The argument will be ignored.
I[21:29:10.737] Starting LSP over stdin/stdout
I[21:29:10.738] <-- initialize(1)
I[21:29:10.739] --> reply:initialize(1) 0 ms
"
[DEBUG][2024-08-28 21:29:10] .../vim/lsp/rpc.lua:286	"rpc.send"	{  jsonrpc = "2.0",  method = "initialized",  params = vim.empty_dict()}
[DEBUG][2024-08-28 21:29:10] .../vim/lsp/rpc.lua:286	"rpc.send"	{  jsonrpc = "2.0",  method = "textDocument/didOpen",  params = {    textDocument = {      languageId = "cpp",      text = "#include <memory>

int main(int argc, char* argv[])
{
    const auto uptr = std::make_unique<int>(250);
    [uptr](){
    }();

    return 0;
}
",      uri = "file:///home/ddob/Coding/clangd_lambda_capture_cash/main.cpp",      version = 0    }  }}
[INFO][2024-08-28 21:29:10] ...m/lsp/client.lua:620	"LSP[clangd]"	"server_capabilities"	{  server_capabilities = {    astProvider = true,    callHierarchyProvider = true,    clangdInlayHintsProvider = true,    codeActionProvider = {      codeActionKinds = { "quickfix", "refactor", "info" }    },    compilationDatabase = {      automaticReload = true    },    completionProvider = {      resolveProvider = false,      triggerCharacters = { ".", "<", ">", ":", '"', "/", "*" }    },    declarationProvider = true,    definitionProvider = true,    documentFormattingProvider = true,    documentHighlightProvider = true,    documentLinkProvider = {      resolveProvider = false    },    documentOnTypeFormattingProvider = {      firstTriggerCharacter = "
",      moreTriggerCharacter = {}    },    documentRangeFormattingProvider = true,    documentSymbolProvider = true,    executeCommandProvider = {      commands = { "clangd.applyFix", "clangd.applyTweak" }    },    foldingRangeProvider = true,    hoverProvider = true,    implementationProvider = true,    inactiveRegionsProvider = true,    inlayHintProvider = true,    memoryUsageProvider = true,    referencesProvider = true,    renameProvider = {      prepareProvider = true    },    selectionRangeProvider = true,    semanticTokensProvider = {      full = {        delta = true      },      legend = {        tokenModifiers = { "declaration", "definition", "deprecated", "deduced", "readonly", "static", "abstract", "virtual", "dependentName", "defaultLibrary", "usedAsMutableReference", "usedAsMutablePointer", "constructorOrDestructor", "userDefined", "functionScope", "classScope", "fileScope", "globalScope" },        tokenTypes = { "variable", "variable", "parameter", "function", "method", "function", "property", "variable", "class", "interface", "enum", "enumMember", "type", "type", "unknown", "namespace", "typeParameter", "concept", "type", "macro", "modifier", "operator", "bracket", "label", "comment" }      },      range = false    },    signatureHelpProvider = {      triggerCharacters = { "(", ")", "{", "}", "<", ">", "," }    },    standardTypeHierarchyProvider = true,    textDocumentSync = {      change = 2,      openClose = true,      save = true    },    typeDefinitionProvider = true,    typeHierarchyProvider = true,    workspaceSymbolProvider = true  }}
[ERROR][2024-08-28 21:29:10] .../vim/lsp/rpc.lua:772	"rpc"	"/home/ddob/.local/share/nvim/mason/bin/clangd"	"stderr"	"I[21:29:10.786] <-- initialized
I[21:29:10.786] <-- textDocument/didOpen
I[21:29:10.787] --> textDocument/publishDiagnostics
I[21:29:10.787] Failed to find compilation database for /home/ddob/Coding/clangd_lambda_capture_cash/main.cpp
I[21:29:10.787] ASTWorker building file /home/ddob/Coding/clangd_lambda_capture_cash/main.cpp version 0 with command clangd fallback
[/home/ddob/Coding/clangd_lambda_capture_cash]
/usr/bin/clang -xc++ -std=c++23 -D__cpp_concepts=202002L -Wall -Wextra -Werror -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wpedantic -Wconversion -Wsign-conversion -Wnull-dereference -Wdouble-promotion -Wformat=2 -Wimplicit-fallthrough -I/usr/lib/clang/17/include -resource-dir=/home/ddob/.local/share/nvim/mason/packages/clangd/clangd_18.1.3/lib/clang/18 -- /home/ddob/Coding/clangd_lambda_capture_cash/main.cpp
"
[DEBUG][2024-08-28 21:29:10] .../vim/lsp/rpc.lua:408	"rpc.receive"	{  jsonrpc = "2.0",  method = "textDocument/publishDiagnostics",  params = {    diagnostics = {},    uri = "file:///home/ddob/.config/clangd/config.yaml"  }}
[DEBUG][2024-08-28 21:29:10] ...m/lsp/client.lua:678	"LSP[clangd]"	"client.request"	1	"textDocument/semanticTokens/full"	{  textDocument = {    uri = "file:///home/ddob/Coding/clangd_lambda_capture_cash/main.cpp"  }}	<function 1>	1
[DEBUG][2024-08-28 21:29:10] .../vim/lsp/rpc.lua:286	"rpc.send"	{  id = 2,  jsonrpc = "2.0",  method = "textDocument/semanticTokens/full",  params = {    textDocument = {      uri = "file:///home/ddob/Coding/clangd_lambda_capture_cash/main.cpp"    }  }}
[ERROR][2024-08-28 21:29:10] .../vim/lsp/rpc.lua:772	"rpc"	"/home/ddob/.local/share/nvim/mason/bin/clangd"	"stderr"	"I[21:29:10.799] <-- textDocument/semanticTokens/full(2)
"
[ERROR][2024-08-28 21:29:11] .../vim/lsp/rpc.lua:772	"rpc"	"/home/ddob/.local/share/nvim/mason/bin/clangd"	"stderr"	"I[21:29:11.100] Built preamble of size 7920552 for file /home/ddob/Coding/clangd_lambda_capture_cash/main.cpp version 0 in 0.31 seconds
"
[ERROR][2024-08-28 21:29:11] .../vim/lsp/rpc.lua:772	"rpc"	"/home/ddob/.local/share/nvim/mason/bin/clangd"	"stderr"	"I[21:29:11.100] --> workspace/semanticTokens/refresh(0)
I[21:29:11.100] Indexing c++23 standard library in the context of /home/ddob/Coding/clangd_lambda_capture_cash/main.cpp
"
[DEBUG][2024-08-28 21:29:11] .../vim/lsp/rpc.lua:408	"rpc.receive"	{  id = 0,  jsonrpc = "2.0",  method = "workspace/semanticTokens/refresh"}
[DEBUG][2024-08-28 21:29:11] .../vim/lsp/rpc.lua:286	"rpc.send"	{  jsonrpc = "2.0",  method = "$/cancelRequest",  params = {    id = 2  }}
[DEBUG][2024-08-28 21:29:11] ...m/lsp/client.lua:678	"LSP[clangd]"	"client.request"	1	"textDocument/semanticTokens/full"	{  textDocument = {    uri = "file:///home/ddob/Coding/clangd_lambda_capture_cash/main.cpp"  }}	<function 1>	1
[DEBUG][2024-08-28 21:29:11] .../vim/lsp/rpc.lua:286	"rpc.send"	{  id = 3,  jsonrpc = "2.0",  method = "textDocument/semanticTokens/full",  params = {    textDocument = {      uri = "file:///home/ddob/Coding/clangd_lambda_capture_cash/main.cpp"    }  }}
[DEBUG][2024-08-28 21:29:11] .../vim/lsp/rpc.lua:425	"server_request: callback result"	{  result = vim.NIL,  status = true}
[DEBUG][2024-08-28 21:29:11] .../vim/lsp/rpc.lua:286	"rpc.send"	{  id = 0,  jsonrpc = "2.0",  result = vim.NIL}
[ERROR][2024-08-28 21:29:11] .../vim/lsp/rpc.lua:772	"rpc"	"/home/ddob/.local/share/nvim/mason/bin/clangd"	"stderr"	"I[21:29:11.101] <-- $/cancelRequest
I[21:29:11.101] <-- textDocument/semanticTokens/full(3)
"
[ERROR][2024-08-28 21:29:11] .../vim/lsp/rpc.lua:772	"rpc"	"/home/ddob/.local/share/nvim/mason/bin/clangd"	"stderr"	"I[21:29:11.101] <-- reply(0)
"
[ERROR][2024-08-28 21:29:11] .../vim/lsp/rpc.lua:772	"rpc"	"/home/ddob/.local/share/nvim/mason/bin/clangd"	"stderr"	"PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.\tASTMatcher: Matching 'cppcoreguidelines-owning-memory' against:
\tFunctionDecl main : </home/ddob/Coding/clangd_lambda_capture_cash/main.cpp:3:1, line:10:1>
"
[ERROR][2024-08-28 21:29:11] .../vim/lsp/rpc.lua:772	"rpc"	"/home/ddob/.local/share/nvim/mason/bin/clangd"	"stderr"	" #0 0x00000000004f680b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /__w/clangd/clangd/llvm-project/llvm/lib/Support/Unix/Signals.inc:723:13
 #1 0x00000000004f464e llvm::sys::RunSignalHandlers() /__w/clangd/clangd/llvm-project/llvm/lib/Support/Signals.cpp:106:18
 #2 0x00000000004f7196 SignalHandler(int) /__w/clangd/clangd/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1
 #3 0x000077208ace61d0 (/usr/lib/libc.so.6+0x3d1d0)
 #4 0x0000000000587e20 getStmtClass /__w/clangd/clangd/llvm-project/clang/include/clang/AST/Stmt.h:1357:44
 #5 0x0000000000587e20 clang::ASTNodeKind::getFromNode(clang::Stmt const&) /__w/clangd/clangd/llvm-project/clang/lib/AST/ASTTypeTraits.cpp:131:13
 #6 0x00000000025064e3 create /__w/clangd/clangd/llvm-project/clang/include/clang/AST/ASTTypeTraits.h:432:23
 #7 0x00000000025064e3 create<clang::Expr> /__w/clangd/clangd/llvm-project/clang/include/clang/AST/ASTTypeTraits.h:262:12
 #8 0x00000000025064e3 bool clang::ast_matchers::internal::(anonymous namespace)::MatchChildASTVisitor::match<clang::Expr>(clang::Expr const&) /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchFinder.cpp:378:28
 #9 0x00000000024ffa3a TraverseLambdaExpr /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchFinder.cpp:293:12
#10 0x00000000024ffa3a clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchChildASTVisitor>::dataTraverseNode(clang::Stmt*, llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool, llvm::PointerLikeTypeTraits<clang::Stmt*>, llvm::PointerIntPairInfo<clang::Stmt*, 1u, llvm::PointerLikeTypeTraits<clang::Stmt*>>>>*) /__w/clangd/clangd/clangd_18.1.3/tools/clang/include/clang/AST/StmtNodes.inc:340:1
#11 0x00000000024f6adf clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchChildASTVisitor>::TraverseStmt(clang::Stmt*, llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool, llvm::PointerLikeTypeTraits<clang::Stmt*>, llvm::PointerIntPairInfo<clang::Stmt*, 1u, llvm::PointerLikeTypeTraits<clang::Stmt*>>>>*) /__w/clangd/clangd/llvm-project/clang/include/clang/AST/RecursiveASTVisitor.h:678:7
#12 0x00000000024f5ff8 clang::ast_matchers::internal::(anonymous namespace)::MatchChildASTVisitor::TraverseStmt(clang::Stmt*, llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool, llvm::PointerLikeTypeTraits<clang::Stmt*>, llvm::PointerIntPairInfo<clang::Stmt*, 1u, llvm::PointerLikeTypeTraits<clang::Stmt*>>>>*) /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchFinder.cpp:193:25
#13 0x0000000002508159 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchChildASTVisitor>::TraverseFunctionHelper(clang::FunctionDecl*) /__w/clangd/clangd/llvm-project/clang/include/clang/AST/RecursiveASTVisitor.h:2198:5
#14 0x00000000024ef911 TraverseFunctionDecl /__w/clangd/clangd/llvm-project/clang/include/clang/AST/RecursiveASTVisitor.h:2209:1
#15 0x00000000024ef911 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchChildASTVisitor>::TraverseDecl(clang::Decl*) /__w/clangd/clangd/clangd_18.1.3/tools/clang/include/clang/AST/DeclNodes.inc:238:1
#16 0x00000000024ec9c0 bool clang::ast_matchers::internal::(anonymous namespace)::MatchChildASTVisitor::traverse<clang::Decl>(clang::Decl const&) /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchFinder.cpp:405:3
#17 0x00000000024ec103 findMatch /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchFinder.cpp:121:7
#18 0x00000000024ec103 clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::matchesRecursively(clang::DynTypedNode const&, clang::ast_matchers::internal::DynTypedMatcher const&, clang::ast_matchers::internal::BoundNodesTreeBuilder*, int, clang::ast_matchers::internal::ASTMatchFinder::BindKind) /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchFinder.cpp:648:20
#19 0x00000000024ebdef clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::memoizedMatchesRecursively(clang::DynTypedNode const&, clang::ASTContext&, clang::ast_matchers::internal::DynTypedMatcher const&, clang::ast_matchers::internal::BoundNodesTreeBuilder*, int, clang::ast_matchers::internal::ASTMatchFinder::BindKind) /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchFinder.cpp:620:26
#20 0x00000000024ea2ee clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::matchesDescendantOf(clang::DynTypedNode const&, clang::ASTContext&, clang::ast_matchers::internal::DynTypedMatcher const&, clang::ast_matchers::internal::BoundNodesTreeBuilder*, clang::ast_matchers::internal::ASTMatchFinder::BindKind) /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchFinder.cpp:685:5
#21 0x000000000171a5ba clang::ast_matchers::internal::HasDescendantMatcher<clang::FunctionDecl, clang::Stmt>::matches(clang::FunctionDecl const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const /__w/clangd/clangd/llvm-project/clang/include/clang/ASTMatchers/ASTMatchersInternal.h:1653:5
#22 0x0000000002537f4b clang::ast_matchers::internal::DynTypedMatcher::matchesNoKindCheck(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchersInternal.cpp:332:23
#23 0x000000000253a7d2 __find_if<const clang::ast_matchers::internal::DynTypedMatcher *, __gnu_cxx::__ops::_Iter_negate<(lambda at /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchersInternal.cpp:394:38)> > /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/stl_algo.h:144:8
#24 0x000000000253a7d2 __find_if_not<const clang::ast_matchers::internal::DynTypedMatcher *, __gnu_cxx::__ops::_Iter_pred<(lambda at /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchersInternal.cpp:394:38)> > /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/stl_algo.h:171:14
#25 0x000000000253a7d2 find_if_not<const clang::ast_matchers::internal::DynTypedMatcher *, (lambda at /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchersInternal.cpp:394:38)> /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/stl_algo.h:566:14
#26 0x000000000253a7d2 all_of<const clang::ast_matchers::internal::DynTypedMatcher *, (lambda at /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchersInternal.cpp:394:38)> /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/stl_algo.h:509:24
#27 0x000000000253a7d2 all_of<llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher> &, (lambda at /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchersInternal.cpp:394:38)> /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/STLExtras.h:1732:10
#28 0x000000000253a7d2 allOfVariadicOperator /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchersInternal.cpp:394:10
#29 0x000000000253a7d2 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 /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchersInternal.cpp:123:12
#30 0x000000000253a45b clang::ast_matchers::internal::(anonymous namespace)::IdDynMatcher::dynMatches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchersInternal.cpp:138:33
#31 0x0000000002537e0c clang::ast_matchers::internal::DynTypedMatcher::matches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchersInternal.cpp:304:23
#32 0x000000000173880c clang::ast_matchers::internal::TraversalMatcher<clang::Decl>::matches(clang::Decl const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const /__w/clangd/clangd/llvm-project/clang/include/clang/ASTMatchers/ASTMatchersInternal.h:1514:5
#33 0x0000000002537e0c clang::ast_matchers::internal::DynTypedMatcher::matches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchersInternal.cpp:304:23
#34 0x000000000250bcf2 clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::matchWithFilter(clang::DynTypedNode const&) /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchFinder.cpp:1064:11
#35 0x000000000250f274 clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchFinder.cpp:1471:48
#36 0x0000000002514987 TraverseTranslationUnitDecl /__w/clangd/clangd/llvm-project/clang/include/clang/AST/RecursiveASTVisitor.h:1580:1
#37 0x0000000002514987 clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDecl(clang::Decl*) /__w/clangd/clangd/clangd_18.1.3/tools/clang/include/clang/AST/DeclNodes.inc:24:1
#38 0x000000000250f27f clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchFinder.cpp:1471:48
#39 0x00000000024e9c2d onEndOfTranslationUnit /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchFinder.cpp:446:30
#40 0x00000000024e9c2d clang::ast_matchers::MatchFinder::matchAST(clang::ASTContext&) /__w/clangd/clangd/llvm-project/clang/lib/ASTMatchers/ASTMatchFinder.cpp:1700:11
#41 0x00000000014ad164 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>) /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/ParsedAST.cpp:717:3
#42 0x000000000152e9b1 ~__shared_count /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/shared_ptr_base.h:683:6
#43 0x000000000152e9b1 ~__shared_ptr /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/shared_ptr_base.h:1123:31
#44 0x000000000152e9b1 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>>) /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/TUScheduler.cpp:1210:39
#45 0x000000000152e44b 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()() /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/TUScheduler.cpp:1144:5
#46 0x000000000152adf3 operator() /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:12
#47 0x000000000152adf3 clang::clangd::(anonymous namespace)::ASTWorker::runTask(llvm::StringRef, llvm::function_ref<void ()>) /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/TUScheduler.cpp:1324:3
#48 0x0000000001529860 run /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/TUScheduler.cpp:1459:5
#49 0x0000000001529860 operator() /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/TUScheduler.cpp:822:42
#50 0x0000000001529860 void llvm::detail::UniqueFunctionBase<void>::CallImpl<clang::clangd::(anonymous namespace)::ASTWorker::create(llvm::StringRef, clang::clangd::GlobalCompilationDa"
[ERROR][2024-08-28 21:29:11] .../vim/lsp/rpc.lua:772	"rpc"	"/home/ddob/.local/share/nvim/mason/bin/clangd"	"stderr"	"tabase const&, clang::clangd::TUScheduler::ASTCache&, clang::clangd::TUScheduler::HeaderIncluderCache&, clang::clangd::AsyncTaskRunner*, clang::clangd::Semaphore&, clang::clangd::TUScheduler::Options const&, clang::clangd::ParsingCallbacks&)::$_7>(void*) /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:221:12
#51 0x00000000016a22a1 operator= /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h:48:5
#52 0x00000000016a22a1 PunnedPointer /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h:37:60
#53 0x00000000016a22a1 PointerIntPair /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h:86:13
#54 0x00000000016a22a1 UniqueFunctionBase /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:341:3
#55 0x00000000016a22a1 unique_function /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:370:3
#56 0x00000000016a22a1 operator() /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:103:14
#57 0x00000000016a22a1 operator()<(lambda at /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:98:15) &> /__w/clangd/clangd/llvm-project/llvm/include/llvm/Support/thread.h:43:11
#58 0x00000000016a22a1 __invoke_impl<void, (lambda at /__w/clangd/clangd/llvm-project/llvm/include/llvm/Support/thread.h:42:9), (lambda at /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:98:15) &> /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/invoke.h:60:14
#59 0x00000000016a22a1 __invoke<(lambda at /__w/clangd/clangd/llvm-project/llvm/include/llvm/Support/thread.h:42:9), (lambda at /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:98:15) &> /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/invoke.h:95:14
#60 0x00000000016a22a1 __apply_impl<(lambda at /__w/clangd/clangd/llvm-project/llvm/include/llvm/Support/thread.h:42:9), std::tuple<(lambda at /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:98:15)> &, 0> /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/tuple:1662:14
#61 0x00000000016a22a1 apply<(lambda at /__w/clangd/clangd/llvm-project/llvm/include/llvm/Support/thread.h:42:9), std::tuple<(lambda at /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:98:15)> &> /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/tuple:1671:14
#62 0x00000000016a22a1 GenericThreadProxy<std::tuple<(lambda at /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:98:15)> > /__w/clangd/clangd/llvm-project/llvm/include/llvm/Support/thread.h:41:5
#63 0x00000000016a22a1 void* llvm::thread::ThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::$_1>>(void*) /__w/clangd/clangd/llvm-project/llvm/include/llvm/Support/thread.h:55:5
#64 0x000077208ad3d39d start_thread /usr/src/debug/glibc/glibc/nptl/pthread_create.c:447:8
#65 0x000077208adc249c __GI___clone3 /usr/src/debug/glibc/glibc/misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:80:0
Signalled during AST worker action: Build AST
  Filename: main.cpp
  Directory: /home/ddob/Coding/clangd_lambda_capture_cash
  Command Line: /usr/bin/clang -xc++ -std=c++23 -D__cpp_concepts=202002L -Wall -Wextra -Werror -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wpedantic -Wconversion -Wsign-conversion -Wnull-dereference -Wdouble-promotion -Wformat=2 -Wimplicit-fallthrough -I/usr/lib/clang/17/include -resource-dir=/home/ddob/.local/share/nvim/mason/packages/clangd/clangd_18.1.3/lib/clang/18 -- /home/ddob/Coding/clangd_lambda_capture_cash/main.cpp
  Version: 0
"

Metadata

Metadata

Assignees

Labels

clang:frontendLanguage frontend issues, e.g. anything involving "Sema"crashPrefer [crash-on-valid] or [crash-on-invalid]

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions