[clang] bb6c036 - [clang][Diagnostics][NFC] Use getFileID() directly

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Wed May 31 01:00:00 PDT 2023


Author: Timm Bäder
Date: 2023-05-31T09:57:16+02:00
New Revision: bb6c036ef378de321d5b7fc0ada317f91c88570d

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

LOG: [clang][Diagnostics][NFC] Use getFileID() directly

Instead of calling getDecomposedLoc() and then only using the FileID.

Added: 
    

Modified: 
    clang/lib/Frontend/TextDiagnostic.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/TextDiagnostic.cpp b/clang/lib/Frontend/TextDiagnostic.cpp
index 83f254f7de83..a03c1856eaeb 100644
--- a/clang/lib/Frontend/TextDiagnostic.cpp
+++ b/clang/lib/Frontend/TextDiagnostic.cpp
@@ -1144,9 +1144,7 @@ void TextDiagnostic::emitSnippetAndCaret(
       (LastLevel != DiagnosticsEngine::Note || Level == LastLevel))
     return;
 
-  // Decompose the location into a FID/Offset pair.
-  std::pair<FileID, unsigned> LocInfo = Loc.getDecomposedLoc();
-  FileID FID = LocInfo.first;
+  FileID FID = Loc.getFileID();
   const SourceManager &SM = Loc.getManager();
 
   // Get information about the buffer it points into.


        


More information about the cfe-commits mailing list