From c2203a1cc33405ac008558bf46b5216675a79813 Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Tue, 7 Apr 2015 20:19:37 +0000 Subject: [PATCH] Made the struct types test case a little stricter, 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 | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lldb/test/lang/c/struct_types/main.c b/lldb/test/lang/c/struct_types/main.c index 1ea1ba9..29ac10c 100644 --- a/lldb/test/lang/c/struct_types/main.c +++ b/lldb/test/lang/c/struct_types/main.c @@ -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; } -- 2.7.4