[cfe-dev] Parse AST several times

Mohammad Adil madil90 at gmail.com
Wed Jan 2 14:29:42 PST 2013


Hi,
   While parsing the AST, I am making additions to the code. I want to find
out the location of the file where global variables can be added. e.g.

#include <stdio.h>

-- Want to find this location to insert global variables here

int main()
{
}

   How can I find that location. Also how does clang represent this
statement "using namespace std;"?

Regards,
Adil



On Thu, Jan 3, 2013 at 3:24 AM, Argyrios Kyrtzidis <akyrtzi at gmail.com>wrote:

> On Jan 2, 2013, at 12:30 PM, madil90 <madil90 at gmail.com> wrote:
>
> > Hi,
> >   I mean once I have overridden the contents or have the new buffer
> > containing updated contents, how do i actually compile it? because if i
> > leave it at that, the program closes without doing anything. How do i
> > actually go forward and generate an executable of those contents.
>
> A somewhat simple way would be to write the buffer to a temporary file and
> then just invoke the clang executable to do the compiling with the addition
> of passing "-remap-file" as argument.
> See "test/Misc/remap-file.c" for an example of such invocation.
>
> >
> > Regards,
> > Adil
> >
> >
> >
> > --
> > View this message in context:
> http://clang-developers.42468.n3.nabble.com/Parse-AST-several-times-tp4029276p4029317.html
> > Sent from the Clang Developers mailing list archive at Nabble.com.
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>


-- 
Mohammad Adil
LUMS SSE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130103/89ee6058/attachment.html>


More information about the cfe-dev mailing list