This revision was automatically updated to reflect the committed changes.
Closed by commit rL359779: Add std::stack and std::queue support to 
CxxModuleHandler (authored by teemperor, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D61305?vs=197300&id=197744#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61305/new/

https://reviews.llvm.org/D61305

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/queue/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/queue/TestQueue.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/queue/main.cpp
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/stack/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/stack/TestStack.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/stack/main.cpp
  lldb/trunk/source/Symbol/CxxModuleHandler.cpp

Index: lldb/trunk/source/Symbol/CxxModuleHandler.cpp
===================================================================
--- lldb/trunk/source/Symbol/CxxModuleHandler.cpp
+++ lldb/trunk/source/Symbol/CxxModuleHandler.cpp
@@ -24,6 +24,8 @@
       "deque",
       "forward_list",
       "list",
+      "queue",
+      "stack",
       "vector",
       // pointers
       "shared_ptr",
Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/queue/TestQueue.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/queue/TestQueue.py
+++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/queue/TestQueue.py
@@ -0,0 +1,47 @@
+"""
+Tests std::queue functionality.
+"""
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestQueue(TestBase):
+
+    mydir = TestBase.compute_mydir(__file__)
+
+    # FIXME: This should work on more setups, so remove these
+    # skipIf's in the future.
+    @add_test_categories(["libc++"])
+    @skipIf(compiler=no_match("clang"))
+    @skipIf(oslist=no_match(["linux"]))
+    @skipIf(debug_info=no_match(["dwarf"]))
+    def test(self):
+        self.build()
+
+        lldbutil.run_to_source_breakpoint(self,
+            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+
+        self.runCmd("settings set target.import-std-module true")
+
+        # Test std::queue functionality with a std::deque.
+        self.expect("expr q_deque.pop()")
+        self.expect("expr q_deque.push({4})")
+        self.expect("expr (size_t)q_deque.size()", substrs=['(size_t) $0 = 1'])
+        self.expect("expr (int)q_deque.front().i", substrs=['(int) $1 = 4'])
+        self.expect("expr (int)q_deque.back().i", substrs=['(int) $2 = 4'])
+        self.expect("expr q_deque.empty()", substrs=['(bool) $3 = false'])
+        self.expect("expr q_deque.pop()")
+        self.expect("expr q_deque.emplace(5)")
+        self.expect("expr (int)q_deque.front().i", substrs=['(int) $4 = 5'])
+
+        # Test std::queue functionality with a std::list.
+        self.expect("expr q_list.pop()")
+        self.expect("expr q_list.push({4})")
+        self.expect("expr (size_t)q_list.size()", substrs=['(size_t) $5 = 1'])
+        self.expect("expr (int)q_list.front().i", substrs=['(int) $6 = 4'])
+        self.expect("expr (int)q_list.back().i", substrs=['(int) $7 = 4'])
+        self.expect("expr q_list.empty()", substrs=['(bool) $8 = false'])
+        self.expect("expr q_list.pop()")
+        self.expect("expr q_list.emplace(5)")
+        self.expect("expr (int)q_list.front().i", substrs=['(int) $9 = 5'])
Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/queue/main.cpp
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/queue/main.cpp
+++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/queue/main.cpp
@@ -0,0 +1,16 @@
+#include <deque>
+#include <list>
+#include <queue>
+
+struct C {
+  // Constructor for testing emplace.
+  C(int i) : i(i) {};
+  int i;
+};
+
+int main(int argc, char **argv) {
+  // std::deque is the default container.
+  std::queue<C> q_deque({{1}});
+  std::queue<C, std::list<C>> q_list({{1}});
+  return 0; // Set break point at this line.
+}
Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/queue/Makefile
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/queue/Makefile
+++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/queue/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+USE_LIBCPP := 1
+CXXFLAGS += $(MANDATORY_CXXMODULE_BUILD_CFLAGS)
+CXX_SOURCES := main.cpp
+include $(LEVEL)/Makefile.rules
Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/stack/Makefile
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/stack/Makefile
+++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/stack/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+USE_LIBCPP := 1
+CXXFLAGS += $(MANDATORY_CXXMODULE_BUILD_CFLAGS)
+CXX_SOURCES := main.cpp
+include $(LEVEL)/Makefile.rules
Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/stack/TestStack.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/stack/TestStack.py
+++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/stack/TestStack.py
@@ -0,0 +1,49 @@
+"""
+Tests std::stack functionality.
+"""
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestStack(TestBase):
+
+    mydir = TestBase.compute_mydir(__file__)
+
+    # FIXME: This should work on more setups, so remove these
+    # skipIf's in the future.
+    @add_test_categories(["libc++"])
+    @skipIf(compiler=no_match("clang"))
+    @skipIf(oslist=no_match(["linux"]))
+    @skipIf(debug_info=no_match(["dwarf"]))
+    def test(self):
+        self.build()
+
+        lldbutil.run_to_source_breakpoint(self,
+            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+
+        self.runCmd("settings set target.import-std-module true")
+
+        # Test std::stack functionality with a std::deque.
+        self.expect("expr s_deque.pop()")
+        self.expect("expr s_deque.push({4})")
+        self.expect("expr (size_t)s_deque.size()", substrs=['(size_t) $0 = 3'])
+        self.expect("expr (int)s_deque.top().i", substrs=['(int) $1 = 4'])
+        self.expect("expr s_deque.emplace(5)")
+        self.expect("expr (int)s_deque.top().i", substrs=['(int) $2 = 5'])
+
+        # Test std::stack functionality with a std::vector.
+        self.expect("expr s_vector.pop()")
+        self.expect("expr s_vector.push({4})")
+        self.expect("expr (size_t)s_vector.size()", substrs=['(size_t) $3 = 3'])
+        self.expect("expr (int)s_vector.top().i", substrs=['(int) $4 = 4'])
+        self.expect("expr s_vector.emplace(5)")
+        self.expect("expr (int)s_vector.top().i", substrs=['(int) $5 = 5'])
+
+        # Test std::stack functionality with a std::list.
+        self.expect("expr s_list.pop()")
+        self.expect("expr s_list.push({4})")
+        self.expect("expr (size_t)s_list.size()", substrs=['(size_t) $6 = 3'])
+        self.expect("expr (int)s_list.top().i", substrs=['(int) $7 = 4'])
+        self.expect("expr s_list.emplace(5)")
+        self.expect("expr (int)s_list.top().i", substrs=['(int) $8 = 5'])
Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/stack/main.cpp
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/stack/main.cpp
+++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/stack/main.cpp
@@ -0,0 +1,17 @@
+#include <list>
+#include <stack>
+#include <vector>
+
+struct C {
+  // Constructor for testing emplace.
+  C(int i) : i(i) {};
+  int i;
+};
+
+int main(int argc, char **argv) {
+  // std::deque is the default container.
+  std::stack<C> s_deque({{1}, {2}, {3}});
+  std::stack<C, std::vector<C>> s_vector({{1}, {2}, {3}});
+  std::stack<C, std::list<C>> s_list({{1}, {2}, {3}});
+  return 0; // Set break point at this line.
+}
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to