friend class FileManager;
std::string RealPathName; // Real path to the file; could be empty.
- off_t Size; // File size in bytes.
- time_t ModTime; // Modification time of file.
- const DirectoryEntry *Dir; // Directory file lives in.
+ off_t Size = 0; // File size in bytes.
+ time_t ModTime = 0; // Modification time of file.
+ const DirectoryEntry *Dir = nullptr; // Directory file lives in.
llvm::sys::fs::UniqueID UniqueID;
- unsigned UID; // A unique (small) ID for the file.
- bool IsNamedPipe;
- bool IsValid; // Is this \c FileEntry initialized and valid?
+ unsigned UID = 0; // A unique (small) ID for the file.
+ bool IsNamedPipe = false;
+ bool IsValid = false; // Is this \c FileEntry initialized and valid?
/// The open file, if it is owned by the \p FileEntry.
mutable std::unique_ptr<llvm::vfs::File> File;
using namespace clang;
-FileEntry::FileEntry() : UniqueID(0, 0), IsNamedPipe(false), IsValid(false) {}
+FileEntry::FileEntry() : UniqueID(0, 0) {}
FileEntry::~FileEntry() = default;
}
};
+TEST(FileEntryTest, Constructor) {
+ FileEntry FE;
+ EXPECT_EQ(0U, FE.getSize());
+ EXPECT_EQ(0, FE.getModificationTime());
+ EXPECT_EQ(nullptr, FE.getDir());
+ EXPECT_EQ(0U, FE.getUniqueID().getDevice());
+ EXPECT_EQ(0U, FE.getUniqueID().getFile());
+ EXPECT_EQ(false, FE.isNamedPipe());
+ EXPECT_EQ(false, FE.isValid());
+}
+
TEST(FileEntryTest, FileEntryRef) {
RefMaps Refs;
FileEntryRef R1 = Refs.addFile("1");