[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:04:17 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-tools-extra
Author: None (slavek-kucera)
<details>
<summary>Changes</summary>
fixes llvm/llvm-project#<!-- -->132413
---
Full diff: https://github.com/llvm/llvm-project/pull/153802.diff
1 Files Affected:
- (modified) clang-tools-extra/clangd/GlobalCompilationDatabase.cpp (+2)
``````````diff
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);
``````````
</details>
https://github.com/llvm/llvm-project/pull/153802
More information about the cfe-commits
mailing list