--- /dev/null
+C_SOURCES := main.c
+CFLAGS_EXTRAS := -std=c99
+
+include Makefile.rules
--- /dev/null
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @no_debug_info_test
+ def test(self):
+ self.build()
+ lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.c"))
+
+ self.expect_expr("complex_float", result_type="_Complex float", result_value="-1.5 + -2.5i")
+ self.expect_expr("complex_float + (2.0f + 3.5fi)", result_type="_Complex float", result_value="0.5 + 1i")
+
+ self.expect_expr("complex_double", result_type="_Complex double", result_value="-1.5 + -2.5i")
+ self.expect_expr("complex_double + (2.0 + 3.5i)", result_type="_Complex double", result_value="0.5 + 1i")
+
+ @no_debug_info_test
+ # FIXME: LLDB fails to read the imaginary part of the number.
+ @expectedFailureAll()
+ def test_long_double(self):
+ self.build()
+ lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.c"))
+
+ self.expect_expr("complex_long_double", result_type="_Complex long double", result_value="-1.5 + 1i")
+ self.expect_expr("complex_long_double + (2.0L + 3.5Li)", result_type="_Complex long double", result_value="0.5 + 1i")
--- /dev/null
+#include <complex.h>
+
+int main() {
+ float complex complex_float = -1.5f + -2.5f * I;
+ double complex complex_double = -1.5 + -2.5 * I;
+ long double complex complex_long_double = -1.5L + -2.5L * I;
+ return 0; // break here
+}
--- /dev/null
+C_SOURCES := main.c
+
+include Makefile.rules
--- /dev/null
+"""
+Tests GCC's complex integer types.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @no_debug_info_test
+ def test(self):
+ self.build()
+ lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.c"))
+
+ # FIXME: LLDB treats all complex ints as unsigned, so the value is wrong.
+ self.expect_expr("complex_int", result_type="_Complex int", result_value="4294967295 + 4294967294i")
+ self.expect_expr("complex_long", result_type="_Complex long")
+
+ self.expect_expr("complex_unsigned", result_type="_Complex int", result_value="1 + 2i")
+ self.expect_expr("complex_unsigned_long", result_type="_Complex long", result_value="1 + 2i")
+
+ @no_debug_info_test
+ def test_long_long(self):
+ self.build()
+ lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.c"))
+
+ # FIXME: We get the type wrong if long has the same size as long long.
+ # FIXME: LLDB treats all complex ints as unsigned, so the value is wrong.
+ self.expect_expr("complex_long_long", result_type="_Complex long")
+ self.expect_expr("complex_unsigned_long_long", result_type="_Complex long", result_value="1 + 2i")
--- /dev/null
+#include <complex.h>
+
+int main() {
+ int complex complex_int = -1 + -2 * I;
+ long complex complex_long = -1 + -2 * I;
+ long long complex complex_long_long = -1 + -2 * I;
+
+ unsigned complex complex_unsigned = 1 + 2 * I;
+ unsigned long complex complex_unsigned_long = 1 + 2 * I;
+ unsigned long long complex complex_unsigned_long_long = 1 + 2 * I;
+ return 0; // break here
+}