[cfe-dev] Parse a file without main function

John McCall rjmccall at apple.com
Wed Aug 11 15:54:33 PDT 2010


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.



More information about the cfe-dev mailing list