[clang] [clang][driver] Fix an issue where clang does not correctly resolve the system header if invoked via symlink (on MacOS) (PR #68091)

Liviu Ionescu via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 5 02:55:35 PDT 2023


ilg-ul wrote:

The latest patch fixes the issue #66704 without changing the meaning of InstalledDir.

It is specific to macOS headers, the libraries were ok.

I also checked the other places where `installedDir` is used, but I'm not familiar with them (`Hexagon.cpp`, `MipsLinux.cpp`, `OHOS.cpp`, `WebAssembly.cpp`).

There are also several references in `MinGW.cpp`, but on Windows starting clang via a link is highly unlikely, so I'll leave them to Martin, to decide if they need any changes.

One other file where checking for the path where the executable is located might be in `Gnu.cpp`, around line 2132, where the list of prefixes is calculated, but I don't know the logic well enough to suggest a change:

```cpp
    // Then look for gcc installed alongside clang.
    Prefixes.push_back(D.InstalledDir + "/..");
```

> in principle I kinda agree that the fix itself, locating things based on the actual executable, sounds like the right thing to do in any case. We're early in the 18.x cycle, and if we could get the tests fixed to work despite that, we'd have lots of time to see if someone is affected negatively by it, before 18.x is released.

Fully agree, but I suggest we first fix this specific issue in this PR, and do the rest in a separate PR.








https://github.com/llvm/llvm-project/pull/68091


More information about the cfe-commits mailing list