[PATCH] D89521: FileManager: Reorder declarations of FileEntry and FileEntryRef, NFC
Duncan P. N. Exon Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 23 17:47:47 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG81ac81f8644a: FileManager: Reorder declarations of FileEntry and FileEntryRef, NFC (authored by dexonsmith).
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89521/new/
https://reviews.llvm.org/D89521
Files:
clang/include/clang/Basic/FileManager.h
Index: clang/include/clang/Basic/FileManager.h
===================================================================
--- clang/include/clang/Basic/FileManager.h
+++ clang/include/clang/Basic/FileManager.h
@@ -71,6 +71,37 @@
const llvm::StringMapEntry<llvm::ErrorOr<DirectoryEntry &>> *Entry;
};
+class FileEntry;
+
+/// A reference to a \c FileEntry that includes the name of the file as it was
+/// accessed by the FileManager's client.
+class FileEntryRef {
+public:
+ FileEntryRef() = delete;
+ FileEntryRef(StringRef Name, const FileEntry &Entry)
+ : Name(Name), Entry(&Entry) {}
+
+ const StringRef getName() const { return Name; }
+ const FileEntry &getFileEntry() const { return *Entry; }
+
+ inline bool isValid() const;
+ inline off_t getSize() const;
+ inline unsigned getUID() const;
+ inline const llvm::sys::fs::UniqueID &getUniqueID() const;
+ inline time_t getModificationTime() const;
+
+ friend bool operator==(const FileEntryRef &LHS, const FileEntryRef &RHS) {
+ return LHS.Entry == RHS.Entry && LHS.Name == RHS.Name;
+ }
+ friend bool operator!=(const FileEntryRef &LHS, const FileEntryRef &RHS) {
+ return !(LHS == RHS);
+ }
+
+private:
+ StringRef Name;
+ const FileEntry *Entry;
+};
+
/// Cached information about one file (either on disk
/// or in the virtual file system).
///
@@ -126,41 +157,19 @@
bool isOpenForTests() const { return File != nullptr; }
};
-/// A reference to a \c FileEntry that includes the name of the file as it was
-/// accessed by the FileManager's client.
-class FileEntryRef {
-public:
- FileEntryRef() = delete;
- FileEntryRef(StringRef Name, const FileEntry &Entry)
- : Name(Name), Entry(&Entry) {}
+bool FileEntryRef::isValid() const { return getFileEntry().isValid(); }
- const StringRef getName() const { return Name; }
-
- bool isValid() const { return Entry->isValid(); }
-
- const FileEntry &getFileEntry() const { return *Entry; }
-
- off_t getSize() const { return Entry->getSize(); }
+off_t FileEntryRef::getSize() const { return getFileEntry().getSize(); }
- unsigned getUID() const { return Entry->getUID(); }
+unsigned FileEntryRef::getUID() const { return getFileEntry().getUID(); }
- const llvm::sys::fs::UniqueID &getUniqueID() const {
- return Entry->getUniqueID();
- }
+const llvm::sys::fs::UniqueID &FileEntryRef::getUniqueID() const {
+ return getFileEntry().getUniqueID();
+}
- time_t getModificationTime() const { return Entry->getModificationTime(); }
-
- friend bool operator==(const FileEntryRef &LHS, const FileEntryRef &RHS) {
- return LHS.Entry == RHS.Entry && LHS.Name == RHS.Name;
- }
- friend bool operator!=(const FileEntryRef &LHS, const FileEntryRef &RHS) {
- return !(LHS == RHS);
- }
-
-private:
- StringRef Name;
- const FileEntry *Entry;
-};
+time_t FileEntryRef::getModificationTime() const {
+ return getFileEntry().getModificationTime();
+}
/// Implements support for file system lookup, file system caching,
/// and directory search management.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89521.300444.patch
Type: text/x-patch
Size: 3022 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201024/2d51ef60/attachment.bin>
More information about the cfe-commits
mailing list