11import lldb
2+ import lldbsuite .test .lldbplatformutil as lldbplatformutil
23from lldbsuite .test .decorators import *
34from lldbsuite .test .lldbtest import *
45from 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 )
0 commit comments