Author: Nathan Ridge
Date: 2022-08-29T12:59:05-04:00
New Revision: 9af0a142e43625cb8478b83692510a5abd39f808

URL: 
https://github.com/llvm/llvm-project/commit/9af0a142e43625cb8478b83692510a5abd39f808
DIFF: 
https://github.com/llvm/llvm-project/commit/9af0a142e43625cb8478b83692510a5abd39f808.diff

LOG: [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

Added: 
    

Modified: 
    clang-tools-extra/clangd/QueryDriverDatabase.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/QueryDriverDatabase.cpp 
b/clang-tools-extra/clangd/QueryDriverDatabase.cpp
index 3fdacf397028e..c36fb4f042a9f 100644
--- a/clang-tools-extra/clangd/QueryDriverDatabase.cpp
+++ b/clang-tools-extra/clangd/QueryDriverDatabase.cpp
@@ -341,7 +341,7 @@ class QueryDriverDatabase : public DelegatingCDB {
       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);
     }


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

Reply via email to