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.kuc...@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);

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to