[clang-tools-extra] [clangd] Fix SIGSEGV crash when receiving a textDocument/didOpen request with the URI pointing to a directory (PR #177834)
Nathan Ridge via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 30 00:06:58 PST 2026
================
@@ -1027,6 +1031,10 @@ flattenSymbolHierarchy(llvm::ArrayRef<DocumentSymbol> Symbols,
void ClangdLSPServer::onDocumentSymbol(const DocumentSymbolParams &Params,
Callback<llvm::json::Value> Reply) {
URIForFile FileURI = Params.textDocument.uri;
+ if (llvm::sys::fs::is_directory(FileURI.file())) {
----------------
HighCommander4 wrote:
We shouldn't need to change `documentSymbol`. Once we've refused to open the file in `didOpen`, all further requests related to the file such as `documentSymbol` should fail given our existing checks.
https://github.com/llvm/llvm-project/pull/177834
More information about the cfe-commits
mailing list