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
"""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)
# 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