Frontend: Use translateLineCol instead of translateFileLineCol, NFC
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 4 Dec 2020 22:34:22 +0000 (14:34 -0800)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 4 Dec 2020 22:37:48 +0000 (14:37 -0800)
`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.

clang/lib/Frontend/VerifyDiagnosticConsumer.cpp

index 35f95ec..a10a3dd 100644 (file)
@@ -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("*")) {