Using clang_getInstantiationLocation()

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Using clang_getInstantiationLocation()

Stefan Seefeld
The documentation for clang_getInstantiationLocation() suggests that the
second parameter has to be a pointer to a CXFile (object), which will be
set to refer to the given location. I couldn't find any way to create
such a CXFile instance without initializing it to a specific value. Does
it exist ?

In my context I have a CXCursor, from which I want to construct a source
location in terms of (filename, line-number, column), and I'm not sure
how I'm supposed to do that.

Thanks,
         Stefan

--

       ...ich hab' noch einen Koffer in Berlin...
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Using clang_getInstantiationLocation()

Douglas Gregor

On Mar 18, 2010, at 6:09 AM, Stefan Seefeld wrote:

> The documentation for clang_getInstantiationLocation() suggests that the
> second parameter has to be a pointer to a CXFile (object), which will be
> set to refer to the given location. I couldn't find any way to create
> such a CXFile instance without initializing it to a specific value. Does
> it exist ?

Just declare a variable of type CXFile and pass its address to clang_getInstantiationLocation.

> In my context I have a CXCursor, from which I want to construct a source
> location in terms of (filename, line-number, column), and I'm not sure
> how I'm supposed to do that.


Given CXCursor C, it's just:

        CXFile file;
        unsigned line, column;
        clang_getInstantiationLocation(clang_getCursorLocation(C), &file, &line, &column, 0);

        - Doug
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev