[cfe-commits] r94813 - /cfe/trunk/bindings/python/clang/cindex.py

Daniel Dunbar daniel at zuster.org
Fri Jan 29 09:02:32 PST 2010


Author: ddunbar
Date: Fri Jan 29 11:02:32 2010
New Revision: 94813

URL: http://llvm.org/viewvc/llvm-project?rev=94813&view=rev
Log:
cindex/Python: Update to support _getInstantiationLocation's new offset value.

Modified:
    cfe/trunk/bindings/python/clang/cindex.py

Modified: cfe/trunk/bindings/python/clang/cindex.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/clang/cindex.py?rev=94813&r1=94812&r2=94813&view=diff

==============================================================================
--- cfe/trunk/bindings/python/clang/cindex.py (original)
+++ cfe/trunk/bindings/python/clang/cindex.py Fri Jan 29 11:02:32 2010
@@ -105,10 +105,10 @@
 
     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 @@
         """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 @@
 # 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





More information about the cfe-commits mailing list