[PATCH] D92680: Frontend: Migrate to FileEntryRef in CompilerInstance::InitializeSourceManager, NFC

2020-12-09 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa5c89bb02195: Frontend: Migrate to FileEntryRef in 
CompilerInstance::InitializeSourceManager… (authored by dexonsmith).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92680/new/

https://reviews.llvm.org/D92680

Files:
  clang/include/clang/Basic/SourceManager.h
  clang/lib/Frontend/CompilerInstance.cpp


Index: clang/lib/Frontend/CompilerInstance.cpp
===
--- clang/lib/Frontend/CompilerInstance.cpp
+++ clang/lib/Frontend/CompilerInstance.cpp
@@ -891,8 +891,8 @@
 }
 std::unique_ptr SB = std::move(SBOrErr.get());
 
-const FileEntry *File = FileMgr.getVirtualFile(SB->getBufferIdentifier(),
-   SB->getBufferSize(), 0);
+FileEntryRef File = FileMgr.getVirtualFileRef(SB->getBufferIdentifier(),
+  SB->getBufferSize(), 0);
 SourceMgr.setMainFileID(
 SourceMgr.createFileID(File, SourceLocation(), Kind));
 SourceMgr.overrideFileContents(File, std::move(SB));
Index: clang/include/clang/Basic/SourceManager.h
===
--- clang/include/clang/Basic/SourceManager.h
+++ clang/include/clang/Basic/SourceManager.h
@@ -958,6 +958,10 @@
   /// data in the given source file.
   void overrideFileContents(const FileEntry *SourceFile,
 std::unique_ptr Buffer);
+  void overrideFileContents(FileEntryRef SourceFile,
+std::unique_ptr Buffer) {
+overrideFileContents(&SourceFile.getFileEntry(), std::move(Buffer));
+  }
 
   /// Override the given source file with another one.
   ///


Index: clang/lib/Frontend/CompilerInstance.cpp
===
--- clang/lib/Frontend/CompilerInstance.cpp
+++ clang/lib/Frontend/CompilerInstance.cpp
@@ -891,8 +891,8 @@
 }
 std::unique_ptr SB = std::move(SBOrErr.get());
 
-const FileEntry *File = FileMgr.getVirtualFile(SB->getBufferIdentifier(),
-   SB->getBufferSize(), 0);
+FileEntryRef File = FileMgr.getVirtualFileRef(SB->getBufferIdentifier(),
+  SB->getBufferSize(), 0);
 SourceMgr.setMainFileID(
 SourceMgr.createFileID(File, SourceLocation(), Kind));
 SourceMgr.overrideFileContents(File, std::move(SB));
Index: clang/include/clang/Basic/SourceManager.h
===
--- clang/include/clang/Basic/SourceManager.h
+++ clang/include/clang/Basic/SourceManager.h
@@ -958,6 +958,10 @@
   /// data in the given source file.
   void overrideFileContents(const FileEntry *SourceFile,
 std::unique_ptr Buffer);
+  void overrideFileContents(FileEntryRef SourceFile,
+std::unique_ptr Buffer) {
+overrideFileContents(&SourceFile.getFileEntry(), std::move(Buffer));
+  }
 
   /// Override the given source file with another one.
   ///
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92680: Frontend: Migrate to FileEntryRef in CompilerInstance::InitializeSourceManager, NFC

2020-12-08 Thread Jan Svoboda via Phabricator via cfe-commits
jansvoboda11 accepted this revision.
jansvoboda11 added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92680/new/

https://reviews.llvm.org/D92680

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92680: Frontend: Migrate to FileEntryRef in CompilerInstance::InitializeSourceManager, NFC

2020-12-04 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith created this revision.
dexonsmith added reviewers: jansvoboda11, JDevlieghere, arphaman.
Herald added a subscriber: ributzka.
dexonsmith requested review of this revision.
Herald added a project: clang.

Use `FileManager::getVirtualFileRef` to get the virtual file for stdin,
and add an overload of `SourceManager::overrideFileContents` that takes
a `FileEntryRef`, migrating `CompilerInstance::InitializeSourceManager`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92680

Files:
  clang/include/clang/Basic/SourceManager.h
  clang/lib/Frontend/CompilerInstance.cpp


Index: clang/lib/Frontend/CompilerInstance.cpp
===
--- clang/lib/Frontend/CompilerInstance.cpp
+++ clang/lib/Frontend/CompilerInstance.cpp
@@ -869,8 +869,8 @@
 }
 std::unique_ptr SB = std::move(SBOrErr.get());
 
-const FileEntry *File = FileMgr.getVirtualFile(SB->getBufferIdentifier(),
-   SB->getBufferSize(), 0);
+FileEntryRef File = FileMgr.getVirtualFileRef(SB->getBufferIdentifier(),
+  SB->getBufferSize(), 0);
 SourceMgr.setMainFileID(
 SourceMgr.createFileID(File, SourceLocation(), Kind));
 SourceMgr.overrideFileContents(File, std::move(SB));
Index: clang/include/clang/Basic/SourceManager.h
===
--- clang/include/clang/Basic/SourceManager.h
+++ clang/include/clang/Basic/SourceManager.h
@@ -958,6 +958,10 @@
   /// data in the given source file.
   void overrideFileContents(const FileEntry *SourceFile,
 std::unique_ptr Buffer);
+  void overrideFileContents(FileEntryRef SourceFile,
+std::unique_ptr Buffer) {
+overrideFileContents(&SourceFile.getFileEntry(), std::move(Buffer));
+  }
 
   /// Override the given source file with another one.
   ///


Index: clang/lib/Frontend/CompilerInstance.cpp
===
--- clang/lib/Frontend/CompilerInstance.cpp
+++ clang/lib/Frontend/CompilerInstance.cpp
@@ -869,8 +869,8 @@
 }
 std::unique_ptr SB = std::move(SBOrErr.get());
 
-const FileEntry *File = FileMgr.getVirtualFile(SB->getBufferIdentifier(),
-   SB->getBufferSize(), 0);
+FileEntryRef File = FileMgr.getVirtualFileRef(SB->getBufferIdentifier(),
+  SB->getBufferSize(), 0);
 SourceMgr.setMainFileID(
 SourceMgr.createFileID(File, SourceLocation(), Kind));
 SourceMgr.overrideFileContents(File, std::move(SB));
Index: clang/include/clang/Basic/SourceManager.h
===
--- clang/include/clang/Basic/SourceManager.h
+++ clang/include/clang/Basic/SourceManager.h
@@ -958,6 +958,10 @@
   /// data in the given source file.
   void overrideFileContents(const FileEntry *SourceFile,
 std::unique_ptr Buffer);
+  void overrideFileContents(FileEntryRef SourceFile,
+std::unique_ptr Buffer) {
+overrideFileContents(&SourceFile.getFileEntry(), std::move(Buffer));
+  }
 
   /// Override the given source file with another one.
   ///
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits