diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-01-18 16:23:48 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-01-18 16:23:48 +0000 |
commit | 06d4ba388873e6d1cfa9cd715a8935ecc8cd2097 (patch) | |
tree | 3eb853da77d46cc77c4b017525a422f9ddb1385b /include/clang/Basic/FileManager.h | |
parent | 30d791273d07fac9c0c1641a0731191bca6e8606 (diff) | |
download | src-test2-06d4ba388873e6d1cfa9cd715a8935ecc8cd2097.tar.gz src-test2-06d4ba388873e6d1cfa9cd715a8935ecc8cd2097.zip |
Notes
Diffstat (limited to 'include/clang/Basic/FileManager.h')
-rw-r--r-- | include/clang/Basic/FileManager.h | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/include/clang/Basic/FileManager.h b/include/clang/Basic/FileManager.h index 0ad53c4df5ac..bd3f27ab9e5e 100644 --- a/include/clang/Basic/FileManager.h +++ b/include/clang/Basic/FileManager.h @@ -12,8 +12,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_FILEMANAGER_H -#define LLVM_CLANG_FILEMANAGER_H +#ifndef LLVM_CLANG_BASIC_FILEMANAGER_H +#define LLVM_CLANG_BASIC_FILEMANAGER_H #include "clang/Basic/FileSystemOptions.h" #include "clang/Basic/LLVM.h" @@ -59,7 +59,7 @@ public: /// If the 'File' member is valid, then this FileEntry has an open file /// descriptor for the file. class FileEntry { - std::string Name; // Name of the file. + const char *Name; // Name of the file. off_t Size; // File size in bytes. time_t ModTime; // Modification time of file. const DirectoryEntry *Dir; // Directory file lives in. @@ -93,7 +93,7 @@ public: assert(!isValid() && "Cannot copy an initialized FileEntry"); } - const char *getName() const { return Name.c_str(); } + const char *getName() const { return Name; } bool isValid() const { return IsValid; } off_t getSize() const { return Size; } unsigned getUID() const { return UID; } @@ -194,7 +194,8 @@ public: /// \param AtBeginning whether this new stat cache must be installed at the /// beginning of the chain of stat caches. Otherwise, it will be added to /// the end of the chain. - void addStatCache(FileSystemStatCache *statCache, bool AtBeginning = false); + void addStatCache(std::unique_ptr<FileSystemStatCache> statCache, + bool AtBeginning = false); /// \brief Removes the specified FileSystemStatCache object from the manager. void removeStatCache(FileSystemStatCache *statCache); @@ -240,12 +241,11 @@ public: /// \brief Open the specified file as a MemoryBuffer, returning a new /// MemoryBuffer if successful, otherwise returning null. - llvm::MemoryBuffer *getBufferForFile(const FileEntry *Entry, - std::string *ErrorStr = nullptr, - bool isVolatile = false, - bool ShouldCloseOpenFile = true); - llvm::MemoryBuffer *getBufferForFile(StringRef Filename, - std::string *ErrorStr = nullptr); + llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> + getBufferForFile(const FileEntry *Entry, bool isVolatile = false, + bool ShouldCloseOpenFile = true); + llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> + getBufferForFile(StringRef Filename); /// \brief Get the 'stat' information for the given \p Path. /// @@ -274,6 +274,9 @@ public: static void modifyFileEntry(FileEntry *File, off_t Size, time_t ModificationTime); + /// \brief Remove any './' components from a path. + static bool removeDotPaths(SmallVectorImpl<char> &Path); + /// \brief Retrieve the canonical name for a given directory. /// /// This is a very expensive operation, despite its results being cached, |