[PATCH] D29755: Cache FileID when translating diagnostics in PCH files

Erik Verbruggen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 16 02:01:14 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL295301: Cache FileID when translating diagnostics in PCH files (authored by erikjv).

Changed prior to commit:
  https://reviews.llvm.org/D29755?vs=88366&id=88701#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29755

Files:
  cfe/trunk/lib/Frontend/ASTUnit.cpp


Index: cfe/trunk/lib/Frontend/ASTUnit.cpp
===================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp
@@ -2541,14 +2541,19 @@
 
   SmallVector<StoredDiagnostic, 4> Result;
   Result.reserve(Diags.size());
+  const FileEntry *PreviousFE = nullptr;
+  FileID FID;
   for (const StandaloneDiagnostic &SD : Diags) {
     // Rebuild the StoredDiagnostic.
     if (SD.Filename.empty())
       continue;
     const FileEntry *FE = FileMgr.getFile(SD.Filename);
     if (!FE)
       continue;
-    FileID FID = SrcMgr.translateFile(FE);
+    if (FE != PreviousFE) {
+      FID = SrcMgr.translateFile(FE);
+      PreviousFE = FE;
+    }
     SourceLocation FileLoc = SrcMgr.getLocForStartOfFile(FID);
     if (FileLoc.isInvalid())
       continue;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29755.88701.patch
Type: text/x-patch
Size: 825 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170216/7fcd582f/attachment-0001.bin>


More information about the cfe-commits mailing list