wenju-he wrote:

It seems difficult to change resource directory to the first priority in clang. 
Changing current order may cause breakage. It requires at least two changes:
1. adding following code for OpenCL before 
https://github.com/llvm/llvm-project/blob/2c7cf896be28febcd2f9af1b0dfdb5dfc6b97583/clang/lib/Driver/ToolChains/Clang.cpp#L1122
```
SmallString<128> Dir(D.ResourceDir);
llvm::sys::path::append(Dir, "include");
CmdArgs.push_back("-I");
CmdArgs.push_back(Args.MakeArgString(Dir));`
```
2. disable following code for OpenCL: 
https://github.com/llvm/llvm-project/blob/2c7cf896be28febcd2f9af1b0dfdb5dfc6b97583/clang/lib/Lex/InitHeaderSearch.cpp#L185-L191

These two changes are basically what this PR does, but within libclc.

The first change may contradict with current AddClangSystemIncludeArgs 
implementation which includes resource dir via -internal-isystem, e.g. at 
https://github.com/llvm/llvm-project/blob/2c7cf896be28febcd2f9af1b0dfdb5dfc6b97583/clang/lib/Driver/ToolChains/Linux.cpp#L750-L758

Note libc also uses -nostdlibinc in 
https://github.com/llvm/llvm-project/pull/97461

https://github.com/llvm/llvm-project/pull/177754
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to