[cfe-dev] clang_getCursorExtent of macro instantiation

Mert Akinc makinc at gmail.com
Fri Oct 26 08:39:15 PDT 2012


That doesn't exist in the version I'm using (2.9), but I'm using
clang_getInstantiationLocation which, from the documentation and observed
behavior, appears to be identical. I'm guessing it was just renamed to
clang_getExpansionLocation for clarity.

On Thu, Oct 25, 2012 at 9:59 PM, Eli Friedman <eli.friedman at gmail.com>wrote:

> On Thu, Oct 25, 2012 at 3:56 PM, Mert Akinc <makinc at gmail.com> wrote:
> > I'm using libclang 2.9. It appears that when you call
> clang_getCursorExtent
> > on a cursor that ends on a macro instantiation, the returned extent's end
> > location is wrong. It points to the end of the macro definition. For
> > example:
> >
> > #define FOO foo
> > int FOO;
> >
> > The range end I get for the VarDecl cursor points to the first character
> > after "foo", so the end location actually precedes the start location. I
> > assume this is a bug. Is there a way to work around this and get a
> > meaningful extent?
>
> Have you taken a look at clang_getExpansionLocation ?
>
> -Eli
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121026/be815a6c/attachment.html>


More information about the cfe-dev mailing list