summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Grosser <grosser@fim.uni-passau.de>2011-10-31 00:49:07 +0000
committerTobias Grosser <grosser@fim.uni-passau.de>2011-10-31 00:49:07 +0000
commit237f5a07fac0895ba77e22d605cd825d9ba6ddd0 (patch)
treedef2e7ecd7e835009290b5615420efe82837b256
parent43459974f1e9acdf8044c1c2336212b802706d2e (diff)
downloadbcm5719-llvm-237f5a07fac0895ba77e22d605cd825d9ba6ddd0.tar.gz
bcm5719-llvm-237f5a07fac0895ba77e22d605cd825d9ba6ddd0.zip
clang.py: Remove use of ternary operators
This change is necessary to make this file python 2.4 compatible. llvm-svn: 143324
-rw-r--r--clang/bindings/python/clang/cindex.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/clang/bindings/python/clang/cindex.py b/clang/bindings/python/clang/cindex.py
index 9ab9ae8a17c..1c62cc95554 100644
--- a/clang/bindings/python/clang/cindex.py
+++ b/clang/bindings/python/clang/cindex.py
@@ -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):
"""
OpenPOWER on IntegriCloud