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:<div>

<br></div><div>#define FOO foo</div><div>int FOO;</div><div><br></div><div>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?</div>

<div><br></div><div>Thanks.</div><div>-Mert</div>