aboutsummaryrefslogtreecommitdiff
path: root/utils/ABITest
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-01-29 07:36:46 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-01-29 07:36:46 +0000
commit900ed55727a5dd2a59412df00ea1513b851cd49a (patch)
tree8026b872629c6488ea20fa5097de0b1b05e9491e /utils/ABITest
parentb0e14f2a878c1a823341d34ca8f8fe60419fb9ef (diff)
ABITest: Fix test value generation for unions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63286 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/ABITest')
-rwxr-xr-xutils/ABITest/ABITestGen.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/utils/ABITest/ABITestGen.py b/utils/ABITest/ABITestGen.py
index 8f922d7e52..5b9756b545 100755
--- a/utils/ABITest/ABITestGen.py
+++ b/utils/ABITest/ABITestGen.py
@@ -193,9 +193,16 @@ class TypePrinter:
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)