<br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><div class="gmail_extra">
<br><div class="gmail_quote"><div><div class="h5">On Wed, Nov 14, 2012 at 3:13 AM, Pascal Ognibene <span dir="ltr"><<a href="mailto:pognibene@gmail.com" target="_blank">pognibene@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">Hi all,<br><br>I have a clang::ParmVarDecl argument of a C++ function/method.<br>I need to retrieve the fully scoped type of this argument. For example:<br>

<br>namespace foo<br>{<br>   typedef struct<br>   {<br>      int bla;<br>
   } oneStruct;<br>}<br><br>...<br><br>namespace foo<br>{<br>    int one_function(oneStruct *arg);<br>};<br><br>When I get the clang::FunctionDecl * for one_function, I then get a ParmVarDecl * for arg.<br>To get the type I can use one of the QualType type = ParmVarDecl::get*Type() functions.<br>


However, when I get the type as a string, it's oneStruct * and not foo:oneStruct *<br><br>How can I get the fully scoped name of this parameter? (using clang 3.1)<br></div></div></blockquote></div></div></div></blockquote>
<div><br><br><br>2012/11/14 Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>></span><br>NamedDecl
 has getQualifiedNameAsString(). If you drill through to the decl from 
the type (in your case getPointeeCXXRecordDecl should do)  you can use 
it to get the fully qualified name. (There might be easier ways I'm not 
aware of :)<br>
<br><br>Hi Manuel,<br><br>When reading your answer I realized that there was a typo in my question: I'm actually looking for the fully scoped type of the parameter.<br>I still can't get what I want:<br><br>clang::ParmVarDecl *pdecl;<br>
clang::QualType retType1 = pdecl->getOriginalType();<br>const clang::Type * ttype = retType1.getTypePtrOrNull ( );<br>const clang::CXXRecordDecl * rdecl = ttype->getCXXRecordDeclForPointerType();  <br><br>Will give me the scope for a struct or class pointer parameter. However it does not work if I have a struct parameter (without a pointer)<br>
or any other type (scoped typedefs for example).<br><br>I can re-formulate my question as: from a ParmVarDecl *, how can I retrieve a pointer to the declaration of the parameter type?<br><br>Thank you for your help,<br><br>
Pascal<br><br></div></div>