This is an archive of the discontinued LLVM Phabricator instance.

[cfe][CMake] Export the clang resource directory
AbandonedPublic

Authored by philip.pfaffe on Jul 18 2018, 7:44 AM.

Details

Summary

Out-of-tree tools trying to parse source files need the builtin headers
such as stddef.h. If the tool isn't installed together with clang, it
can't find them automatically. Exporting the location makes this much
easier.

(Resubmitting because I've subscribed the wrong list, sorry for the noise).

Event Timeline

philip.pfaffe created this revision.Jul 18 2018, 7:44 AM
kimgr added a subscriber: kimgr.Jul 19 2018, 11:17 AM

Thank you for doing this, I'm going to guess you have IWYU in mind :-)

So as consumers of this, how do you envision we use the new variable? Something like https://stackoverflow.com/a/13429998 to copy the resource dir into our build root, and then an install rule to put it where we want it?

beanz added a comment.Aug 9 2018, 9:16 AM

I’m not opposed to this patch, but is there a real need for this? Have you considered just running clang with the -print-resource-dir flag?

I had not, but it should work just as well!

beanz added a comment.Aug 9 2018, 10:39 AM

Please check and see if that works for you. In general I prefer to avoid adding new features that aren't used in-tree unless it is unavoidable or would be difficult to work around out-of-tree. This one seems pretty straightforward to me.

@philip.pfaffe, did you establish whether this is still necessary or can be abandoned?

philip.pfaffe abandoned this revision.Oct 30 2018, 4:50 AM

It looks like running clang will be good enough. I'm closing this for now!