[cfe-dev] header maps

Mathieu Baudet mathieu.baudet at gmail.com
Wed Mar 5 13:29:14 PST 2014


Hi Ben,

> Unfortunately no.  There aren't any clang tools that *produce* a header map, and I think Xcode is the only client right now.
I was suspecting this but felt like asking anyway :)

> However, depending on what you're trying to do, you might be better off looking at the new virtual file system code that we've been adding to clang. Like header maps, the VFS will allow you to map a virtual path to a file in a different location.  It is also much easier to produce the VFS files, as there is libclang API for producing them in include/clang-c/BuildSystem.h.  Right now the best way to learn how to use the VFS is probably to look at the tests in clang/test/VFS and the libclang API code, and I'd be happy to answer any questions about it :)

Thanks, this looks very interesting! I don't think I'm going to take a
dependence to libclang for now in my project (besides I have to
compile with clang 3.3), but I will definitely keep an eye on this
cool API.

>> How difficult/acceptable would it be to make the lookup
>> case-sensitive? (at least for non mac users)
>>  http://clang.llvm.org/doxygen/HeaderMap_8cpp_source.html#l00229
>
> The VFS supports selecting between case-sensitive and case-insensitive (this hasn't been exposed in the libclang API yet, but it would be easy to do).
nice!

>  That said, If you really want to hack it in to header maps, it wouldn't be hard - there are two places in HeaderMap.cpp that drop to lower case before doing the comparison that you would need to change.

If you allow me to use 1 bit of the "Reserved" field (and maybe
increment the version?), I could make a patch for you -- only I would
not know what unit-test to write. I guess that not very critical
anyway since HeaderMap creators can detect collisions and cleanly fail
when this happens.

Cheers,
-- Mathieu




More information about the cfe-dev mailing list