[cfe-dev] Displaying prototype tooltips in an IDE
Argyrios Kyrtzidis
akyrtzi at gmail.com
Wed Aug 24 17:19:24 PDT 2011
On Aug 24, 2011, at 2:13 PM, Jared Low wrote:
> I do need the parameter info.
>
> clang_getCursorDisplayName returns "void VarArgFunc(int, ...)", and I want to display the name of the parameters too: "void VarArgFunc(int p1, ...)"
>
> 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.
...or you can improve clang_getCursorDisplayName so that it adds the parameter names ? :-)
>
> Thanks for the help.
>
>
>
>
> From: Argyrios Kyrtzidis <akyrtzi at gmail.com>
> To: Jared Low <jared.low at ni.com>
> Cc: cfe-dev at cs.uiuc.edu
> Date: 08/23/2011 09:15 PM
> Subject: Re: [cfe-dev] Displaying prototype tooltips in an IDE
>
>
>
> Is clang_getCursorDisplayName on the function sufficient for your purposes or you need the parameter info ?
>
> On Aug 23, 2011, at 4:43 PM, Jared Low wrote:
>
> 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.
>
> 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.
>
> This seems to work fine, except for variable argument functions. For example, for the function
>
> void VarArgFunc(int p1, ...)
> {
> va_list parmInfo;
> va_start(parmInfo, p1);
> va_end(parmInfo);
> }
>
> 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)".
>
> How can I detect that the function has a variable argument parameter? Is there some other better way to get this information?
>
> Thanks_______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110824/fa441fa7/attachment.html>
More information about the cfe-dev
mailing list