title: How to get the information of DeclRefExpr from the basic block in Clang:CFG?
body: <p>How to get the information of DeclRefExpr from the basic block in Clang:CFG?
  This is code i have coded</p>
  <pre><code>class CFGPrinter : public MatchFinder::MatchCallback {
  public:
    virtual void run(const MatchFinder::MatchResult &amp;Result) {
      if (const FunctionDecl *funcDecl =
          Result.Nodes.getNodeAs&lt;clang::FunctionDecl&gt;(&quot;mainFunction&quot;)) {
        ASTContext *context = Result.Context;
        Stmt *funcBody = funcDecl-&gt;getBody();
        static std::unique_ptr&lt;CFG&gt; sourceCFG = CFG::buildCFG(funcDecl, funcBody, context, clang::CFG::BuildOptions());
        for(CFG::const_iterator it = sourceCFG-&gt;begin(), ei = sourceCFG-&gt;end(); it != ei; ++it){
          const CFGBlock* block = *it;
          for(CFGBlock::const_iterator bi = block-&gt;begin(), be = block-&gt;end(); bi != be; ++bi){
            const CFGElement &amp;elem = *bi;
            const Stmt *stmt_tmp = elem.castAs&lt;CFGStmt&gt;().getStmt();
            /*I want to get DeclRefExpr from next*/            
            }
          }
        }
      }
    }
  };
  </code></pre>