Skip to content

Commit e2a1a71

Browse files
committed
[lldb] Add move_iterator to supported template list
Identical to previous commits that just add a standard library template to the supported template list and test it. Adding this rather obscure class to the template list is mostly caused by the std::deque test unexpectedly referencing this type when testing against newer libc++ versions on macOS. Fixes TestQueueFromStdModule and TestQueueFromStdModule on macOS. Fixes rdar://73213589
1 parent ef0dcb5 commit e2a1a71

File tree

4 files changed

+51
-0
lines changed

4 files changed

+51
-0
lines changed

lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ CxxModuleHandler::CxxModuleHandler(ASTImporter &importer, ASTContext *target)
3333
"shared_ptr",
3434
"unique_ptr",
3535
"weak_ptr",
36+
// iterator
37+
"move_iterator",
38+
"__wrap_iter",
3639
// utility
3740
"allocator",
3841
"pair",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
USE_LIBCPP := 1
2+
CXX_SOURCES := main.cpp
3+
CXXFLAGS_EXTRAS := -std=c++11
4+
include Makefile.rules
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""
2+
Tests standard library iterators.
3+
"""
4+
5+
from lldbsuite.test.decorators import *
6+
from lldbsuite.test.lldbtest import *
7+
from lldbsuite.test import lldbutil
8+
9+
10+
class TestCase(TestBase):
11+
12+
mydir = TestBase.compute_mydir(__file__)
13+
14+
@add_test_categories(["libc++"])
15+
@skipIf(compiler=no_match("clang"))
16+
def test(self):
17+
self.build()
18+
19+
lldbutil.run_to_source_breakpoint(self,
20+
"// Set break point at this line.",
21+
lldb.SBFileSpec("main.cpp"))
22+
23+
self.runCmd("settings set target.import-std-module true")
24+
25+
iter_type = "std::move_iterator<std::__wrap_iter<int *> >"
26+
27+
self.expect_expr("move_begin", result_type=iter_type)
28+
self.expect_expr("move_begin[0]", result_type="int", result_value="1")
29+
30+
self.expect_expr("move_begin + 3 == move_end", result_value="true")
31+
32+
self.expect("expr move_begin++")
33+
self.expect_expr("move_begin + 2 == move_end", result_value="true")
34+
self.expect("expr move_begin--")
35+
self.expect_expr("move_begin + 3 == move_end", result_value="true")
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <iterator>
2+
#include <vector>
3+
4+
int main() {
5+
std::vector<int> v{1, 2, 3};
6+
auto move_begin = std::make_move_iterator(v.begin());
7+
auto move_end = std::make_move_iterator(v.end());
8+
return 0; // Set break point at this line.
9+
}

0 commit comments

Comments
 (0)