<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi,<br><br>When I'm iterating the initializers of a constructor declaration (CXXConstructDecl), I access to the elements of type:<br><br>CXXConstructorDecl::init_const_iterator<br><br>which is actually:<br><br>typedef CXXCtorInitializer* const* <a href="http://http://clang.llvm.org/doxygen/classclang_1_1CXXConstructorDecl.html#a6ad3e9edd9b8789dda1f8a62cb624569">clang::CXXConstructorDecl::init_const_iterator</a><br><br>Then, to obtain the CXXConstructExpr* from the CXXCtorInitializer*, I perform a casting with:<br><br>CXXConstructExpr *ce = (CXXConstructExpr*)(initializer)->getInit();<br><br>This worked correctly up to now, but I found that sometimes, the casting is not doing what it was expected and the result is not right. I have detected two problems:<br><br>1. If I have the next initializer, where the argument is not a variable or constant directly:<br>KeyValueContainer(node.elementsByTagName("KEYVALUEPAIRS").item(0).toElement())<br>When asking:<br>CXXConstructExpr *ce = (CXXConstructExpr*)(initializer)->getInit();<br>if (ce->getNumArgs() == 0)<br><br>the conditional statement is evaluated to true, when it should be evaluated to false as the constructor has one argument. <br><br>2. Having this:<br><br>template <class Key, class T><br>class MyMap : protected QMap<Key, T><br>...<br>
<style type="text/css">P { margin-bottom: 0.21cm; direction: ltr; color: rgb(0, 0, 0); }P.western { font-family: "Liberation Serif","Times New Roman",serif; font-size: 12pt; }P.cjk { font-family: "DejaVu Sans"; font-size: 12pt; }P.ctl { font-family: "Lohit Hindi"; font-size: 12pt; }</style>MyMap(): QMap<Key, T>() ...<br><br>If I print the range of the CXXConstructExpr created from the initializer "QMap<Key, T>()", the result is only the parentheses: (), nothing more. <br><p class="western" style="margin-bottom: 0cm"><br></p>
The question is:<br>- Is there another way to obtain the CXXConstructExpr* from the CXXCtorInitializer*?<br>- Otherwise, how could I check if the object pointed by CXXConstructExpr* is formed correct? I cannot find nothing similar to "isValid" or something like that.<br><br>Thanks.<br> </div></body>
</html>