Advertisement
saheel1511

Visitor in Libtooling example

Dec 4th, 2014
267
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     virtual bool VisitFunctionDecl(FunctionDecl *func) {
  2.         errs() << "Inside " << ++numFunctions << " " << func->getNameInfo().getName().getAsString() << "\n";
  3.  
  4.         // FIXME: This detects CFGBlocks in given source file
  5.         // correctly, but does not give correct liveness values
  6.         clang::AnalysisDeclContextManager *ADCM = new clang::AnalysisDeclContextManager(false, true, true, true, true, true);
  7.         clang::AnalysisDeclContext *func_ADC = ADCM->getContext(func);
  8.         clang::LiveVariables *func_LV = clang::LiveVariables::computeLiveness(*func_ADC, false);
  9.         clang::LiveVariables::Observer *obs = new clang::LiveVariables::Observer();
  10.         func_LV->runOnAllBlocks(*obs);
  11.         func_LV->dumpBlockLiveness((func_ADC->getASTContext()).getSourceManager());
  12.  
  13.  
  14.         return true;
  15.     }
Advertisement
RAW Paste Data Copied
Advertisement