From: Daniel Dunbar Date: Fri, 29 Jan 2010 17:02:32 +0000 (+0000) Subject: cindex/Python: Update to support _getInstantiationLocation's new offset value. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3239a67361cc89eba2fe7c7abdb41bd2c9414207;p=clang cindex/Python: Update to support _getInstantiationLocation's new offset value. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94813 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py index ee996bbf8b..1734ddbcaf 100644 --- a/bindings/python/clang/cindex.py +++ b/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 "" % ( 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