Skip to content

Commit 6e627b5

Browse files
author
Davide Italiano
committed
[TypeReconstruction] Don't choke on slightly invalid mangled names.
This was taken from a real project, but I don't have it anymore and I can't reproduce it on newer versions of swift (probably something changed in the DWARF type mangling). In any case, as this can be triggered by user input, we shouldn't assert, and error out instead. <rdar://problem/39283717>
1 parent 0b33a69 commit 6e627b5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/IDE/TypeReconstruction.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2269,7 +2269,9 @@ static void VisitNodeGlobal(ASTContext *ast, Demangle::NodePointer cur_node,
22692269
static void VisitNode(
22702270
ASTContext *ast,
22712271
Demangle::NodePointer node, VisitNodeResult &result) {
2272-
assert(result._error.empty());
2272+
// If we have an error, no point in going forward.
2273+
if (!result._error.empty())
2274+
return;
22732275

22742276
const Demangle::Node::Kind nodeKind = node->getKind();
22752277

test/DebugInfo/Inputs/type-reconstr-names.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ $S12TypeReconstr8PatatinoaySiGD ---> Patatino<Int>
88
$S7ElementQzD ---> τ_0_0.Element
99
$S13EyeCandySwift21_previousUniqueNumber33_ADC08935D64EA4F796440E7335798735LLs6UInt64Vvp ---> UInt64
1010
$SSayypXpG ---> Array<Any.Type>
11+
$S12EyeCandyCore11XPCListenerC14messageHandleryyAA13XPCConnectionV_AA10XPCMessageVxtcvpfiyAF_AHxtcfU_TA.4 ---> Can't resolve type of $S12EyeCandyCore11XPCListenerC14messageHandleryyAA13XPCConnectionV_AA10XPCMessageVxtcvpfiyAF_AHxtcfU_TA.4

0 commit comments

Comments
 (0)