[cfe-commits] r71273 - /cfe/trunk/utils/ABITest/ABITestGen.py
Daniel Dunbar
daniel at zuster.org
Fri May 8 15:48:39 PDT 2009
Author: ddunbar
Date: Fri May 8 17:48:39 2009
New Revision: 71273
URL: http://llvm.org/viewvc/llvm-project?rev=71273&view=rev
Log:
ABITest: Fix a bug in generating test values for structures w/ no
non-padding fields.
Modified:
cfe/trunk/utils/ABITest/ABITestGen.py
Modified: cfe/trunk/utils/ABITest/ABITestGen.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/ABITest/ABITestGen.py?rev=71273&r1=71272&r2=71273&view=diff
==============================================================================
--- cfe/trunk/utils/ABITest/ABITestGen.py (original)
+++ cfe/trunk/utils/ABITest/ABITestGen.py Fri May 8 17:48:39 2009
@@ -199,31 +199,27 @@
yield '(%s) -1'%(t.name,)
yield '(%s) 1'%(t.name,)
elif isinstance(t, RecordType):
- if not t.fields:
+ nonPadding = [f for f in t.fields
+ if not f.isPaddingBitField()]
+
+ if not nonPadding:
yield '{ }'
return
+
# FIXME: Use designated initializers to access non-first
# fields of unions.
if t.isUnion:
- firstNonPadding = None
- for t in t.fields:
- if not t.isPaddingBitField():
- firstNonPadding = t
- break
- if firstNonPadding:
- for v in self.getTestValues(firstNonPadding):
- yield '{ %s }' % v
- else:
- yield '{ }'
+ for v in self.getTestValues(nonPadding[0]):
+ yield '{ %s }' % v
return
- fieldValues = [list(self.getTestValues(f))
- for f in t.fields
- if not f.isPaddingBitField()]
+
+ fieldValues = map(list, map(self.getTestValues, nonPadding))
for i,values in enumerate(fieldValues):
for v in values:
elements = map(random.choice,fieldValues)
elements[i] = v
yield '{ %s }'%(', '.join(elements))
+
elif isinstance(t, ComplexType):
for t in self.getTestValues(t.elementType):
yield '%s + %s * 1i'%(t,t)
More information about the cfe-commits
mailing list