<html>
<head></head>
<body>
<p>Hi,</p>
<p>In the program I am developing, I search for "ExplicitCastExpr" because I need to print the elements which are being casted. If the program retrieves this expression:</p>
<p style="padding-left: 30px;">static_cast<KWriteApp *>(kapp);</p>
<p>what I want to print is "kapp". </p>
<p>However, I have found a problem in that situation:<br/>
- kapp is defined as:<br/>
#define kapp KApplication::kApplication()</p>
<p>- This is the AST of that expression:</p>
<p style="padding-left: 30px;"><span style="font-size: 8pt;">-CXXStaticCastExpr 0x4fcc118 <col:10, col:39> 'class KWriteApp *' static_cast<class KWriteApp *> <BaseToDerived (KApplication)></span><br /><span style="font-size: 8pt;">| `-CallExpr 0x4fcc0e0 </usr/include/KDE/../kapplication.h:56:14, col:41> 'class KApplication *'</span><br /><span style="font-size: 8pt;">| `-ImplicitCastExpr 0x4fcc0c8 <col:14, col:28> 'class KApplication *(*)(void)' <FunctionToPointerDecay></span><br /><span style="font-size: 8pt;">| `-DeclRefExpr 0x4fcc068 <col:14, col:28> 'class KApplication *(void)' lvalue CXXMethod 0x7f4c9d3c2fe0 'kApplication' 'class KApplication *(void)'</span></p>
<p>As you can observe, "kapp" does not appear explicitly in the tree.</p>
<p>- When in my program I invoke "getSubExpr()" (from the object containing the "ExplicitCastExpr") to obtain "kapp", the range of the expression is empty.<br/>
I have also tried with "getSubExprAsWritten()" but it makes no difference. This is the first time I have found a problem with the solution that I had implemented. </p>
<p>The question is:<br/>
How could I simply obtain what is being casted as it is written in the code? I do not refer only to this specific situation, but a way to achieve my goal in general. </p>
<p>Thanks in advance.</p>
</body>
</html>