[Lldb-commits] [lldb] fa1b602 - [lldb][NFC] Modernize TestCallUserAnonTypedef

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 1 01:07:24 PDT 2020


Author: Raphael Isemann
Date: 2020-04-01T10:06:59+02:00
New Revision: fa1b602ee6c3bd3dc245cbafe7534be5381e71e7

URL: https://github.com/llvm/llvm-project/commit/fa1b602ee6c3bd3dc245cbafe7534be5381e71e7
DIFF: https://github.com/llvm/llvm-project/commit/fa1b602ee6c3bd3dc245cbafe7534be5381e71e7.diff

LOG: [lldb][NFC] Modernize TestCallUserAnonTypedef

Added: 
    

Modified: 
    lldb/test/API/commands/expression/anonymous-struct/TestCallUserAnonTypedef.py
    lldb/test/API/commands/expression/anonymous-struct/main.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/commands/expression/anonymous-struct/TestCallUserAnonTypedef.py b/lldb/test/API/commands/expression/anonymous-struct/TestCallUserAnonTypedef.py
index b6e035752896..1a4e16610042 100644
--- a/lldb/test/API/commands/expression/anonymous-struct/TestCallUserAnonTypedef.py
+++ b/lldb/test/API/commands/expression/anonymous-struct/TestCallUserAnonTypedef.py
@@ -6,22 +6,15 @@
 Ticket: https://llvm.org/bugs/show_bug.cgi?id=26790
 """
 
-
 import lldb
 
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
-
 class TestExprLookupAnonStructTypedef(TestBase):
     mydir = TestBase.compute_mydir(__file__)
 
-    def setUp(self):
-        TestBase.setUp(self)
-        # Find the breakpoint
-        self.line = line_number('main.cpp', '// lldb testsuite break')
-
     @expectedFailureAll(
         oslist=['linux'],
         archs=['arm'],
@@ -29,16 +22,5 @@ def setUp(self):
     def test(self):
         """Test typedeffed untagged struct arguments for function call expressions"""
         self.build()
-
-        self.runCmd("file "+self.getBuildArtifact("a.out"),
-                    CURRENT_EXECUTABLE_SET)
-        lldbutil.run_break_set_by_file_and_line(
-            self,
-            "main.cpp",
-            self.line,
-            num_expected_locations=-1,
-            loc_exact=True
-        )
-
-        self.runCmd("run", RUN_SUCCEEDED)
+        lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.cpp"))
         self.expect_expr("multiply(&s)", result_type="double", result_value="1")

diff  --git a/lldb/test/API/commands/expression/anonymous-struct/main.cpp b/lldb/test/API/commands/expression/anonymous-struct/main.cpp
index 5b170c5f943a..d6366e787152 100644
--- a/lldb/test/API/commands/expression/anonymous-struct/main.cpp
+++ b/lldb/test/API/commands/expression/anonymous-struct/main.cpp
@@ -1,26 +1,17 @@
-#include <tgmath.h>
-
 typedef struct {
-    float f;
-    int i;
+  float f;
+  int i;
 } my_untagged_struct;
 
-double multiply(my_untagged_struct *s)
-{
-    return s->f * s->i;
-}
+double multiply(my_untagged_struct *s) { return s->f * s->i; }
 
-double multiply(my_untagged_struct *s, int x)
-{
-    return multiply(s) * x;
-}
+double multiply(my_untagged_struct *s, int x) { return multiply(s) * x; }
 
-int main(int argc, char **argv)
-{
-    my_untagged_struct s = {
-        .f = (float)argc,
-        .i = argc,
-    };
-    // lldb testsuite break
-    return !(multiply(&s, argc) == pow(argc, 3));
+int main(int argc, char **argv) {
+  my_untagged_struct s = {
+      .f = (float)argc,
+      .i = argc,
+  };
+  // break here
+  return multiply(&s, argc) > 0;
 }


        


More information about the lldb-commits mailing list