Commit 82789228 authored by Duncan P. N. Exon Smith's avatar Duncan P. N. Exon Smith
Browse files

Frontend: Migrate to FileEntryRef in VerifyDiagnosticConsumer.cpp, NFC

Add a `FileEntryRef` overload of `SourceManager::translateFile`, and
migrate `ParseDirective` in VerifyDiagnosticConsumer.cpp to use it and
the corresponding overload of `createFileID`.

No functionality change here.

Differential Revision: https://reviews.llvm.org/D92699
parent e5a28e12
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1582,6 +1582,9 @@ public:
  /// If the source file is included multiple times, the FileID will be the
  /// first inclusion.
  FileID translateFile(const FileEntry *SourceFile) const;
  FileID translateFile(FileEntryRef SourceFile) const {
    return translateFile(&SourceFile.getFileEntry());
  }

  /// Get the source location in \p FID for the given line:col.
  /// Returns null location if \p FID is not a file SLocEntry.
+2 −3
Original line number Diff line number Diff line
@@ -554,10 +554,9 @@ static bool ParseDirective(StringRef S, ExpectedData *ED, SourceManager &SM,
            continue;
          }

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

          if (PH.Next(Line) && Line > 0)
            ExpectedLoc = SM.translateLineCol(FID, Line, 1);