<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Aug 24, 2011, at 2:13 PM, Jared Low wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><font size="2" face="sans-serif">I do need the parameter info. </font>
<br>
<br><font size="2" face="sans-serif">clang_getCursorDisplayName returns "void
VarArgFunc(int, ...)", and I want to display the name of the parameters
too: "void VarArgFunc(int p1, ...)"</font>
<br>
<br><font size="2" face="sans-serif">Your suggestion did help me, however.
I didn't realize that clang_getCursorDisplayName provided the parameter
types. So I can use that to figure out if the function has a variable argument
or not.</font>
<br></blockquote><div><br></div><div>...or you can improve clang_getCursorDisplayName so that it adds the parameter names ? :-)</div><br><blockquote type="cite">
<br><font size="2" face="sans-serif">Thanks for the help.</font>
<br>
<br>
<br>
<br>
<br><font size="1" color="#5f5f5f" face="sans-serif">From:      
 </font><font size="1" face="sans-serif">Argyrios Kyrtzidis
<<a href="mailto:akyrtzi@gmail.com">akyrtzi@gmail.com</a>></font>
<br><font size="1" color="#5f5f5f" face="sans-serif">To:      
 </font><font size="1" face="sans-serif">Jared Low <<a href="mailto:jared.low@ni.com">jared.low@ni.com</a>></font>
<br><font size="1" color="#5f5f5f" face="sans-serif">Cc:      
 </font><font size="1" face="sans-serif"><a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a></font>
<br><font size="1" color="#5f5f5f" face="sans-serif">Date:      
 </font><font size="1" face="sans-serif">08/23/2011 09:15 PM</font>
<br><font size="1" color="#5f5f5f" face="sans-serif">Subject:    
   </font><font size="1" face="sans-serif">Re: [cfe-dev]
Displaying prototype tooltips in an IDE</font>
<br>
<hr noshade="">
<br>
<br>
<br><font size="3">Is clang_getCursorDisplayName on the function sufficient
for your purposes or you need the parameter info ?</font>
<br>
<br><font size="3">On Aug 23, 2011, at 4:43 PM, Jared Low wrote:</font>
<br>
<br><font size="2" face="sans-serif">We are using Clang as our compiler,
and I want to display prototype tooltips in the IDE. I'm using libclang
to get various source code browsing information.</font><font size="3"> <br>
</font><font size="2" face="sans-serif"><br>
In order to get the prototype information, I create the translation unit
with clang_createTranslationUnit. Then I traverse the translation unit
with clang_visitChildren. Whenever I come upon a cursor of kind CXCursor_FunctionDecl,
I remember the cursor and then add any cursors of kind CXCursor_ParmDecl
that follow to a parameter list. Then when I want to display the function
prototype, I go thru the parameter cursor list, getting each parameter's
type and name.</font><font size="3"> <br>
</font><font size="2" face="sans-serif"><br>
This seems to work fine, except for variable argument functions. For example,
for the function</font><font size="3"> <br>
</font><font size="2" face="sans-serif"><br>
void VarArgFunc(int p1, ...)</font><font size="3"> </font><font size="2" face="sans-serif"><br>
{</font><font size="3"> </font><font size="2" face="sans-serif"><br>
        va_list        parmInfo;</font><font size="3">
</font><font size="2" face="sans-serif"><br>
        va_start(parmInfo, p1);</font><font size="3">
</font><font size="2" face="sans-serif"><br>
        va_end(parmInfo);</font><font size="3"> </font><font size="2" face="sans-serif"><br>
}</font><font size="3"> <br>
</font><font size="2" face="sans-serif"><br>
when traversing the translation unit with clang_visitChildren, the CXCursorVisitor
callback is not called for the '...' variable argument parameter. This
means that I can't tell that the function has a variable argument parameter,
and when I show the prototype tooltip, it just shows "void VarArgFunc(int
p1)".</font><font size="3"> <br>
</font><font size="2" face="sans-serif"><br>
How can I detect that the function has a variable argument parameter? Is
there some other better way to get this information?</font><font size="3">
<br>
</font><font size="2" face="sans-serif"><br>
Thanks</font><font size="3">_______________________________________________<br>
cfe-dev mailing list</font><font size="3" color="blue"><u><br>
</u></font><a href="mailto:cfe-dev@cs.uiuc.edu"><font size="3" color="blue"><u>cfe-dev@cs.uiuc.edu</u></font></a><font size="3"><br>
</font><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev"><font size="3">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</font></a>
<br>
<br></blockquote></div><br></body></html>