[cfe-dev] libclang: clang_getCursorDefinition doesn't work correctly for template class methods not defined within the class

don hinton hintonda at gmail.com
Sat Aug 11 15:35:33 PDT 2012


Hi:

clang_getCursorDefinition()
works fine for non-template
classes, but not for methods of
template classes where the
definition is not in the class, e.g.,

01 template <typename T>
02 class X
03 {
04 public:
05   void f (void);
06 };
07
08 template <typename T>
09 void X<T>::f (void) {}
10
11 void g (void)
12 {
13   X x;
14   x.f();
15 }

If I call clang_getCursorDefinition() on
the cursor for X::f on line 14, it
will give me a cursor for the
declaration on line 5 not the
definition on line 9.

Is this expected or is it a bug?

I have svn revision 161180.

thanks...
don




More information about the cfe-dev mailing list