All the libclang functions for expanding a location, namely clang_getExpansionLocation, clang_getPresumedLocation, clang_getInstantiationLocation, and most surprisingly clang_getSpellingLocation return expansion locations, not spelling locations. As it turns out, there is no way to get a spelling location via libclang. This patch adds such a function.
Note that there's a FIXME in clang_getSpellingLocation about this, but changing clang_getSpellingLocation to actually return a spelling location would almost certainly break a large body of existing (third-party) code, mostly in subtle ways. I think it's better to introduce a new function, though I know it's ugly. But, this is what we've been using for the past year, and we've gotten quite comfortable with it.