Skip to content

Ignoring function declaration? #12

@afrizalhasbi

Description

@afrizalhasbi

Hi there, first off thanks to the developer for the very cool open source tool!

At the moment, im trying use clangql for a project, and have this issue when a file contains both standalone function declarations and function definition, clangql would retrieve the function declaration instead of the definition.

For example running this query on Nic Baker's Clay: clangql -f clay/clay.c -q "select * from functions -o json gives me this output on the last element:

"name":"Clay__GetParentElementId","return_type":"uint32_t","signature":"uint32_t (void)","source_loc":"clay/clay.c:890:26"}

However, looking at the source code, this is just the function declaration, and the full definition is provided in line 1280:

uint32_t Clay__GetParentElementId(void) {
    Clay_Context* context = Clay_GetCurrentContext();
    return Clay_LayoutElementArray_Get(&context->layoutElements, Clay__int32_tArray_GetValue(&context->openLayoutElementStack, context->openLayoutElementStack.length - 2))->id;
}

In my current use case I need to retrieve only the full function definitions. Any ideas on how to go around this?

Disclaimer: I'm not familiar with C programming, but my current project require me to dig into C source codes.

Kindly thanks,
Afrizal

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions