Skip to content

Commit

Permalink
[clangd] Avoid passing -xobjective-c++-header to the system include e…
Browse files Browse the repository at this point in the history
…xtractor

Fixes clangd/clangd#1568

Differential Revision: https://reviews.llvm.org/D147905
  • Loading branch information
HighCommander4 committed Aug 18, 2023
1 parent d9cb76b commit bd74186
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions clang-tools-extra/clangd/SystemIncludeExtractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,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 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()) {
Expand Down

0 comments on commit bd74186

Please sign in to comment.