<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
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 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
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>
</body>
</html>