<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    As far as I understand the issue:<br>
    <br>
    1. You might want to pass <b>*string</b> to the <b>ASTContext::getParents()</b>
    function as it doesn't accept pointer to the AST node of any kind.<br>
    2. <b>ASTContext::getParents()</b> returns <b>DynTypedNodeList</b>
    and it can't be implicitly converted into a <b>ParentVector</b>.<br>
    <br>
    Hope that helps,<br>
    Kirill Bobyrev<br>
    <br>
    <div class="moz-cite-prefix">On 1/1/2016 11:52 AM, 周书林 wrote:<br>
    </div>
    <blockquote
cite="mid:CAE0pyrvXMce29TGuP6Gw9qPc-y1SPL_B3xvR7QHS0MNtHUSjtw@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>I am trying to use clang::ASTContext::getParents(), but
          there are some problems.<br>
        </div>
        <div>I wrote a sample code as follows, try to get the Parent of
          StringLiteral:<br>
          <img alt="内嵌图片 5" src="cid:part1.09050803.07050104@gmail.com"
            height="114" width="391"><br>
        </div>
        <br>
        But when I try to compile my source code, it report a error as
        follows:<br>
        <img alt="内嵌图片 4" src="cid:part2.03060500.05010001@gmail.com"
          height="254" width="561"><br>
        <div class="gmail_extra"><br>
          What is the problem? Is there no pre-established ParentMap?<br>
        </div>
        <div class="gmail_extra">Thank you very much!<br>
        </div>
        <div class="gmail_extra"><br>
          <br>
          <br>
          <div class="gmail_quote">2016-01-01 15:47 GMT+08:00 Kirill
            Bobyrev via cfe-dev <span dir="ltr"><<a
                moz-do-not-send="true"
                href="mailto:cfe-dev@lists.llvm.org" target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a></a>></span>:<br>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
              0.8ex;border-left:1px solid
              rgb(204,204,204);padding-left:1ex">
              <div style="word-wrap:break-word">
                <div>Hi!</div>
                <div><br>
                </div>
                <div>You can get parents of current AST node via
                  calling <a moz-do-not-send="true"
href="http://clang.llvm.org/doxygen/classclang_1_1ASTContext.html#a32d11844fdb82310b9059784fd4ceb6b"
                    target="_blank">clang::ASTContext::getParents()</a>.
                  In order to reach <span style="color:rgb(255,0,0)">InitListExpr</span> you
                  should walk up several times.</div>
                <div><br>
                </div>
                <div>
                  <div
style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
                    <div>Hope that helps,</div>
                    <div>Kirill Bobyrev</div>
                    <div><br>
                    </div>
                  </div>
                  <br>
                </div>
                <br>
                <div>
                  <blockquote type="cite"><span class="">
                      <div>On 01 Jan 2016, at 10:16 AM, 周书林 via cfe-dev
                        <<a moz-do-not-send="true"
                          href="mailto:cfe-dev@lists.llvm.org"
                          target="_blank">cfe-dev@lists.llvm.org</a>>
                        wrote:</div>
                      <br>
                    </span>
                    <div>
                      <div dir="ltr">
                        <div><span class="">
                            <div>In my clang-tool, I want to do some
                              analysis on AST after visit some specific
                              type of Stmt Node. So I need to go to the
                              parent AST node of current stmt. Is there
                              any member functions of Stmt to archieve
                              this goal?<br>
                            </div>
                            For example, I am visiting the AST node <span
                              style="color:rgb(255,0,0)">StringLiteral </span>"xmloption",
                            how can I get to the Node <span
                              style="color:rgb(255,0,0)">InitListExpr </span>"config_generic"?(I
                            am using the VisitStringLiteral() function
                            to visit the StringLiteral Node).<br>
                            <br>
                          </span><span><2016-01-01
                            15:12:54的屏幕截图.png></span><br>
                        </div>
                        Thanks a lot!<br>
                      </div>
                      _______________________________________________<br>
                      cfe-dev mailing list<br>
                      <a moz-do-not-send="true"
                        href="mailto:cfe-dev@lists.llvm.org"
                        target="_blank">cfe-dev@lists.llvm.org</a><br>
                      <a moz-do-not-send="true"
                        href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev"
                        target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
                    </div>
                  </blockquote>
                </div>
                <br>
              </div>
              <br>
              _______________________________________________<br>
              cfe-dev mailing list<br>
              <a moz-do-not-send="true"
                href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
              <a moz-do-not-send="true"
                href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev"
                rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
              <br>
            </blockquote>
          </div>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>