omjavaid created this revision.
omjavaid added a reviewer: tberghammer.
omjavaid added a subscriber: lldb-commits.

This patch adds tests to test complex return types and aggregate return types 
with vector elements.

http://reviews.llvm.org/D17716

Files:
  packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
  packages/Python/lldbsuite/test/functionalities/return-value/call-func.c

Index: packages/Python/lldbsuite/test/functionalities/return-value/call-func.c
===================================================================
--- packages/Python/lldbsuite/test/functionalities/return-value/call-func.c
+++ packages/Python/lldbsuite/test/functionalities/return-value/call-func.c
@@ -1,3 +1,4 @@
+#include <complex.h>    /* Standard Library of Complex Numbers */
 // Some convenient things to return:
 static char *g_first_pointer = "I am the first";
 static char *g_second_pointer = "I am the second";
@@ -345,6 +346,77 @@
     return value;
 }
 
+struct two_vectors_8_bytes
+{
+  vector_size_float32_8 first_vector_8_bytes;
+  vector_size_float32_8 second_vector_8_bytes;
+};
+
+struct two_vectors_8_bytes
+return_two_vectors_8_bytes (struct two_vectors_8_bytes value)
+{
+  return value;
+}
+
+struct four_vectors_16_bytes
+{
+  vector_size_float32_16 first_vector_16_bytes;
+  vector_size_float32_16 second_vector_16_bytes;
+  vector_size_float32_16 third_vector_16_bytes;
+  vector_size_float32_16 fourth_vector_16_bytes;
+};
+
+struct four_vectors_16_bytes
+return_four_vectors_16_bytes (struct four_vectors_16_bytes value)
+{
+  return value;
+}
+
+struct four_vectors_32_bytes
+{
+  vector_size_float32_32 first_vector_32_bytes;
+  vector_size_float32_32 second_vector_32_bytes;
+  vector_size_float32_32 third_vector_32_bytes;
+  vector_size_float32_32 fourth_vector_32_bytes;
+};
+
+struct four_vectors_32_bytes
+return_four_vectors_32_bytes (struct four_vectors_32_bytes value)
+{
+  return value;
+}
+
+double complex
+return_one_complex (double complex value)
+{
+  return value;
+}
+
+struct two_complex
+{
+  double complex z0;
+  double complex z1;
+};
+
+struct two_complex
+return_two_complex (struct two_complex value)
+{
+  return value;
+}
+
+struct three_complex
+{
+  float complex z0;
+  float complex z1;
+  float complex z2;
+};
+
+struct three_complex
+return_three_complex (struct three_complex value)
+{
+  return value;
+}
+
 int 
 main ()
 {
@@ -395,10 +467,22 @@
   return_one_int_one_double_packed ((struct one_int_one_double_packed) {10, 20.0});
   return_one_int_one_long ((struct one_int_one_long) {10, 20});
 
+  return_one_complex ((complex) {(1.1,2.1)});
+  return_two_complex ((struct two_complex) {(7.89, 8.52), (6.31, 9.12)});
+  return_three_complex ((struct three_complex) {(7.89, 8.52), (6.31, 9.12), (1.1,2.1)});
+
   return_vector_size_float32_8 (( vector_size_float32_8 ){1.5, 2.25});
   return_vector_size_float32_16 (( vector_size_float32_16 ){1.5, 2.25, 4.125, 8.0625});
   return_vector_size_float32_32 (( vector_size_float32_32 ){1.5, 2.25, 4.125, 8.0625, 7.89, 8.52, 6.31, 9.12});
 
+  return_two_vectors_8_bytes ((struct two_vectors_8_bytes ){{1.5, 2.25}, {4.125, 8.0625}});
+  return_four_vectors_16_bytes ((struct four_vectors_16_bytes ){{1.5, 2.25, 4.125, 8.0625}, {7.89, 8.52, 6.31, 9.12},
+                                                                {9.80, 1.52, 7.31, 6.33}, {1.188, 4.61, 0.31, 0.12}});
+  return_four_vectors_32_bytes ((struct four_vectors_32_bytes ){{1.5, 2.25, 4.125, 8.0625, 7.89, 8.52, 6.31, 9.12},
+                                                                {9.80, 1.52, 7.31, 6.33, 1.188, 4.61, 0.31, 0.12},
+                                                                {1.1, 2.15, 0.125, 3.0625, 0.89, 4.52, 2.31, 8.12},
+                                                                {0.80, 1.52, 7.77, 2.26, 8.188, 0.61, 5.31, 77.12}});
+
   return_ext_vector_size_float32_2 ((ext_vector_size_float32_2){ 16.5, 32.25});
   return_ext_vector_size_float32_4 ((ext_vector_size_float32_4){ 16.5, 32.25, 64.125, 128.0625});
   return_ext_vector_size_float32_8 ((ext_vector_size_float32_8){ 16.5, 32.25, 64.125, 128.0625, 1.59, 3.57, 8.63, 9.12 });
Index: packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
+++ packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
@@ -151,9 +151,17 @@
         #self.return_and_test_struct_value ("return_one_int_one_double_packed")
         self.return_and_test_struct_value ("return_one_int_one_long")
 
+        self.return_and_test_struct_value ("return_one_complex")
+        self.return_and_test_struct_value ("return_two_complex")
+        self.return_and_test_struct_value ("return_three_complex")
+
         self.return_and_test_struct_value ("return_vector_size_float32_8")
         self.return_and_test_struct_value ("return_vector_size_float32_16")
         self.return_and_test_struct_value ("return_vector_size_float32_32")
+
+        self.return_and_test_struct_value ("return_two_vectors_8_bytes")
+        self.return_and_test_struct_value ("return_four_vectors_16_bytes")
+        self.return_and_test_struct_value ("return_four_vectors_32_bytes")
         # icc and gcc don't support this extension.
         if self.getCompiler().endswith('clang'):
             self.return_and_test_struct_value ("return_ext_vector_size_float32_2")
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to