[cfe-dev] Displaying prototype tooltips in an IDE
Argyrios Kyrtzidis
akyrtzi at gmail.com
Tue Aug 23 19:16:14 PDT 2011
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/20110823/2a8077e7/attachment.html>
More information about the cfe-dev
mailing list