@@ -169,37 +169,12 @@ TypeRefinementContext::createForWhileStmtBody(ASTContext &Ctx, WhileStmt *S,
169
169
Ctx, S, Parent, S->getBody ()->getSourceRange (), Info, /* ExplicitInfo */ Info);
170
170
}
171
171
172
- // / Determine whether the child location is somewhere within the parent
173
- // / range.
174
- static bool rangeContainsTokenLocWithGeneratedSource (
175
- SourceManager &sourceMgr, SourceRange parentRange, SourceLoc childLoc) {
176
- if (sourceMgr.rangeContainsTokenLoc (parentRange, childLoc))
177
- return true ;
178
-
179
- auto childBuffer = sourceMgr.findBufferContainingLoc (childLoc);
180
- while (!sourceMgr.rangeContainsTokenLoc (
181
- sourceMgr.getRangeForBuffer (childBuffer), parentRange.Start )) {
182
- auto *info = sourceMgr.getGeneratedSourceInfo (childBuffer);
183
- if (!info)
184
- return false ;
185
-
186
- childLoc = info->originalSourceRange .getStart ();
187
- if (childLoc.isInvalid ())
188
- return false ;
189
-
190
- childBuffer = sourceMgr.findBufferContainingLoc (childLoc);
191
- }
192
-
193
- return sourceMgr.rangeContainsTokenLoc (parentRange, childLoc);
194
- }
195
-
196
172
TypeRefinementContext *
197
173
TypeRefinementContext::findMostRefinedSubContext (SourceLoc Loc,
198
174
ASTContext &Ctx) {
199
175
assert (Loc.isValid ());
200
176
201
- if (SrcRange.isValid () &&
202
- !rangeContainsTokenLocWithGeneratedSource (Ctx.SourceMgr , SrcRange, Loc))
177
+ if (SrcRange.isValid () && !Ctx.SourceMgr .containsTokenLoc (SrcRange, Loc))
203
178
return nullptr ;
204
179
205
180
auto expandedChildren = evaluateOrDefault (
0 commit comments