Get rid of the static FileManager::FixupRelativePath.

llvm-svn: 127573
This commit is contained in:
Anders Carlsson 2011-03-14 01:13:54 +00:00
parent d91d5f162f
commit 9ba8fb1e48
3 changed files with 5 additions and 12 deletions

View File

@ -197,9 +197,6 @@ public:
/// \brief If path is not absolute and FileSystemOptions set the working
/// directory, the path is modified to be relative to the given
/// working directory.
static void FixupRelativePath(llvm::SmallVectorImpl<char> &path,
const FileSystemOptions &FSOpts);
void FixupRelativePath(llvm::SmallVectorImpl<char> &path) const;
/// \brief Produce an array mapping from the unique IDs assigned to each

View File

@ -450,22 +450,18 @@ FileManager::getVirtualFile(llvm::StringRef Filename, off_t Size,
return UFE;
}
void FileManager::FixupRelativePath(llvm::SmallVectorImpl<char> &path,
const FileSystemOptions &FSOpts) {
void FileManager::FixupRelativePath(llvm::SmallVectorImpl<char> &path) const {
llvm::StringRef pathRef(path.data(), path.size());
if (FSOpts.WorkingDir.empty() || llvm::sys::path::is_absolute(pathRef))
if (FileSystemOpts.WorkingDir.empty()
|| llvm::sys::path::is_absolute(pathRef))
return;
llvm::SmallString<128> NewPath(FSOpts.WorkingDir);
llvm::SmallString<128> NewPath(FileSystemOpts.WorkingDir);
llvm::sys::path::append(NewPath, pathRef);
path = NewPath;
}
void FileManager::FixupRelativePath(llvm::SmallVectorImpl<char> &path) const {
FixupRelativePath(path, FileSystemOpts);
}
llvm::MemoryBuffer *FileManager::
getBufferForFile(const FileEntry *Entry, std::string *ErrorStr) {
llvm::OwningPtr<llvm::MemoryBuffer> Result;

View File

@ -370,7 +370,7 @@ void CompilerInstance::clearOutputFiles(bool EraseFiles) {
// If '-working-directory' was passed, the output filename should be
// relative to that.
FileManager::FixupRelativePath(NewOutFile, getFileSystemOpts());
FileMgr->FixupRelativePath(NewOutFile);
if (llvm::error_code ec = llvm::sys::fs::rename(it->TempFilename,
NewOutFile.str())) {
getDiagnostics().Report(diag::err_fe_unable_to_rename_temp)