[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
Thu Aug 17 21:40:41 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbd74186f1a08: [clangd] Avoid passing -xobjective-c++-header to the system include extractor (authored by nridge).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147905/new/

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
@@ -133,6 +133,16 @@
       }
     }
 
+    // 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.
+    // In practice, we don't see different include paths for the two on
+    // clang+mac, which is the most common objectve-c compiler.
+    if (Lang == "objective-c++-header") {
+      Lang = "c++-header";
+    }
+
     // If language is not explicit in the flags, infer from the file.
     // This is important as we want to cache each language separately.
     if (Lang.empty()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147905.551378.patch
Type: text/x-patch
Size: 928 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230818/7f523b74/attachment-0001.bin>


More information about the cfe-commits mailing list