[llvm-branch-commits] [clang-tools-extra] 038b489 - [clangd] Avoid passing -xobjective-c++-header to the system include extractor
Tobias Hieta via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Aug 21 01:08:26 PDT 2023
Author: Nathan Ridge
Date: 2023-08-21T10:04:47+02:00
New Revision: 038b489d6440f9ef3bcdbc47229c8952d41dd947
URL: https://github.com/llvm/llvm-project/commit/038b489d6440f9ef3bcdbc47229c8952d41dd947
DIFF: https://github.com/llvm/llvm-project/commit/038b489d6440f9ef3bcdbc47229c8952d41dd947.diff
LOG: [clangd] Avoid passing -xobjective-c++-header to the system include extractor
Fixes https://github.com/clangd/clangd/issues/1568
Differential Revision: https://reviews.llvm.org/D147905
(cherry picked from commit bd74186f1a0831b2c596e87ea056419379a223c1)
Added:
Modified:
clang-tools-extra/clangd/SystemIncludeExtractor.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/SystemIncludeExtractor.cpp b/clang-tools-extra/clangd/SystemIncludeExtractor.cpp
index 4d359b0058280b..8c4d9252048cde 100644
--- a/clang-tools-extra/clangd/SystemIncludeExtractor.cpp
+++ b/clang-tools-extra/clangd/SystemIncludeExtractor.cpp
@@ -136,6 +136,16 @@ struct DriverArgs {
}
}
+ // 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
diff erent 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()) {
More information about the llvm-branch-commits
mailing list