drodriguez wrote:

> @drodriguez I'm not certain why you think AppleClang prefers `isysroot` over 
> toolchain headers -- it might be because we simply don't ship libc++ 
> toolchain headers anymore and we only ship libc++ SDK headers. But if you try 
> installing libc++ headers in the toolchain alongside a reasonably recent 
> AppleClang, it should prefer them over the SDK headers (which is consistent 
> with the upstream behavior).

This is the tests I have done to verify:

```
$ mkdir -p /tmp/test-toolchains/
$ cd /tmp/test-toolchains/
$ cp -R 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain 
pristine
$ cp -R pristine modified
$ mkdir -p modified/usr/include/c++/v1
$ echo "#error Boom" > modified/usr/include/c++/v1/cxxabi.h
$ echo "#include <cxxabi.h>" > test.cpp

# Using pristine, which does not have any headers beside it
$ pristine/usr/bin/clang -c test.cpp -o test.pristine.o
test.cpp:1:10: fatal error: 'cxxabi.h' file not found
#include <cxxabi.h>
         ^~~~~~~~~~
1 error generated.

# Using modified, with the headers beside it
modified/usr/bin/clang -c test.cpp -o test.modified.o
In file included from test.cpp:1:
/tmp/test-toolchain/modified/usr/bin/../include/c++/v1/cxxabi.h:1:2: error: Boom
#error Boom
 ^
1 error generated.

# Using modified, but passing a isysroot (no errors)
$ modified/usr/bin/clang -c test.cpp -o test.sysroot.o -isysroot (xcrun 
--show-sdk-path)
$ ls test.sysroot.o
test.sysroot.o
```

Unless I am understanding the behaviour incorrectly, this seems to be the 
opposite of the upstream behaviour.

https://github.com/llvm/llvm-project/pull/80524
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to