Parse a file without main function

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Parse a file without main function

manavender reddy
Hi all,

I have just started using clang. And i was wondering is it possible to parse a file (to construct AST,CFG) without a main function. I am having this doubt because, the parseAST function
has a statment p.EnterMainSourceFile() and this will parse the file which has a main function. I need to parse any C file with just function and not main.

Thanks & Regards
Manavender



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Parse a file without main function

John McCall
On Aug 11, 2010, at 3:47 PM, manavender reddy wrote:
> I have just started using clang. And i was wondering is it possible to parse a file (to construct AST,CFG) without a main function. I am having this doubt because, the parseAST function
> has a statment p.EnterMainSourceFile() and this will parse the file which has a main function. I need to parse any C file with just function and not main.

The main source file is the "top level" file being compiled, i.e. the file that includes all the other files in the translation unit.  It has nothing to do with whether the file contains a declaration of a function called 'main'.

John.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev