[cfe-dev] main functions of clang

eyasu getahun eya.get at gmail.com
Mon Dec 12 05:44:31 PST 2011


Hello James,

Thanks a lot for your help and sorry for my late reply. Your information is
helpful, however what I want to know is the main method of clang that calls
the printpretty() function. As you mentioned, lets have S
->printpretty(context). We can see this at StmtPrinter.cpp  class as I
mentioned earlier. My question is which main method of clang this function
is called. As we know at run time there is at least on main method that
calls other functions. Assume we want to print the source code of AST. We
will run clang on command line. we will use a command(I don't know the
command) that calls the print pretty function. Hope you get my idea. So,
which main method/function of clang is calling this function? Thanks again.

On Mon, Dec 12, 2011 at 7:04 PM, James Molloy <James.Molloy at arm.com> wrote:

>  Hi,****
>
> ** **
>
> If you look at Stmt.h, you will find the main declarations for printPretty
> and dumpPretty (line 305). They are member functions of the Stmt class, so
> assuming you have a Stmt instance you can just call
> “S->dumpPretty(Context);”****
>
> ** **
>
> It’s difficult to give a general rule for everything in Clang – as you
> know it is quite a complex source base. But hopefully this has helped?****
>
> ** **
>
> Cheers,****
>
> ** **
>
> James ****
>
> ** **
>
> *From:* cfe-dev-bounces at cs.uiuc.edu [mailto:cfe-dev-bounces at cs.uiuc.edu] *On
> Behalf Of *eyasu getahun
> *Sent:* 12 December 2011 10:40
> *To:* cfe-dev at cs.uiuc.edu
> *Subject:* [cfe-dev] main functions of clang****
>
> ** **
>
>  Hello All,
>
> Clang has a number of classes and functions inside its implementation.
> Most of the time it makes me to be confused to identify the interconnection
> among classes and functions. Because many functions may be called from
> different header files. The main thing what i want to know is about main
> methods of clang. I have seen 4 main functions in clang. But it is
> difficult for me to identify in which main methods are other functions
> called. To make it clear let me talk about one class(example
> StmtPrinter.cpp class). This class prints back source code from AST.  Under
> this class their are two functions i.e PrintPretty(..) and DumpPretty(..).
> Suppose I want to use printPretty(..) and it is called at different
> functions.  Where is the main method of clang that calls this function to
> print the source code? Can someone tell me how it works. I tried to greped
> out on command line but failed to get the main method that calls this
> function. Even I want to know the command to use this function.
>
> Sorry, it might be silly question, but I failed to get it out. Thanks in
> advance for your help!.****
>
> -- IMPORTANT NOTICE: The contents of this email and any attachments are
> confidential and may also be privileged. If you are not the intended
> recipient, please notify the sender immediately and do not disclose the
> contents to any other person, use it for any purpose, or store or copy the
> information in any medium. Thank you.
>



-- 
*With Best Regards,

===========================================
Eyasu Getahun*

1 Fusionopolis way, #08-10 Connexis North Tower
Singapore 138632, Singapore
Mobile: +393279239907
*===========================================
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111212/4f064e9b/attachment.html>


More information about the cfe-dev mailing list