From 676fdd81d5e98e88fe831bd241c95da4b7208d8f Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Thu, 29 Jan 2009 07:36:46 +0000 Subject: ABITest: Fix test value generation for unions. llvm-svn: 63286 --- clang/utils/ABITest/ABITestGen.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'clang/utils/ABITest/ABITestGen.py') diff --git a/clang/utils/ABITest/ABITestGen.py b/clang/utils/ABITest/ABITestGen.py index 8f922d7e52f..5b9756b5450 100755 --- a/clang/utils/ABITest/ABITestGen.py +++ b/clang/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) -- cgit v1.2.3