[PATCH] D147905: [clangd] Avoid passing -xobjective-c++-header to the system include extractor

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 16 06:49:55 PDT 2023


sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

Agree this is a mess: the reason we think objective-c++-header is safe is that we have built-in support, but in the presence of query-driver that's not enough.

In terms of testing this: I think ~nobody really cares about objc + gcc these days, the thing we'd expect to break by downgrading objective-c++-header to c++-header is querying the clang driver on a mac.
I checked that, and at least on my machine it makes no difference.

So while this is ugly and layering-violationy, it's also short and simple, and solves a practical problem that we've created ourselves.

(Also discussed with @kadircet offline - you're good to land this)



================
Comment at: clang-tools-extra/clangd/SystemIncludeExtractor.cpp:339
+    // command if it contains `-xobjective-c++-header` and objective-c++ support
+    // is not installed.
+    if (Lang == "objective-c++-header") {
----------------
Maybe add comment:
```
// In practice, we don't see different include paths for the two on clang+mac,
// which is the most common objective-c compiler.
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147905



More information about the cfe-commits mailing list