fatal error: error opening file '<invalid loc>': SOLVED!

Thanks to everyone who tried to help!

Here is how I fixed it by changing few lines of code in main():

1st edit: FileID FID = SourceMgr.createFileID(FileIn, SourceLocation(), SrcMgr::C_User); //SM: Changed from CreateMainFileID()

SourceMgr.setMainFileID(FID);

2nd edit: ParseAST(TheCompInst.getPreprocessor(), &TheConsumer, TheCompInst.getASTContext(), false, TU_Complete, NULL, false);

With these the program is producing the required output.

Thanks,

Manohar