jansvoboda11 wrote:

> > I was going to suggest keeping Header::PathRelativeToRootModuleDirectory as 
> > "float.h", and generating this into the  buffer
> 
> Wouldn't this work without the pragma? Isn't the resource directory always 
> added to the header search paths, so the header should be found correctly if 
> we set PathRelativeToRootModuleDirectory relative to the resource dir for 
> builtin headers?

Yeah, the driver adds `-internal-isystem <resource-dir>/include` to the `-cc1` 
invocation (on Darwin). From your test-case I assumed you wanted the 
compilation to succeed even without this include path. If that's not the case 
then yes, you can simply put `#include "float.h"` into the `<module-includes>` 
buffer by storing `UnresolvedHeaderDirective::FileName` to 
`Header::PathRelativeToRootModuleDirectory` and then fixing the module map 
header resolution by doing this in `ModuleMap::findHeader()`:

```c++
auto Directory = Header.HasBuiltinHeader ? BuiltinIncludeDir : M->Directory;
```

Which effectively mimics what we already do in 
`ModuleMap::resolveAsBuiltinHeader()`.

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

Reply via email to