Portable Python script across Python version

Python3 does not support type destructuring in function parameters.

Differential Revision: https://reviews.llvm.org/D55198

llvm-svn: 348129
This commit is contained in:
Serge Guelton 2018-12-03 12:41:35 +00:00
parent 91728fcd19
commit 75394aa5bb
2 changed files with 4 additions and 2 deletions

View File

@ -46,7 +46,8 @@ aleph0 = Aleph0()
def base(line):
return line*(line+1)//2
def pairToN((x,y)):
def pairToN(pair):
x,y = pair
line,index = x+y,y
return base(line)+index

View File

@ -99,7 +99,8 @@ class RecordType(Type):
' '.join(map(getField, self.fields)))
def getTypedefDef(self, name, printer):
def getField((i, t)):
def getField(it):
i, t = it
if t.isBitField():
if t.isPaddingBitField():
return '%s : 0;'%(printer.getTypeName(t),)