Skip to content

Commit bd74186

Browse files
[clangd] Avoid passing -xobjective-c++-header to the system include extractor
Fixes clangd/clangd#1568 Differential Revision: https://reviews.llvm.org/D147905
1 parent d9cb76b commit bd74186

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
@@ -133,6 +133,16 @@ struct DriverArgs {
133133
}
134134
}
135135

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

0 commit comments

Comments
 (0)