Skip to content

Revert "[TypeRecontruction] Remove handling of InOutTypes." #21123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions lib/IDE/TypeReconstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1913,6 +1913,18 @@ static void VisitNodeTypeAlias(
}
}

static void VisitNodeInOut(
ASTContext *ast,
Demangle::NodePointer cur_node, VisitNodeResult &result) {
VisitNodeResult type_result;
VisitNode(ast, cur_node->getFirstChild(), type_result);
if (type_result._types.size() == 1 && type_result._types[0]) {
result._types.push_back(InOutType::get(type_result._types[0]));
} else {
result._error = "couldn't resolve referent type";
}
}

static void VisitNodeExistentialMetatype(ASTContext *ast,
Demangle::NodePointer cur_node,
VisitNodeResult &result) {
Expand Down Expand Up @@ -2110,6 +2122,9 @@ static void VisitNodeTupleElement(

auto tupleType = tuple_type_result._types.front();
auto typeFlags = ParameterTypeFlags();
typeFlags = typeFlags.withInOut(tupleType->is<InOutType>());
if (auto *inOutTy = tupleType->getAs<InOutType>())
tupleType = inOutTy->getObjectType();
Identifier idName =
tuple_name.empty() ? Identifier() : ast->getIdentifier(tuple_name);
result._tuple_type_element = TupleTypeElt(tupleType, idName, typeFlags);
Expand Down Expand Up @@ -2350,6 +2365,10 @@ static void VisitNode(
VisitNodeSetterGetter(ast, node, result);
break;

case Demangle::Node::Kind::InOut:
VisitNodeInOut(ast, node, result);
break;

case Demangle::Node::Kind::ExistentialMetatype:
VisitNodeExistentialMetatype(ast, node, result);
break;
Expand Down
1 change: 1 addition & 0 deletions test/DebugInfo/Inputs/type-reconstr-names.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ $SytD ---> ()
$Ss5Int32VD ---> Int32
$S4blah4mainyyF8PatatinoL_VMa ---> Can't resolve type of $S4blah4mainyyF8PatatinoL_VMa
$Ss10CollectionP7Element ---> Can't resolve type of $Ss10CollectionP7Element
$Ss15ContiguousArrayV9formIndex5afterySiz_tFSS_Tg5 ---> (inout Int) -> ()
$S12TypeReconstr8PatatinoaySiGD ---> Patatino<Int>
$S7ElementQzD ---> τ_0_0.Element
$S13EyeCandySwift21_previousUniqueNumber33_ADC08935D64EA4F796440E7335798735LLs6UInt64Vvp ---> UInt64
Expand Down