[cfe-dev] Get the header file in which a function is declared

Riyad Parvez riyad.parvez at gmail.com
Mon Apr 6 13:27:54 PDT 2015


Hi,

I'm trying to get header file in which a function is declared using 
libtooling in clang.


#include <stdio.h>

int main() {
   void *ptr = malloc(10);
   return 0;
}

In above example, I can get "FunctionDecl" object of "malloc". But how 
can I get in which header file "malloc" is declared (in above example, 
it's "stdio.h") provided that I've "FunctionDecl" object?

Thanks
Riyad



More information about the cfe-dev mailing list