================
@@ -172,3 +172,69 @@ def test_type_conversions(self):
         self.assertEqual(short_val.GetValueAsSigned(), -1)
         long_val = target.EvaluateExpression("(long) " + short_val.GetName())
         self.assertEqual(long_val.GetValueAsSigned(), -1)
+
+    def test_fpconv(self):
+        self.build_and_run()
+
+        interp_options = lldb.SBExpressionOptions()
+        interp_options.SetLanguage(lldb.eLanguageTypeC_plus_plus)
+        interp_options.SetAllowJIT(False)
+
+        jit_options = lldb.SBExpressionOptions()
+        jit_options.SetLanguage(lldb.eLanguageTypeC_plus_plus)
+        jit_options.SetAllowJIT(True)
+
+        set_up_expressions = [
+            "int $i = 3",
+            "int $n = -3",
+            "unsigned $u = 5",
+            "long $l = -7",
+            "float $f = 9.0625",
+            "double $d = 13.75",
+            "float $nf = -11.25",
+        ]
+
+        expressions = [
+            "$i + $f",
+            "$d - $n",
+            "$u + $f",
+            "$u + $d",
+            "(int)$d",
+            "(int)$f",
+            "(long)$d",
+            "(short)$f",
+            "(long)$nf",
+            "(unsigned short)$f",
+            "(unsigned)$d",
+            "(unsigned long)$d",
+            "(float)$d",
+            "(double)$f",
+            "(double)$nf",
+        ]
----------------
igorkudrin wrote:

Expressions like these can and will be fully optimized by the compiler; the 
prepared module will not contain instructions that we want to check in this 
test.

https://github.com/llvm/llvm-project/pull/175292
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to