[PATCH] D147905: [clangd] Avoid passing -xobjective-c++-header to the system include extractor
Nathan Ridge via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 9 22:43:18 PDT 2023
nridge created this revision.
nridge added a reviewer: kadircet.
Herald added a subscriber: arphaman.
Herald added a project: All.
nridge requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.
Fixes https://github.com/clangd/clangd/issues/1568
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D147905
Files:
clang-tools-extra/clangd/SystemIncludeExtractor.cpp
Index: clang-tools-extra/clangd/SystemIncludeExtractor.cpp
===================================================================
--- clang-tools-extra/clangd/SystemIncludeExtractor.cpp
+++ clang-tools-extra/clangd/SystemIncludeExtractor.cpp
@@ -333,6 +333,13 @@
else if (Arg.startswith("-x"))
Lang = Arg.drop_front(2).trim();
}
+ // Downgrade objective-c++-header (used in clangd's fallback flags for .h
+ // files) to c++-header, as some drivers may fail to run the extraction
+ // command if it contains `-xobjective-c++-header` and objective-c++ support
+ // is not installed.
+ if (Lang == "objective-c++-header") {
+ Lang = "c++-header";
+ }
if (Lang.empty()) {
llvm::StringRef Ext = llvm::sys::path::extension(File).trim('.');
auto Type = driver::types::lookupTypeForExtension(Ext);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147905.512074.patch
Type: text/x-patch
Size: 850 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230410/2fb8aa5c/attachment.bin>
More information about the cfe-commits
mailing list