diff options
author | Ben Langmuir <blangmuir@apple.com> | 2014-02-27 19:20:35 +0000 |
---|---|---|
committer | Ben Langmuir <blangmuir@apple.com> | 2014-02-27 19:20:35 +0000 |
commit | dda6f52db192491cd828db5d4fb56be41d4897ac (patch) | |
tree | 624a086cfb85819a23dd22403214cd97200e5316 /include/clang/Basic/FileManager.h | |
parent | 1f3d645a46e7c3f34769e6b882f3be52d6816d95 (diff) | |
download | clang-dda6f52db192491cd828db5d4fb56be41d4897ac.tar.gz |
Revert "Remove constructors from FileEntry that prevent owning resources"
This reverts commit r202420, which broke the build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202421 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/FileManager.h')
-rw-r--r-- | include/clang/Basic/FileManager.h | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/include/clang/Basic/FileManager.h b/include/clang/Basic/FileManager.h index 616f9846a2..bd85318e2f 100644 --- a/include/clang/Basic/FileManager.h +++ b/include/clang/Basic/FileManager.h @@ -27,7 +27,6 @@ #include "llvm/Support/Allocator.h" // FIXME: Enhance libsystem to support inode and other fields in stat. #include <sys/types.h> -#include <map> #ifdef _MSC_VER typedef unsigned short mode_t; @@ -77,15 +76,27 @@ class FileEntry { File.reset(0); // rely on destructor to close File } - FileEntry(const FileEntry &) LLVM_DELETED_FUNCTION; - void operator=(const FileEntry &) LLVM_DELETED_FUNCTION; - public: + FileEntry(llvm::sys::fs::UniqueID UniqueID, bool IsNamedPipe, bool InPCH) + : Name(0), UniqueID(UniqueID), IsNamedPipe(IsNamedPipe), InPCH(InPCH), + IsValid(false) + {} + // Add a default constructor for use with llvm::StringMap FileEntry() : Name(0), UniqueID(0, 0), IsNamedPipe(false), InPCH(false), IsValid(false) {} + FileEntry(const FileEntry &FE) { + memcpy(this, &FE, sizeof(FE)); + assert(!File && "Cannot copy a file-owning FileEntry"); + } + + void operator=(const FileEntry &FE) { + memcpy(this, &FE, sizeof(FE)); + assert(!File && "Cannot assign a file-owning FileEntry"); + } + const char *getName() const { return Name; } bool isValid() const { return IsValid; } off_t getSize() const { return Size; } @@ -117,11 +128,14 @@ class FileManager : public RefCountedBase<FileManager> { IntrusiveRefCntPtr<vfs::FileSystem> FS; FileSystemOptions FileSystemOpts; + class UniqueDirContainer; + class UniqueFileContainer; + /// \brief Cache for existing real directories. - std::map<llvm::sys::fs::UniqueID, DirectoryEntry> UniqueRealDirs; + UniqueDirContainer &UniqueRealDirs; /// \brief Cache for existing real files. - std::map<llvm::sys::fs::UniqueID, FileEntry> UniqueRealFiles; + UniqueFileContainer &UniqueRealFiles; /// \brief The virtual directories that we have allocated. /// |