Skip to content

Commit 259df8c

Browse files
committed
Extend and improve tests for llvm 3.9
1 parent 02085bb commit 259df8c

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

unittests/test_va_list_tag_removal.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ def __init__(self, *args):
2929
"__int128_t", "__uint128_t", "__builtin_va_list"]
3030
self.known_typedefs_llvm39 = \
3131
self.known_typedefs + ["__builtin_ms_va_list"]
32+
self.known_classes = ["a", "__va_list_tag"]
33+
self.known_classes_llvm39 = \
34+
self.known_classes + ["__NSConstantString_tag"]
3235

3336
def test_keep_va_list_tag(self):
3437

@@ -52,10 +55,16 @@ def test_keep_va_list_tag(self):
5255

5356
self.assertTrue(tag in [class_.name for class_ in classes])
5457
self.assertTrue("a" in [class_.name for class_ in classes])
55-
self.assertTrue(len(classes) == 2)
56-
57-
self.assertTrue(len(typedefs) == 4)
58-
if tag not in [ty.name for ty in typedefs]:
58+
if len(classes) == 2:
59+
for c in self.known_classes:
60+
self.assertTrue(c in [cl.name for cl in classes])
61+
elif len(classes) == 3:
62+
for c in self.known_classes_llvm39:
63+
# This is for llvm 3.9
64+
self.assertTrue(c in [cl.name for cl in classes])
65+
66+
self.assertTrue(len(typedefs) == 4 or len(typedefs) == 5)
67+
if len(typedefs) == 5:
5968
# This is for llvm 3.9. The class __va_list_tag struct is still
6069
# there but the typedef is gone
6170
for t in self.known_typedefs_llvm39:
@@ -71,7 +80,10 @@ def test_keep_va_list_tag(self):
7180

7281
self.assertTrue(
7382
tag in [var.decl_string.split("::")[1] for var in variables])
74-
self.assertTrue(len(variables) == 4)
83+
84+
# 4 variables in __va_list_tag, and 4 more in __NSConstantString_tag
85+
# for llvm 3.9
86+
self.assertTrue(len(variables) == 4 or len(variables) == 8)
7587

7688
def test_remove_va_list_tag(self):
7789

0 commit comments

Comments
 (0)