[cfe-dev] rewriter inserText not working at the begining of files
    Sourav Mukherjee 
    sourav.mukherjee619 at gmail.com
       
    Mon Jul 14 06:42:14 PDT 2014
    
    
  
this is my code section.
   int result =
Tool.run(newFrontendActionFactory<ExampleFrontendAction>().get());
    FileID mf=rewriter.getSourceMgr().getMainFileID();
if(mf.isInvalid())
       return result;
    SourceLocation file_beg=rewriter.getSourceMgr().getLocForStartOfFile(mf);
    rewriter.InsertTextAfterToken(file_beg,header);
only insertText is causing the problem. the input program is :-
#include <iostream>
//#include <math.h>
//#include <iomanip>
using namespace std;
int main()
{
    return 0;
}
stack trace is :-
0  example         0x000000000108c2f5 llvm::sys::PrintStackTrace(_IO_FILE*) + 37
1  example         0x000000000108ca43
2  libpthread.so.0 0x00007ff780f93bb0
3  example         0x000000000052b6a5 main + 885
4  libc.so.6       0x00007ff7801bbde5 __libc_start_main + 245
5  example         0x000000000052b259
how to solve it.
    
    
More information about the cfe-dev
mailing list