[LLVMdev] Can I use Clang to parse snippets of C++ code?
Félix Cloutier
felixcca at yahoo.ca
Mon Feb 21 19:24:24 PST 2011
Yup, I know beforehand everything that needs to be included or declared, so this is not an issue. It *would* work if I made individual files, but it doesn't look like a very intuitive way to do it.
I'll look into PCH. I was a little bit startled when I opened the index.html file docs/; at least there seems to be a lot of documentation inside the code.
Félix
Le 2011-02-21 à 21:45:33, Reid Kleckner a écrit :
> The semantics of C++ depend heavily on what comes before the given
> fragment. How do you plan to address this? For example, if you know
> all the headers you think these snippets will include, you can do
> something similar to PCH to parse the fragment in context of all of
> the headers.
>
> I don't know much about feeding clang buffers instead of files, but I
> believe it can be done with some of the "virtual" file suport that has
> been added recently.
>
> Reid
>
> 2011/2/21 Félix Cloutier <felixcca at yahoo.ca>:
>> Hello guys,
>>
>> I'd like to use Clang to parse snippets of (and emit bytecode for) C++ code that come from larger files that don't contain only C++, but looking at the clang interpreter example, either I didn't get it, or it looks like the driver expects only files, and not strings or char buffers.
>>
>> Is there a simple way to achieve this? Do I have to split my input into small files and pass them to clang, or is there a better way?
>>
>> Félix
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
More information about the llvm-dev
mailing list