r228407 - Make FileEntry::closeFile public

Ben Langmuir blangmuir at apple.com
Fri Feb 6 09:34:28 PST 2015


Author: benlangmuir
Date: Fri Feb  6 11:34:28 2015
New Revision: 228407

URL: http://llvm.org/viewvc/llvm-project?rev=228407&view=rev
Log:
Make FileEntry::closeFile public

If you request that the file manager not close your file immediately
after reading, it's useful to be able to close it later to prevent a
file descriptor leak.

Modified:
    cfe/trunk/include/clang/Basic/FileManager.h

Modified: cfe/trunk/include/clang/Basic/FileManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/FileManager.h?rev=228407&r1=228406&r2=228407&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/FileManager.h (original)
+++ cfe/trunk/include/clang/Basic/FileManager.h Fri Feb  6 11:34:28 2015
@@ -73,10 +73,6 @@ class FileEntry {
   mutable std::unique_ptr<vfs::File> File;
   friend class FileManager;
 
-  void closeFile() const {
-    File.reset(); // rely on destructor to close File
-  }
-
   void operator=(const FileEntry &) LLVM_DELETED_FUNCTION;
 
 public:
@@ -109,6 +105,10 @@ public:
   /// \brief Check whether the file is a named pipe (and thus can't be opened by
   /// the native FileManager methods).
   bool isNamedPipe() const { return IsNamedPipe; }
+
+  void closeFile() const {
+    File.reset(); // rely on destructor to close File
+  }
 };
 
 struct FileData;





More information about the cfe-commits mailing list