]> granicus.if.org Git - clang/commitdiff
clang.py: Remove use of ternary operators
authorTobias Grosser <grosser@fim.uni-passau.de>
Mon, 31 Oct 2011 00:49:07 +0000 (00:49 +0000)
committerTobias Grosser <grosser@fim.uni-passau.de>
Mon, 31 Oct 2011 00:49:07 +0000 (00:49 +0000)
This change is necessary to make this file python 2.4 compatible.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143324 91177308-0d34-0410-b5e6-96231b3b80d8

bindings/python/clang/cindex.py

index 9ab9ae8a17c9f304569e677e0695f2af6eb79201..1c62cc95554cfafde4433c2b1dfb606ea0d48750 100644 (file)
@@ -111,7 +111,10 @@ class SourceLocation(Structure):
         if self._data is None:
             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
+            if f:
+                f = File(f)
+            else:
+                f = None
             self._data = (f, int(l.value), int(c.value), int(o.value))
         return self._data
 
@@ -144,8 +147,12 @@ class SourceLocation(Structure):
         return self._get_instantiation()[3]
 
     def __repr__(self):
+        if self.file:
+            filename = self.file.name
+        else:
+            filename = None
         return "<SourceLocation file %r, line %r, column %r>" % (
-            self.file.name if self.file else None, self.line, self.column)
+            filename, self.line, self.column)
 
 class SourceRange(Structure):
     """