Skip to content

Commit

Permalink
Frontend: Use translateLineCol instead of translateFileLineCol, NFC
Browse files Browse the repository at this point in the history
`ParseDirective` in VerifyDiagnosticConsumer.cpp is already calling
`translateFile`, so use the `FileID` returned by that to call
`translateLineCol` instead of using the more heavyweight
`translateFileLineCol`.

No functionality change here.
  • Loading branch information
dexonsmith committed Dec 4, 2020
1 parent d55d680 commit 1b023f5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
Expand Up @@ -555,14 +555,15 @@ static bool ParseDirective(StringRef S, ExpectedData *ED, SourceManager &SM,
}

const FileEntry *FE = &File->getFileEntry();
if (SM.translateFile(FE).isInvalid())
SM.createFileID(FE, Pos, SrcMgr::C_User);
FileID FID = SM.translateFile(FE);
if (FID.isInvalid())
FID = SM.createFileID(FE, Pos, SrcMgr::C_User);

if (PH.Next(Line) && Line > 0)
ExpectedLoc = SM.translateFileLineCol(FE, Line, 1);
ExpectedLoc = SM.translateLineCol(FID, Line, 1);
else if (PH.Next("*")) {
MatchAnyLine = true;
ExpectedLoc = SM.translateFileLineCol(FE, 1, 1);
ExpectedLoc = SM.translateLineCol(FID, 1, 1);
}
}
} else if (PH.Next("*")) {
Expand Down

0 comments on commit 1b023f5

Please sign in to comment.