[PATCH] Some infrastructure work for virtual file system (now on phab)

Dmitri Gribenko gribozavr at gmail.com
Fri Feb 14 17:15:53 PST 2014



================
Comment at: lib/Basic/VirtualFileSystem.cpp:84
@@ +83,3 @@
+  friend class RealFileSystem;
+  RealFile(int FD) : FD(FD) {}
+public:
----------------
assert(FD >= 0) ?

================
Comment at: include/clang/Basic/VirtualFileSystem.h:87-90
@@ +86,6 @@
+public:
+  /// \brief Destroy the file after closing it (if open).
+  /// Sub-classes should generally call close() inside their destructors.  We
+  /// cannot do that from the base class, since close is virtual.
+  virtual ~File();
+  /// \brief Get the status of the file.
----------------
I could be misunderstanding something, but why not call the virtual close() from this destructor?

================
Comment at: lib/Basic/VirtualFileSystem.cpp:88
@@ +87,3 @@
+  ErrorOr<Status> status() LLVM_OVERRIDE;
+  error_code getBuffer(const Twine &Name, OwningPtr<MemoryBuffer> &Result, int64_t FileSize = -1, bool RequiresNullTerminator = true) LLVM_OVERRIDE;
+  error_code close() LLVM_OVERRIDE;
----------------
80 cols?


http://llvm-reviews.chandlerc.com/D2745



More information about the cfe-commits mailing list