Skip to content

Commit 4cd1c2e

Browse files
committed
[CS] NFC: Inline getSummaryFlagsForPathElement
1 parent fc020bb commit 4cd1c2e

File tree

2 files changed

+49
-51
lines changed

2 files changed

+49
-51
lines changed

lib/Sema/ConstraintLocator.cpp

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,54 @@ void ConstraintLocator::Profile(llvm::FoldingSetNodeID &id, Expr *anchor,
9494
}
9595
}
9696

97+
unsigned LocatorPathElt::getNewSummaryFlags() const {
98+
switch (getKind()) {
99+
case ConstraintLocator::ApplyArgument:
100+
case ConstraintLocator::ApplyFunction:
101+
case ConstraintLocator::ApplyArgToParam:
102+
case ConstraintLocator::SequenceElementType:
103+
case ConstraintLocator::ClosureResult:
104+
case ConstraintLocator::ConstructorMember:
105+
case ConstraintLocator::InstanceType:
106+
case ConstraintLocator::AutoclosureResult:
107+
case ConstraintLocator::OptionalPayload:
108+
case ConstraintLocator::Member:
109+
case ConstraintLocator::MemberRefBase:
110+
case ConstraintLocator::UnresolvedMember:
111+
case ConstraintLocator::ParentType:
112+
case ConstraintLocator::ExistentialSuperclassType:
113+
case ConstraintLocator::LValueConversion:
114+
case ConstraintLocator::RValueAdjustment:
115+
case ConstraintLocator::SubscriptMember:
116+
case ConstraintLocator::OpenedGeneric:
117+
case ConstraintLocator::GenericParameter:
118+
case ConstraintLocator::GenericArgument:
119+
case ConstraintLocator::NamedTupleElement:
120+
case ConstraintLocator::TupleElement:
121+
case ConstraintLocator::ProtocolRequirement:
122+
case ConstraintLocator::Witness:
123+
case ConstraintLocator::KeyPathComponent:
124+
case ConstraintLocator::ConditionalRequirement:
125+
case ConstraintLocator::TypeParameterRequirement:
126+
case ConstraintLocator::ImplicitlyUnwrappedDisjunctionChoice:
127+
case ConstraintLocator::DynamicLookupResult:
128+
case ConstraintLocator::ContextualType:
129+
case ConstraintLocator::SynthesizedArgument:
130+
case ConstraintLocator::KeyPathDynamicMember:
131+
case ConstraintLocator::KeyPathType:
132+
case ConstraintLocator::KeyPathRoot:
133+
case ConstraintLocator::KeyPathValue:
134+
case ConstraintLocator::KeyPathComponentResult:
135+
return 0;
136+
137+
case ConstraintLocator::FunctionArgument:
138+
case ConstraintLocator::FunctionResult:
139+
return IsFunctionConversion;
140+
}
141+
142+
llvm_unreachable("Unhandled PathElementKind in switch.");
143+
}
144+
97145
bool LocatorPathElt::isResultOfSingleExprFunction() const {
98146
if (auto elt = getAs<ContextualType>())
99147
return elt->isForSingleExprFunction();

lib/Sema/ConstraintLocator.h

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -124,54 +124,6 @@ class ConstraintLocator : public llvm::FoldingSetNode {
124124
IsFunctionConversion = 0x1,
125125
};
126126

127-
static unsigned getSummaryFlagsForPathElement(PathElementKind kind) {
128-
switch (kind) {
129-
case ApplyArgument:
130-
case ApplyFunction:
131-
case ApplyArgToParam:
132-
case SequenceElementType:
133-
case ClosureResult:
134-
case ConstructorMember:
135-
case InstanceType:
136-
case AutoclosureResult:
137-
case OptionalPayload:
138-
case Member:
139-
case MemberRefBase:
140-
case UnresolvedMember:
141-
case ParentType:
142-
case ExistentialSuperclassType:
143-
case LValueConversion:
144-
case RValueAdjustment:
145-
case SubscriptMember:
146-
case OpenedGeneric:
147-
case GenericParameter:
148-
case GenericArgument:
149-
case NamedTupleElement:
150-
case TupleElement:
151-
case ProtocolRequirement:
152-
case Witness:
153-
case KeyPathComponent:
154-
case ConditionalRequirement:
155-
case TypeParameterRequirement:
156-
case ImplicitlyUnwrappedDisjunctionChoice:
157-
case DynamicLookupResult:
158-
case ContextualType:
159-
case SynthesizedArgument:
160-
case KeyPathDynamicMember:
161-
case KeyPathType:
162-
case KeyPathRoot:
163-
case KeyPathValue:
164-
case KeyPathComponentResult:
165-
return 0;
166-
167-
case FunctionArgument:
168-
case FunctionResult:
169-
return IsFunctionConversion;
170-
}
171-
172-
llvm_unreachable("Unhandled PathElementKind in switch.");
173-
}
174-
175127
/// One element in the path of a locator, which can include both
176128
/// a kind (PathElementKind) and a value used to describe specific
177129
/// kinds further (e.g., the position of a tuple element).
@@ -329,9 +281,7 @@ class ConstraintLocator : public llvm::FoldingSetNode {
329281
bool is() const { return isa<T>(this); }
330282

331283
/// Return the summary flags for this particular element.
332-
unsigned getNewSummaryFlags() const {
333-
return getSummaryFlagsForPathElement(getKind());
334-
}
284+
unsigned getNewSummaryFlags() const;
335285

336286
bool isConditionalRequirement() const {
337287
return getKind() == PathElementKind::ConditionalRequirement;

0 commit comments

Comments
 (0)