Made the struct types test case a little stricter,
authorSean Callanan <scallanan@apple.com>
Tue, 7 Apr 2015 20:19:37 +0000 (20:19 +0000)
committerSean Callanan <scallanan@apple.com>
Tue, 7 Apr 2015 20:19:37 +0000 (20:19 +0000)
by verifying that we can pass a struct-typed variable
to a function that takes structs.

llvm-svn: 234348

lldb/test/lang/c/struct_types/main.c

index 1ea1ba9858b34816494b541979885e3733bfdd21..29ac10cb94a8594b838a260fccf44b9211ce38be 100644 (file)
@@ -6,6 +6,18 @@
 // License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+
+struct things_to_sum {
+    int a;
+    int b;
+    int c;
+};
+
+int sum_things(struct things_to_sum tts)
+{
+    return tts.a + tts.b + tts.c;
+}
+
 int main (int argc, char const *argv[])
 {
     struct point_tag {
@@ -23,5 +35,9 @@ int main (int argc, char const *argv[])
     };
     struct point_tag pt = { 2, 3, {} };
     struct rect_tag rect = {{1, 2, {}}, {3, 4, {}}};
-    return 0; //% self.expect("expression -- &pt == (struct point_tag*)0", substrs = ['false'])
+    struct things_to_sum tts = { 2, 3, 4 };
+
+    int sum = sum_things(tts); //% self.expect("expression -- &pt == (struct point_tag*)0", substrs = ['false'])
+                               //% self.expect("expression -- sum_things(tts)", substrs = ['9'])
+    return 0; 
 }