[cfe-commits] r63286 - /cfe/trunk/utils/ABITest/ABITestGen.py
Daniel Dunbar
daniel at zuster.org
Wed Jan 28 23:36:46 PST 2009
Author: ddunbar
Date: Thu Jan 29 01:36:46 2009
New Revision: 63286
URL: http://llvm.org/viewvc/llvm-project?rev=63286&view=rev
Log:
ABITest: Fix test value generation for unions.
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=63286&r1=63285&r2=63286&view=diff
==============================================================================
--- cfe/trunk/utils/ABITest/ABITestGen.py (original)
+++ cfe/trunk/utils/ABITest/ABITestGen.py Thu Jan 29 01:36:46 2009
@@ -193,9 +193,16 @@
yield '(%s) -1'%(t.name,)
yield '(%s) 1'%(t.name,)
elif isinstance(t, RecordType):
- fieldValues = [list(self.getTestValues(f)) for f in t.fields]
if not t.fields:
yield '{ }'
+ return
+ # FIXME: Use designated initializers to access non-first
+ # fields of unions.
+ if t.isUnion:
+ for v in self.getTestValues(t.fields[0]):
+ yield '{ %s }' % v
+ return
+ fieldValues = [list(self.getTestValues(f)) for f in t.fields]
for i,values in enumerate(fieldValues):
for v in values:
elements = map(random.choice,fieldValues)
More information about the cfe-commits
mailing list