Skip to content

Commit 672f82a

Browse files
committed
[lldb][test] TestExprDefinitionInDylib.py: add cases for calling ctors
1 parent fde9ee1 commit 672f82a

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

lldb/test/API/lang/cpp/expr-definition-in-dylib/TestExprDefinitionInDylib.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,10 @@ def test(self):
3131
)
3232

3333
self.expect_expr("f.method()", result_value="-72", result_type="int")
34+
self.expect_expr("Foo()", result_type="Foo")
35+
36+
# FIXME: mangled name lookup for ABI-tagged ctors fails because
37+
# the debug-info AST doesn't have ABI-tag information.
38+
self.expect(
39+
"expr Bar()", error=True, substrs=["error: Couldn't look up symbols"]
40+
)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
#include "lib.h"
22

3+
#include <cstdio>
4+
35
int Foo::method() { return -72; }
6+
7+
Foo::Foo() { std::puts(__func__); }
8+
9+
Foo::~Foo() { std::puts(__func__); }
10+
11+
Bar::Bar() { std::puts(__func__); }
12+
13+
Bar::~Bar() { std::puts(__func__); }

lldb/test/API/lang/cpp/expr-definition-in-dylib/lib.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33

44
struct Foo {
55
int method();
6+
Foo();
7+
~Foo();
8+
};
9+
10+
struct Bar {
11+
[[gnu::abi_tag("Ctor")]] Bar();
12+
[[gnu::abi_tag("Dtor")]] ~Bar();
613
};
714

815
#endif // LIB_H_IN

lldb/test/API/lang/cpp/expr-definition-in-dylib/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22

33
int main() {
44
Foo f;
5+
Bar b;
56
return f.method();
67
}

0 commit comments

Comments
 (0)