- Add two new properties to SourceLocation: expansion and spelling, allowing detailed source location information to be retrieved from a cursor.
- Update the implementation to use clang_getExpansionLocation instead of the deprecated clang_getInstantiationLocation, which has been present since 2011.
- Update the implementation of clang_getSpellingLocation to actually obtain spelling location instead of file location.
Details
- Reviewers
compnerd
Diff Detail
Event Timeline
Please note:
- this change means that versions of libclang built prior to the introduction of clang_getExpansionLocation will not work.
- this change alters the behavior of clang_getSpellingLocation to return the spelling location
I would appreciate advice on if either of these changes are acceptable. Thank you.
If I'm not mistaken, the change just means that the python bindings need a "newer" libclang, libclang's interfaces don't really change. I think that is acceptable.
bindings/python/clang/cindex.py | ||
---|---|---|
320 | Does it make sense to introduce two new properties expansion and spelling and have the four fields be properties on those properties? It seems like it would be more pythonic. | |
tools/libclang/CXSourceLocation.cpp | ||
321 | Remove the FIXME please. |
bindings/python/clang/cindex.py | ||
---|---|---|
320 | I agree, but I was concerned about breaking existing users that might be using the expansion properties directly on this object. Would marking them deprecated in the documentation suffice? |
bindings/python/clang/cindex.py | ||
---|---|---|
320 | Yeah, I think thats a great approach. |
bindings/python/clang/cindex.py | ||
---|---|---|
214 | Can you also add Location to __all__? |
Can you also add Location to __all__?