[clang] [clang] Match -isysroot behaviour with system compiler on Darwin (PR #80524)

Daniel Rodríguez Troitiño via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 7 10:58:03 PST 2024


drodriguez wrote:

> With that being said, can you clarify what you mean by "ignoring the command-line option", and can you expand on why the current state of upstream Clang is broken in your opinion? But for productivity's sake, let's take for granted that the canonical state is upstream Clang and let's pretend that AppleClang also behaves the same (which is not quite true yet).

I speak only for myself, but I find very confusing that `/bar/bin/clang -isysroot /foo` will ignore the headers provided in `/foo/usr/include/c++/v1` when they exist just because `/bar/include/c++/v1` exists. An additional problem is that there is no flag to say `-ignore-the-toolchain-c++-headers-and-use-sysroot-I-mean-it` so someone can have a toolchain with C++ headers, but still prefer some external headers in the SDK.

In a particular case, when developing, one can end up with a build directory that has created an empty `<build dir>/include/c++/v1` (because libc++ has been configured, but not built), and `<build dir>/bin/clang` will only look at that directory instead of the one provided in `SDKROOT` or `-isysroot`, failing every time that C++ headers are referenced (because they are not actually there).

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


More information about the cfe-commits mailing list