Hi all,  <br>Here is yet another new person question.  <br>I have, after a long while, cobbled together an example that I thought would simply traverse create an AST and then traverse it printing out function and variable names. Sadly, I am getting the following error:<br>

 <br>~/llvm/tools/clang/lib/Lex/Preprocessor.cpp:386: void clang::Preprocessor::EnterMainSourceFile(): Assertion `NumEnteredSourceFiles == 0 && "Cannot reenter the main file!"' failed.<br>Stack dump:<br>

0.    <eof> parser at end of file<br>Aborted<br><br>Which makes me believe that my AST is not being created properly (obviously).  <br><br>I create the ASTUnit after an example sent by Guoping using:<br><br>llvm::OwningPtr<ASTUnit> CUnit(<br>

                  ASTUnit::LoadFromCommandLine(argv,argv+argc,Diags,<br>                  ResPath,false,CaptureDiagnostics,NULL,0,false,false,<br>                  TUKind,false,false));<br><br>And then have a ASTConsumer instance that implements HandleTranslationUnit and two methods, VisitFunctionDecl and VisitVarDecl.  But I suspect the error is coming before the call to any of these.  <br>

<br>Perhaps I have not set up the call to ParseAST properly?<br><br>  clang::ParseAST(TU.getPreprocessor(), consumer, TU.getASTContext());<br><br><br>TU is a wrapper around ASTUnit as in the wpa example.<br><br>Any thoughts I what I might try to remedy this situation? <br>
<br>Thanks in advance,<br>Joe<br><br>