Skip to content

Commit 62701b4

Browse files
authored
Merge pull request #6633 from rintaro/repair-main-after-merge-2
Repair main after merge take 2
2 parents 6f94d99 + 12414ad commit 62701b4

File tree

5 files changed

+85
-1
lines changed

5 files changed

+85
-1
lines changed

lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2908,7 +2908,7 @@ swift::ASTContext *SwiftASTContext::GetASTContext() {
29082908
GetLanguageOptions(), GetTypeCheckerOptions(), GetSILOptions(),
29092909
GetSearchPathOptions(), GetClangImporterOptions(),
29102910
GetSymbolGraphOptions(), GetSourceManager(), GetDiagnosticEngine(),
2911-
ReportModuleLoadingProgress));
2911+
/*OutputBackend=*/nullptr, ReportModuleLoadingProgress));
29122912
m_diagnostic_consumer_ap.reset(new StoringDiagnosticConsumer(*this));
29132913

29142914
if (getenv("LLDB_SWIFT_DUMP_DIAGS")) {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
SWIFT_CXX_HEADER := swift-types.h
2+
SWIFT_SOURCES := swift-types.swift
3+
CXX_SOURCES := main.cpp
4+
SWIFT_CXX_INTEROP := 1
5+
SWIFTFLAGS_EXTRAS = -Xcc -I$(SRCDIR) -parse-as-library
6+
CFLAGS = -I. -g
7+
include Makefile.rules
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
"""
3+
Test that evaluating expressions works on backward interop mode.
4+
"""
5+
from lldbsuite.test.lldbtest import *
6+
from lldbsuite.test.decorators import *
7+
8+
9+
class TestSwiftBackwardInteropExpressions(TestBase):
10+
11+
@skipIfLinux
12+
@swiftTest
13+
def test_func_step_in(self):
14+
self.build()
15+
self.runCmd('setting set target.experimental.swift-enable-cxx-interop true')
16+
_, _, _, _ = lldbutil.run_to_source_breakpoint(
17+
self, 'Break here', lldb.SBFileSpec('main.cpp'))
18+
self.expect('expr swiftFunc()', substrs=["Inside a Swift function"])
19+
self.expect('expr swiftClass.swiftMethod()', substrs=["Inside a Swift method"])
20+
self.expect('expr a::SwiftClass::swiftStaticMethod()', substrs=["In a Swift static method"])
21+
self.expect('expr swiftClass.getSwiftProperty()', substrs=["This is a class with properties"])
22+
self.expect('expr swiftSubclassAsClass.overrideableMethod()', substrs=["In subclass"])
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include "swift-types.h"
2+
3+
using namespace a;
4+
5+
int main() {
6+
swiftFunc();
7+
auto swiftClass = SwiftClass::init();
8+
swiftClass.swiftMethod();
9+
SwiftClass::swiftStaticMethod();
10+
swiftClass.getSwiftProperty();
11+
auto swiftSubclass = SwiftSubclass::init();
12+
SwiftClass swiftSubclassAsClass = swiftSubclass;
13+
swiftSubclassAsClass.overrideableMethod();
14+
return 0; // Break here
15+
}
16+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
public func swiftFunc() -> String{
3+
return "Inside a Swift function!"
4+
}
5+
6+
public class SwiftClass {
7+
var field: Int
8+
var arr: [String]
9+
public init() {
10+
field = 42
11+
arr = ["An", "array", "of", "strings"]
12+
}
13+
14+
public func swiftMethod() -> String {
15+
return "Inside a Swift method!"
16+
}
17+
18+
private var _desc = "This is a class with properties!"
19+
public var swiftProperty: String {
20+
get {
21+
return _desc
22+
}
23+
}
24+
25+
public static func swiftStaticMethod() -> String {
26+
return "In a Swift static method!"
27+
}
28+
29+
public func overrideableMethod() -> String {
30+
return "In the base class!"
31+
}
32+
}
33+
34+
public class SwiftSubclass: SwiftClass {
35+
public override func overrideableMethod() -> String {
36+
return "In subclass!"
37+
}
38+
}
39+

0 commit comments

Comments
 (0)