aboutsummaryrefslogtreecommitdiff
path: root/lib/Basic/FileManager.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-11-23 08:35:12 +0000
committerChris Lattner <sabre@nondot.org>2010-11-23 08:35:12 +0000
commit39b49bcaaddb1049234fca9500c0ac02c088e23d (patch)
tree4f7ac9da3cf2bcbad0aebfb781b7635462b431cf /lib/Basic/FileManager.cpp
parent458b5e25052a1052eb873f9145298e0f0aa75cd1 (diff)
now the FileManager has a FileSystemOpts ivar, stop threading
FileSystemOpts through a ton of apis, simplifying a lot of code. This also fixes a latent bug in ASTUnit where it would invoke methods on FileManager without creating one in some code paths in cindextext. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120010 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/FileManager.cpp')
-rw-r--r--lib/Basic/FileManager.cpp23
1 files changed, 8 insertions, 15 deletions
diff --git a/lib/Basic/FileManager.cpp b/lib/Basic/FileManager.cpp
index 6b356b87d5..36b53850bc 100644
--- a/lib/Basic/FileManager.cpp
+++ b/lib/Basic/FileManager.cpp
@@ -199,8 +199,7 @@ void FileManager::removeStatCache(StatSysCallCache *statCache) {
/// \brief Retrieve the directory that the given file name resides in.
static const DirectoryEntry *getDirectoryFromFile(FileManager &FileMgr,
- llvm::StringRef Filename,
- const FileSystemOptions &FileSystemOpts) {
+ llvm::StringRef Filename) {
// Figure out what directory it is in. If the string contains a / in it,
// strip off everything after it.
// FIXME: this logic should be in sys::Path.
@@ -210,7 +209,7 @@ static const DirectoryEntry *getDirectoryFromFile(FileManager &FileMgr,
// Use the current directory if file has no path component.
if (SlashPos == 0)
- return FileMgr.getDirectory(".", FileSystemOpts);
+ return FileMgr.getDirectory(".");
if (SlashPos == Filename.size()-1)
return 0; // If filename ends with a /, it's a directory.
@@ -219,14 +218,13 @@ static const DirectoryEntry *getDirectoryFromFile(FileManager &FileMgr,
while (SlashPos != 0 && IS_DIR_SEPARATOR_CHAR(Filename[SlashPos-1]))
--SlashPos;
- return FileMgr.getDirectory(Filename.substr(0, SlashPos), FileSystemOpts);
+ return FileMgr.getDirectory(Filename.substr(0, SlashPos));
}
/// getDirectory - Lookup, cache, and verify the specified directory. This
/// returns null if the directory doesn't exist.
///
-const DirectoryEntry *FileManager::getDirectory(llvm::StringRef Filename,
- const FileSystemOptions &FileSystemOpts) {
+const DirectoryEntry *FileManager::getDirectory(llvm::StringRef Filename) {
// stat doesn't like trailing separators (at least on Windows).
if (Filename.size() > 1 && IS_DIR_SEPARATOR_CHAR(Filename.back()))
Filename = Filename.substr(0, Filename.size()-1);
@@ -276,8 +274,7 @@ const DirectoryEntry *FileManager::getDirectory(llvm::StringRef Filename,
/// getFile - Lookup, cache, and verify the specified file. This returns null
/// if the file doesn't exist.
///
-const FileEntry *FileManager::getFile(llvm::StringRef Filename,
- const FileSystemOptions &FileSystemOpts) {
+const FileEntry *FileManager::getFile(llvm::StringRef Filename) {
++NumFileLookups;
// See if there is already an entry in the map.
@@ -299,8 +296,7 @@ const FileEntry *FileManager::getFile(llvm::StringRef Filename,
// FileEntries map.
const char *InterndFileName = NamedFileEnt.getKeyData();
- const DirectoryEntry *DirInfo
- = getDirectoryFromFile(*this, Filename, FileSystemOpts);
+ const DirectoryEntry *DirInfo = getDirectoryFromFile(*this, Filename);
if (DirInfo == 0) // Directory doesn't exist, file can't exist.
return 0;
@@ -339,8 +335,7 @@ const FileEntry *FileManager::getFile(llvm::StringRef Filename,
const FileEntry *
FileManager::getVirtualFile(llvm::StringRef Filename, off_t Size,
- time_t ModificationTime,
- const FileSystemOptions &FileSystemOpts) {
+ time_t ModificationTime) {
++NumFileLookups;
// See if there is already an entry in the map.
@@ -357,8 +352,7 @@ FileManager::getVirtualFile(llvm::StringRef Filename, off_t Size,
// By default, initialize it to invalid.
NamedFileEnt.setValue(NON_EXISTENT_FILE);
- const DirectoryEntry *DirInfo
- = getDirectoryFromFile(*this, Filename, FileSystemOpts);
+ const DirectoryEntry *DirInfo = getDirectoryFromFile(*this, Filename);
if (DirInfo == 0) // Directory doesn't exist, file can't exist.
return 0;
@@ -399,7 +393,6 @@ void FileManager::FixupRelativePath(llvm::sys::Path &path,
llvm::MemoryBuffer *FileManager::
getBufferForFile(llvm::StringRef Filename,
- const FileSystemOptions &FileSystemOpts,
std::string *ErrorStr, int64_t FileSize) {
if (FileSystemOpts.WorkingDir.empty())
return llvm::MemoryBuffer::getFile(Filename, ErrorStr, FileSize);