[clang-tools-extra] [clangd] Clangd running with `--experimental-modules-support` crashes when the compilation database is unavailable (PR #153802)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 15 06:03:26 PDT 2025
https://github.com/slavek-kucera created https://github.com/llvm/llvm-project/pull/153802
fixes llvm/llvm-project#132413
>From dcbc16c6b4598deaf0461bfea48cc2210e283ade Mon Sep 17 00:00:00 2001
From: Slavomir Kucera <slavomir.kucera at broadcom.com>
Date: Fri, 15 Aug 2025 14:43:46 +0200
Subject: [PATCH] [clangd] Clangd running with `--experimental-modules-support`
crashes when the compilation database is unavailable
fixes llvm/llvm-project#132413
---
clang-tools-extra/clangd/GlobalCompilationDatabase.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
index 7c0eb9651feaa..8c993db2d6d02 100644
--- a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
+++ b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
@@ -833,6 +833,8 @@ bool OverlayCDB::setCompileCommand(PathRef File,
std::unique_ptr<ProjectModules>
OverlayCDB::getProjectModules(PathRef File) const {
auto MDB = DelegatingCDB::getProjectModules(File);
+ if (!MDB)
+ return {};
MDB->setCommandMangler([&Mangler = Mangler](tooling::CompileCommand &Command,
PathRef CommandPath) {
Mangler(Command, CommandPath);
More information about the cfe-commits
mailing list