summaryrefslogtreecommitdiffstats
path: root/clang/bindings/python
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-01-29 17:02:32 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-01-29 17:02:32 +0000
commitce9a4faea5b84acef9722990e75a79e68a595041 (patch)
tree6678bf88a53719f3fe3cbf9645f54e169b745390 /clang/bindings/python
parent6596984f3cc11ed41dcfc34c8f825f727dc1c3a3 (diff)
downloadbcm5719-llvm-ce9a4faea5b84acef9722990e75a79e68a595041.tar.gz
bcm5719-llvm-ce9a4faea5b84acef9722990e75a79e68a595041.zip
cindex/Python: Update to support _getInstantiationLocation's new offset value.
llvm-svn: 94813
Diffstat (limited to 'clang/bindings/python')
-rw-r--r--clang/bindings/python/clang/cindex.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/clang/bindings/python/clang/cindex.py b/clang/bindings/python/clang/cindex.py
index ee996bbf8b8..1734ddbcaf7 100644
--- a/clang/bindings/python/clang/cindex.py
+++ b/clang/bindings/python/clang/cindex.py
@@ -105,10 +105,10 @@ class SourceLocation(Structure):
def _get_instantiation(self):
if self._data is None:
- f, l, c = c_object_p(), c_uint(), c_uint()
- SourceLocation_loc(self, byref(f), byref(l), byref(c))
+ f, l, c, o = c_object_p(), c_uint(), c_uint(), c_uint()
+ SourceLocation_loc(self, byref(f), byref(l), byref(c), byref(o))
f = File(f) if f else None
- self._data = (f, int(l.value), int(c.value))
+ self._data = (f, int(l.value), int(c.value), int(c.value))
return self._data
@property
@@ -126,6 +126,11 @@ class SourceLocation(Structure):
"""Get the column represented by this source location."""
return self._get_instantiation()[2]
+ @property
+ def offset(self):
+ """Get the file offset represented by this source location."""
+ return self._get_instantiation()[3]
+
def __repr__(self):
return "<SourceLocation file %r, line %r, column %r>" % (
self.file.name if self.file else None, self.line, self.column)
@@ -593,7 +598,8 @@ _CXString_getCString.restype = c_char_p
# Source Location Functions
SourceLocation_loc = lib.clang_getInstantiationLocation
SourceLocation_loc.argtypes = [SourceLocation, POINTER(c_object_p),
- POINTER(c_uint), POINTER(c_uint)]
+ POINTER(c_uint), POINTER(c_uint),
+ POINTER(c_uint)]
# Source Range Functions
SourceRange_start = lib.clang_getRangeStart
OpenPOWER on IntegriCloud