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

Louis Dionne via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 7 15:53:14 PST 2024


ldionne wrote:

> Yes. What I think Dmitry and I are trying to explain is that it is very weird that providing an explicit `-isysroot` in the command line is ignored for the C++ headers (and only for them). One can start using `-nostdinc` and friends, but that mean rebuilding the header search paths manually, which is not great.

I understand now, thanks for explaining again. So the intent of the current ordering was to allow creating a toolchain by placing the libc++ headers alongside Clang, as is typically done (and exceptionally not done on Apple platforms). On Apple platforms, you basically always specify a sysroot, either explicitly or implicitly (via env vars). You *have* to, since the SDK is where you find everything you need to compile even the most basic program (like our libc headers).

If we instead "listened" to the `-isysroot` argument that is always passed by the user on Apple platforms for finding libc++ headers, there wouldn't be a way to create a toolchain like I explained above.

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


More information about the cfe-commits mailing list