[cfe-dev] Using CompilerInstance
    Gagan Gupta 
    gagang at cs.wisc.edu
       
    Wed Mar 16 12:28:04 PDT 2011
    
    
  
Hi,
I am a clang novice and trying to navigate my way through it.
I want to read in C++ source files (multiple) and identify calls to a 
specific function so that I can insert a definition for it in the code. 
I have written my ASTconsumer for the purpose.
As suggested in various posts, I am using CompilerInstance to hold the 
C++ source files (one at a time) and parse the source code. At the 
moment I am using  ParseAST on individual components of the 
CompilerInstance. But I suspect there must be a more elegant way to 
parse the source file once the CompilerInstance has been "populated". Is 
there a way to do so? (I have written my own driver as opposed to using 
command line clang.)
Also, how would one inject source code and generate the object code?
Any and all pointers would be highly appreciated.
Thanks,
Gagan
    
    
More information about the cfe-dev
mailing list