From 9af0a142e43625cb8478b83692510a5abd39f808 Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Mon, 29 Aug 2022 04:24:24 -0400 Subject: [PATCH] [clangd] Fail more gracefully if QueryDriverDatabase cannot determine file type Currently, QueryDriverDatabase returns an empty compile command if it could not determine the file type. This failure mode is unnecessarily destructive; it's better to just return the incoming compiler command, which is still more likely to be useful than an empty command. Differential Revision: https://reviews.llvm.org/D132833 --- clang-tools-extra/clangd/QueryDriverDatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang-tools-extra/clangd/QueryDriverDatabase.cpp b/clang-tools-extra/clangd/QueryDriverDatabase.cpp index 3fdacf3..c36fb4f 100644 --- a/clang-tools-extra/clangd/QueryDriverDatabase.cpp +++ b/clang-tools-extra/clangd/QueryDriverDatabase.cpp @@ -341,7 +341,7 @@ public: auto Type = driver::types::lookupTypeForExtension(Ext); if (Type == driver::types::TY_INVALID) { elog("System include extraction: invalid file type for {0}", Ext); - return {}; + return Cmd; } Lang = driver::types::getTypeName(Type); } -- 2.7.4