Skip to content

Commit 038b489

Browse files
HighCommander4tru
authored andcommitted
[clangd] Avoid passing -xobjective-c++-header to the system include extractor
Fixes clangd/clangd#1568 Differential Revision: https://reviews.llvm.org/D147905 (cherry picked from commit bd74186)
1 parent 4590c90 commit 038b489

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

clang-tools-extra/clangd/SystemIncludeExtractor.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,16 @@ struct DriverArgs {
136136
}
137137
}
138138

139+
// Downgrade objective-c++-header (used in clangd's fallback flags for .h
140+
// files) to c++-header, as some drivers may fail to run the extraction
141+
// command if it contains `-xobjective-c++-header` and objective-c++ support
142+
// is not installed.
143+
// In practice, we don't see different include paths for the two on
144+
// clang+mac, which is the most common objectve-c compiler.
145+
if (Lang == "objective-c++-header") {
146+
Lang = "c++-header";
147+
}
148+
139149
// If language is not explicit in the flags, infer from the file.
140150
// This is important as we want to cache each language separately.
141151
if (Lang.empty()) {

0 commit comments

Comments
 (0)