[cfe-dev] Clang beginner - how to parse multiple files?

Yaakov Davis yaakov.davis at gmail.com
Thu Apr 5 12:15:20 PDT 2012


Can the different compilers use the same ASTContext?
E.g. say a.cpp contains Foo::bar() and b.cpp contains Foo::bar2(); will the
Foo type in the semantic DeclContext contain both foo and foo2 after
parsing both files?

Could you please provide an example how to setup the parsers?

Many thanks,

On Thu, Apr 5, 2012 at 8:29 PM, Douglas Gregor <dgregor at apple.com> wrote:

>
> On Apr 5, 2012, at 7:04 AM, Yaakov Davis <yaakov.davis at gmail.com> wrote:
>
> > I have a program which is composed of multiple .h and .cpp files.
> > I tried adding all the .cpp files by calling createMainFileID multiple
> times, but got an exception saying that the main file has already been
> defined.
> >
>
> You need to parse different .cpp files with different instances of the
> compiler.
>
>        - Doug
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120405/34e4614e/attachment.html>


More information about the cfe-dev mailing list