Skip to content

Commit e43310a

Browse files
committed
fixup! add test for when definition is in different Module than declaration
1 parent 6973ac2 commit e43310a

File tree

5 files changed

+44
-0
lines changed

5 files changed

+44
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CXX_SOURCES := main.cpp
2+
3+
DYLIB_CXX_SOURCES := lib.cpp
4+
DYLIB_NAME := lib
5+
6+
include Makefile.rules
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import lldb
2+
from lldbsuite.test.decorators import *
3+
from lldbsuite.test.lldbtest import *
4+
from lldbsuite.test import lldbutil
5+
6+
7+
class ExprDefinitionInDylibTestCase(TestBase):
8+
def test(self):
9+
"""
10+
Tests that we can call functions whose definition
11+
is in a different LLDB module than it's declaration.
12+
"""
13+
self.build()
14+
15+
lldbutil.run_to_source_breakpoint(
16+
self, "return", lldb.SBFileSpec("main.cpp")
17+
)
18+
19+
self.expect_expr("f.method()", result_value="-72", result_type="int")
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include "lib.h"
2+
3+
int Foo::method() {
4+
return -72;
5+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#ifndef LIB_H_IN
2+
#define LIB_H_IN
3+
4+
struct Foo {
5+
int method();
6+
};
7+
8+
#endif // LIB_H_IN
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include "lib.h"
2+
3+
int main() {
4+
Foo f;
5+
return f.method();
6+
}

0 commit comments

Comments
 (0)