Skip to content

Commit 2add546

Browse files
Merge pull request swiftlang#2014 from adrian-prantl/binding-main
Bind generic types in the expression evaluator if dybamic types are requested
2 parents ed01c1a + ee9caf1 commit 2add546

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed

lldb/source/Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ static void AddRequiredAliases(Block *block, lldb::StackFrameSP &stack_frame_sp,
581581
static llvm::Optional<llvm::Error> AddVariableInfo(
582582
lldb::VariableSP variable_sp, lldb::StackFrameSP &stack_frame_sp,
583583
SwiftASTContextForExpressions &ast_context,
584-
SwiftLanguageRuntime *language_runtime,
584+
SwiftLanguageRuntime *runtime,
585585
llvm::SmallDenseSet<const char *, 8> &processed_variables,
586586
llvm::SmallVectorImpl<SwiftASTManipulator::VariableInfo> &local_variables,
587587
lldb::DynamicValueType use_dynamic) {
@@ -615,6 +615,11 @@ static llvm::Optional<llvm::Error> AddVariableInfo(
615615
return {};
616616
}
617617
var_type = valobj_sp->GetCompilerType();
618+
if (use_dynamic > lldb::eNoDynamicValues) {
619+
if (auto *stack_frame = stack_frame_sp.get())
620+
var_type =
621+
runtime->BindGenericTypeParameters(*stack_frame, var_type);
622+
}
618623
}
619624

620625
if (!var_type.IsValid())

lldb/test/API/lang/swift/clangimporter/headermap_conflict/TestSwiftHeadermapConflict.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class TestSwiftHeadermapConflict(TestBase):
2525
def setUp(self):
2626
TestBase.setUp(self)
2727

28-
@skipIf #FIXME: This regressed silently due to 2c911bceb06ed376801251bdfd992905a66f276c
2928
@skipIf(bugnumber="rdar://60396797",
3029
setting=('symbols.use-swift-clangimporter', 'false'))
3130
@skipUnlessDarwin

lldb/test/API/lang/swift/expression/static/TestSwiftExpressionsInClassFunctions.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,32 +28,27 @@ def setUp(self):
2828
TestBase.setUp(self)
2929

3030
def check_expression(self, expression, expected_result, use_summary=True):
31-
value = self.frame().EvaluateExpression(expression)
31+
opts = lldb.SBExpressionOptions()
32+
opts.SetFetchDynamicValue(lldb.eDynamicCanRunTarget)
33+
value = self.frame().EvaluateExpression(expression, opts)
3234
self.assertTrue(value.IsValid(), expression + "returned a valid value")
3335
if use_summary:
3436
answer = value.GetSummary()
3537
else:
3638
answer = value.GetValue()
37-
report_str = "%s expected: %s got: %s" % (
38-
expression, expected_result, answer)
39-
self.assertTrue(answer == expected_result, report_str)
39+
report_str = value.GetError()
40+
self.assertEquals(answer, expected_result, report_str)
4041

4142

42-
@expectedFailureAll #FIXME: This regressed silently due to 2c911bceb06ed376801251bdfd992905a66f276c
4343
@swiftTest
4444
def test_expressions_in_class_functions(self):
4545
"""Test expressions in class func contexts"""
4646
self.build()
47-
exe_name = "a.out"
48-
exe = self.getBuildArtifact(exe_name)
49-
50-
# Create the target
51-
target = self.dbg.CreateTarget(exe)
47+
target = self.dbg.CreateTarget(self.getBuildArtifact())
5248
self.assertTrue(target, VALID_TARGET)
5349

54-
breakpoints = [None]
55-
5650
# Set the breakpoints
51+
breakpoints = [None]
5752
for i in range(1, 8):
5853
breakpoints.append(
5954
target.BreakpointCreateBySourceRegex(
@@ -64,7 +59,6 @@ def test_expressions_in_class_functions(self):
6459

6560
# Launch the process, and do not stop at the entry point.
6661
process = target.LaunchSimple(None, None, os.getcwd())
67-
6862
self.assertTrue(process, PROCESS_IS_VALID)
6963

7064
# Check each context

lldb/unittests/Symbol/TestSwiftASTContext.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ TEST_F(TestSwiftASTContext, ResourceDir) {
145145
llvm::sys::path::append(tc_rdir, "/Xcode.app/Contents/Developer/Toolchains/"
146146
"XcodeDefault.xctoolchain/usr/lib/swift");
147147

148-
llvm::StringRef rdir;
149148
auto GetResourceDir = [&](const char *triple_string,
150149
llvm::StringRef sdk_path) {
151150
llvm::Triple host("x86_64-apple-macosx10.14");
@@ -157,7 +156,7 @@ TEST_F(TestSwiftASTContext, ResourceDir) {
157156
std::string(toolchain), std::string(cl_tools));
158157
};
159158

160-
EXPECT_EQ(GetResourceDir({"x86_64-apple-macosx10.14"}, macosx_sdk),
159+
EXPECT_EQ(GetResourceDir("x86_64-apple-macosx10.14", macosx_sdk),
161160
tc_rdir.str());
162161
EXPECT_EQ(GetResourceDir("x86_64-apple-darwin", macosx_sdk), tc_rdir);
163162
EXPECT_EQ(GetResourceDir("aarch64-apple-ios11.3", ios_sdk), tc_rdir);

0 commit comments

Comments
 (0)