Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

clang auto complete function arguments aren't shown/parsed #15631

Open Quuxplusone opened 11 years ago

Quuxplusone commented 11 years ago
Bugzilla Link PR15631
Status NEW
Importance P normal
Reported by reportados123@gmail.com
Reported on 2013-03-30 16:53:16 -0700
Last modified on 2013-03-30 16:56:56 -0700
Version 3.2
Hardware PC Linux
CC
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
I'm using clang to auto complete my functions, which completes and shows the
arguments for normal C++ standard libraries, however, when I use OpenGL, for
example, it shows the functions, but doesn't show the arguments for the
function.

I'm using GLEW and GLFW to create me function pointers to the OpenGL functions
so I don't have to do it. My sample code is this:

#include <GL/glew.h>
#include <GL/glfw.h>

int main() {
    glfwInit();
    glfwOpenWindow(1024, 768, 0, 0, 0, 0, 0, 0, GLFW_WINDOW);

    glewExperimental = GL_TRUE;
    glewInit();

    // Try auto completing a function here (ex: glBindBuffer, or glGenBuffers)
}

As you can see, if you try to complete glBindBuffer, it will show the function,
but it won't show the arguments for it. I think the problem is because of the
two or three level abstraction introduced by macros, that means it stops
resolving after it finds the first macro, i.e it treats glGetBuffer as
GLEW_GET_FUN(__glewBindBuffer), which it doesn’t parse recursively in order to
get to typedef void (GLAPIENTRY * PFNGLBINDBUFFERPROC) (GLenum target, GLuint
buffer). And the parser may or may not be able to handle the typedef either.

I tried QtCreator with ClangCodeModel and Vim clang_complete(which they both
use clang to generate auto completion) and they don't give me argument
completion to the OpenGL functions.
Quuxplusone commented 11 years ago

I also had a thread about this on the Qt forums, which is here: https://qt-project.org/forums/viewthread/26215/