<div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word">
<div><div class="h5"><blockquote type="cite"><div class="gmail_extra"><br>
</div></blockquote><br></div></div><div>But why not instead just directly look at the initializer for theBigGiantGlobalVariable, which will be a CXXConstructExpr pointing directly to the default constructor?  You can then walk over the initializers in that constructor — which, since it's an implicitly-defined default constructor, should all be non-trivial — and see what constructors they use, etc.</div>
<div><br></div></div></blockquote><div><br></div><div>I can get as far as finding the CXXConstructExpr like you mention (using code from Eli's reply) :</div><div><br></div><div><div>   bool VisitVarDecl( VarDecl * var )</div>
<div>   {</div><div>      Expr * Init = var->getInit() ;</div><div>      bool IsGlobal = var->hasGlobalStorage() && !var->isStaticLocal() ;</div><div>      QualType type = var->getType();</div><div>      ASTContext & Context = ci.getASTContext() ;</div>
<div>      QualType baseType = Context.getBaseElementType( type ) ;</div><div><br></div><div>      if (!var->getDeclContext()->isDependentContext() && Init && !Init->isValueDependent())</div><div>
      {</div><div>         if (IsGlobal && !var->isConstexpr() &&</div><div>              !Init->isConstantInitializer(Context, baseType->isReferenceType()))</div><div>         {</div><div>            if ( const CXXConstructExpr * r = dyn_cast<CXXConstructExpr>( Init ) )</div>
<div>            {</div><div>               cout << "found global CXXConstructExpr" << endl ;</div><div>            }</div><div>         }</div><div>      }</div><div><br></div><div>      return true ;</div>
<div>   }</div></div><div><br></div><div>How do I walk over the initializers in that constructor?  I'd tried:<br><br><div>               for ( CXXConstructExpr::const_arg_iterator b = r->arg_begin(), e = r->arg_end() ;</div>
<div>                     b != e ; ++b )</div><div><br></div></div><div>but this appears to be wrong, and results in an empty iteration.</div><div><br></div><div>Peeter</div></div>
</div>