Skip to content

Commit 86995d9

Browse files
Axel-Naumanndevajithvs
authored andcommitted
Do not load the source file just to get an irrelevant SourceLoc (ROOT-7111).
1 parent b45cfd9 commit 86995d9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

clang/lib/Lex/Lexer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,10 @@ SourceLocation Lexer::getLocForEndOfToken(SourceLocation Loc, unsigned Offset,
813813
return {}; // Points inside the macro expansion.
814814
}
815815

816+
// Don't hit the file system for ASTReader tokens.
817+
if (SM.isLoadedSourceLocation(Loc))
818+
return Loc;
819+
816820
unsigned Len = Lexer::MeasureTokenLength(Loc, SM, LangOpts);
817821
if (Len > Offset)
818822
Len = Len - Offset;

0 commit comments

Comments
 (0)