[cfe-dev] Builtin headers

Mikhail Ramalho via cfe-dev cfe-dev at lists.llvm.org
Thu Feb 4 06:43:06 PST 2016


Hi Jacob,

I couldn't get it working that way.

Thank you,

2016-02-02 21:50 GMT+00:00 Jacob Carlborg via cfe-dev <
cfe-dev at lists.llvm.org>:

> On 2016-02-02 16:57, Mikhail Ramalho via cfe-dev wrote:
>
>> Hello all,
>>
>> I'm using clang as a frontend to parse C and C++ code, which I convert
>> to an internal format that my tool understand.
>>
>> Since the beginning of the development, there was the problem including
>> the builtin headers to the compilation which I kinda fix with a code to
>> search for headers on the system.
>>
>> The problem is that we ship the binary, including static and dynamic
>> versions, which requires that the users to have clang installed on their
>> machines. It's OK for the dynamic version but for the static one it's a
>> bad solution.
>>
>> So, right now I only found this two solutions:
>>
>> 1. Either the user must have clang installed in their machines (which I
>> can't tell if there will be a problem about using headers from different
>> versions of clang).
>>
>> 2. Ship all the builtin headers, even for the static version, and hard
>> code a path for them from the binary (like clang does).
>>
>> Is it possible to implement a third solution: circumvent the requirement
>> for all the builtin headers? I even tried to copy the builitin headers
>> as virtualFiles, but it doesn't work.
>>
>
> In my tool, DStep [1], I've embedded the headers in the executable itself.
> The tool is built using libclang. I'm using an array of "CXUnsavedFile" [2]
> for the internal headers which is passed when parsing the translation unit
> [3][4].
>
> Not sure if that helps since you're using the C++ API.
>
> [1] https://github.com/jacob-carlborg/dstep
>
> [2]
> https://github.com/jacob-carlborg/dstep/blob/master/clang/Compiler.d#L48
>
> [3]
> https://github.com/jacob-carlborg/dstep/blob/master/dstep/driver/Application.d#L96
>
> [4]
> https://github.com/jacob-carlborg/dstep/blob/master/clang/TranslationUnit.d#L35-L36
>
> --
> /Jacob Carlborg
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>



-- 

Mikhail Ramalho.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160204/d9cba4cd/attachment.html>


More information about the cfe-dev mailing list