Skip to content

Commit f3e575a

Browse files
author
git apple-llvm automerger
committed
Merge commit 'edb80a8d7fb2' from llvm.org/main into next
2 parents c3259f5 + edb80a8 commit f3e575a

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

lldb/test/API/lang/cpp/floating-types-specialization/TestCppFloatingTypesSpecialization.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import lldb
2+
import lldbsuite.test.lldbplatformutil as lldbplatformutil
23
from lldbsuite.test.decorators import *
34
from lldbsuite.test.lldbtest import *
45
from lldbsuite.test import lldbutil
@@ -11,12 +12,25 @@ def test(self):
1112
self, "// break here", lldb.SBFileSpec("main.cpp", False)
1213
)
1314

14-
self.expect_expr("f0", result_type="Foo<__bf16>")
15-
self.expect_expr("f1", result_type="Foo<__fp16>")
15+
# On 32-bit Arm, you have to have the bfloat16 extension, or an FPU while
16+
# not using the soft float mode. The target we assume has none of that
17+
# so instead of __bf16 we get __fp16.
18+
is_arm_32_bit = lldbplatformutil.getArchitecture() == "arm"
19+
20+
self.expect_expr(
21+
"f0", result_type=("Foo<__fp16>" if is_arm_32_bit else "Foo<__bf16>")
22+
)
23+
24+
# When __bf16 is actually __fp16, f1 looks like it inherits from itself.
25+
# Which clang allows but LLDB fails to evaluate.
26+
if not is_arm_32_bit:
27+
self.expect_expr("f1", result_type="Foo<__fp16>")
1628

1729
# Test sizeof to ensure while computing layout we don't do
1830
# infinite recursion.
1931
v = self.frame().EvaluateExpression("sizeof(f0)")
2032
self.assertEqual(v.GetValueAsUnsigned() > 0, True)
21-
v = self.frame().EvaluateExpression("sizeof(f1)")
22-
self.assertEqual(v.GetValueAsUnsigned() > 0, True)
33+
34+
if not is_arm_32_bit:
35+
v = self.frame().EvaluateExpression("sizeof(f1)")
36+
self.assertEqual(v.GetValueAsUnsigned() > 0, True)

lldb/test/API/lang/cpp/template-arguments/TestCppTemplateArguments.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import lldb
2+
import lldbsuite.test.lldbplatformutil as lldbplatformutil
23
from lldbsuite.test.decorators import *
34
from lldbsuite.test.lldbtest import *
45
from lldbsuite.test import lldbutil
@@ -82,8 +83,12 @@ def test(self):
8283
value = self.expect_expr("temp7", result_type="Foo<__fp16, __fp16>")
8384
self.assertFalse(value.GetType().GetTemplateArgumentValue(target, 1))
8485

85-
value = self.expect_expr("temp8", result_type="Foo<__bf16, __bf16>")
86-
self.assertFalse(value.GetType().GetTemplateArgumentValue(target, 1))
86+
# The target we use when evaluating these expressions for Arm leads to there
87+
# not being a __bf16 type in the AST so we fall back to __fp16 and evaluating
88+
# this fails.
89+
if lldbplatformutil.getArchitecture() != "arm":
90+
value = self.expect_expr("temp8", result_type="Foo<__bf16, __bf16>")
91+
self.assertFalse(value.GetType().GetTemplateArgumentValue(target, 1))
8792

8893
value = self.expect_expr("temp9", result_type="Bar<double, 1.200000e+00>")
8994
template_param_value = value.GetType().GetTemplateArgumentValue(target, 1)

0 commit comments

Comments
 (0)