[llvm-branch-commits] [clang] 1b023f5 - Frontend: Use translateLineCol instead of translateFileLineCol, NFC

Duncan P. N. Exon Smith via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Dec 4 14:43:22 PST 2020


Author: Duncan P. N. Exon Smith
Date: 2020-12-04T14:37:48-08:00
New Revision: 1b023f54b61737552242868bdfc385487f1c3e74

URL: https://github.com/llvm/llvm-project/commit/1b023f54b61737552242868bdfc385487f1c3e74
DIFF: https://github.com/llvm/llvm-project/commit/1b023f54b61737552242868bdfc385487f1c3e74.diff

LOG: Frontend: Use translateLineCol instead of translateFileLineCol, NFC

`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.

Added: 
    

Modified: 
    clang/lib/Frontend/VerifyDiagnosticConsumer.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp b/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
index 35f95ecfec68..a10a3dd8a446 100644
--- a/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
+++ b/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
@@ -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("*")) {


        


More information about the llvm-branch-commits mailing list