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.<br>

<br><div class="gmail_quote">On Thu, Oct 25, 2012 at 9:59 PM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com" target="_blank">eli.friedman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="HOEnZb"><div class="h5">On Thu, Oct 25, 2012 at 3:56 PM, Mert Akinc <<a href="mailto:makinc@gmail.com">makinc@gmail.com</a>> wrote:<br>
> I'm using libclang 2.9. It appears that when you call clang_getCursorExtent<br>
> on a cursor that ends on a macro instantiation, the returned extent's end<br>
> location is wrong. It points to the end of the macro definition. For<br>
> example:<br>
><br>
> #define FOO foo<br>
> int FOO;<br>
><br>
> The range end I get for the VarDecl cursor points to the first character<br>
> after "foo", so the end location actually precedes the start location. I<br>
> assume this is a bug. Is there a way to work around this and get a<br>
> meaningful extent?<br>
<br>
</div></div>Have you taken a look at clang_getExpansionLocation ?<br>
<span class="HOEnZb"><font color="#888888"><br>
-Eli<br>
</font></span></blockquote></div><br>