@@ -169,37 +169,12 @@ TypeRefinementContext::createForWhileStmtBody(ASTContext &Ctx, WhileStmt *S,
169169 Ctx, S, Parent, S->getBody ()->getSourceRange (), Info, /* ExplicitInfo */ Info);
170170}
171171
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-
196172TypeRefinementContext *
197173TypeRefinementContext::findMostRefinedSubContext (SourceLoc Loc,
198174 ASTContext &Ctx) {
199175 assert (Loc.isValid ());
200176
201- if (SrcRange.isValid () &&
202- !rangeContainsTokenLocWithGeneratedSource (Ctx.SourceMgr , SrcRange, Loc))
177+ if (SrcRange.isValid () && !Ctx.SourceMgr .containsTokenLoc (SrcRange, Loc))
203178 return nullptr ;
204179
205180 auto expandedChildren = evaluateOrDefault (
0 commit comments