@@ -2212,19 +2212,28 @@ getRangeInRange(SourceRange Range, SourceLocation SearchRangeBegin,
22122212 // and the loc is another macro expand,
22132213 // recursively search for a more precise range.
22142214 do {
2215- auto IterSecondBeginFileEntry =
2216- dpct::DpctGlobalInfo::getFileManager ().getFile (
2215+ auto IterSecondBeginFileEntryRef =
2216+ dpct::DpctGlobalInfo::getFileManager ().getFileRef (
22172217 It->second .first .first .getCanonicalPath ());
2218- auto IterSecondEndFileEntry =
2219- dpct::DpctGlobalInfo::getFileManager ().getFile (
2218+ if (!IterSecondBeginFileEntryRef) {
2219+ llvm::consumeError (
2220+ std::move (IterSecondBeginFileEntryRef.takeError ()));
2221+ break ;
2222+ }
2223+
2224+ auto IterSecondEndFileEntryRef =
2225+ dpct::DpctGlobalInfo::getFileManager ().getFileRef (
22202226 It->second .second .first .getCanonicalPath ());
2221- if (!IterSecondBeginFileEntry || !IterSecondEndFileEntry)
2227+ if (!IterSecondEndFileEntryRef) {
2228+ llvm::consumeError (
2229+ std::move (IterSecondEndFileEntryRef.takeError ()));
22222230 break ;
2231+ }
22232232
22242233 auto IterSecondBeginFileID =
2225- SM.translateFile (IterSecondBeginFileEntry. get () );
2234+ SM.translateFile (*IterSecondBeginFileEntryRef );
22262235 auto IterSecondEndFileID =
2227- SM.translateFile (IterSecondEndFileEntry. get () );
2236+ SM.translateFile (*IterSecondEndFileEntryRef );
22282237 auto IterSecondBegin =
22292238 SM.getComposedLoc (IterSecondBeginFileID, It->second .first .second );
22302239 auto IterSecondEnd =
0 commit comments