<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Nevermind, I manage to make it work casting the original Expr to
    ExprWithCleanups and then to CXXConstructExpr. Now I am able to get
    the Expr initializers of the members of the classes.<br>
    <br>
    On 02/06/2013 06:10 PM, Miguel Aguilar wrote:
    <blockquote cite="mid:51128E91.7000009@ice.rwth-aachen.de"
      type="cite">
      <meta http-equiv="content-type" content="text/html;
        charset=ISO-8859-1">
      Hi,<br>
      <br>
      I have been trying to get information from the initializers of a
      C++ class. For example if I have something like this:<br>
      <br>
      <pre class="fragment"><span class="keyword">class </span>A { };
 <span class="keyword">class </span>B : <span class="keyword">public</span> A {
   <span class="keywordtype">float</span> f;
 <span class="keyword">public</span>:
   B(A& a) : A(a), f(3.14159) { }
 };

</pre>
      I wold like to get the initialization values for each member. In
      this example the values a and 3.14159 for the members A and f
      respectively. <br>
      <br>
      What I have done so far is this:<br>
      <br>
      I am using the method VisitCXXConstructorDecl and then getting the
      initalizers by means of iterator
      CXXConstructorDecl::init_iterator. I am able to get the members
      that are being initialized by means of <a moz-do-not-send="true"
        class="el"
href="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html#a877f0bab49ff048f7e0faddf3f528977">getMember</a>
      () method for each initializer.<br>
      <br>
      However, I want to have the initialization values themselves (a
      and 3.14...), then I tried to get the initializer expression (<a
        moz-do-not-send="true" class="el"
href="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html#a6a232de857e5b703d4d21fc86588f77b">getInit</a>
      ()) and then cast it to CXXConstructExpr in order to try to get
      the arguments of the call to the constructors of A and f.<br>
      <br>
      The problem is that the method getInit() is not returning the
      initialization expression. Any ideas what could be wrong, or other
      ways to get the initialization values for the members.<br>
      <br>
      Thanks,<br>
      <br>
      Miguel<br>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
cfe-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>