void FileManager::FixupRelativePath(llvm::sys::Path &path,
const FileSystemOptions &FSOpts) {
- if (FSOpts.WorkingDir.empty() || path.isAbsolute()) return;
-
- llvm::sys::Path NewPath(FSOpts.WorkingDir);
- NewPath.appendComponent(path.str());
+ if (FSOpts.WorkingDir.empty() || llvm::sys::path::is_absolute(path.str()))
+ return;
+
+ llvm::SmallString<128> NewPath(FSOpts.WorkingDir);
+ llvm::sys::path::append(NewPath, path.str());
path = NewPath;
}
return Result;
// Cache file 'stat' results and directories with absolutely paths.
- if (!S_ISDIR(StatBuf.st_mode) || llvm::sys::Path(Path).isAbsolute())
+ if (!S_ISDIR(StatBuf.st_mode) || llvm::sys::path::is_absolute(Path))
StatCalls[Path] = StatBuf;
return Result;
std::string DirName = "";
- if (!llvm::sys::Path(Entry->getName()).isAbsolute()) {
+ if (llvm::sys::path::is_relative(Entry->getName())) {
llvm::sys::Path P = llvm::sys::Path::GetCurrentDirectory();
DirName = P.str() + "/";
}
#include "llvm/ADT/OwningPtr.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Program.h"
// Check that the file exists, if enabled.
if (CheckInputsExist && memcmp(Value, "-", 2) != 0) {
- llvm::sys::Path Path(Value);
+ llvm::SmallString<64> Path(Value);
if (Arg *WorkDir = Args.getLastArg(options::OPT_working_directory))
- if (!Path.isAbsolute()) {
+ if (llvm::sys::path::is_absolute(Path.str())) {
Path = WorkDir->getValue(Args);
- Path.appendComponent(Value);
+ llvm::sys::path::append(Path, Value);
}
- if (!Path.exists())
+ bool exists = false;
+ if (/*error_code ec =*/llvm::sys::fs::exists(Value, exists) || !exists)
Diag(clang::diag::err_drv_no_such_file) << Path.str();
else
Inputs.push_back(std::make_pair(Ty, A));
const FileEntry *FE = C.Entry;
// FIXME: Handle files with non-absolute paths.
- llvm::sys::Path P(FE->getName());
- if (!P.isAbsolute())
+ if (llvm::sys::path::is_relative(FE->getName()))
continue;
const llvm::MemoryBuffer *B = C.getBuffer(PP.getDiagnostics(), SM);
PM.insert(PTHEntryKeyVariant(Path), PTHEntry());
else if (S_ISDIR(StatBuf.st_mode)) {
// Only cache directories with absolute paths.
- if (!llvm::sys::Path(Path).isAbsolute())
+ if (llvm::sys::path::is_relative(Path))
return Result;
PM.insert(PTHEntryKeyVariant(&StatBuf, Path), PTHEntry());
// Compute the actual path, taking into consideration -isysroot.
llvm::SmallString<256> MappedPathStorage;
llvm::StringRef MappedPathStr = Path.toStringRef(MappedPathStorage);
- llvm::sys::Path MappedPath(MappedPathStr);
// Handle isysroot.
- if (Group == System && !IgnoreSysRoot && MappedPath.isAbsolute() &&
+ if (Group == System && !IgnoreSysRoot &&
+ llvm::sys::path::is_absolute(MappedPathStr) &&
IncludeSysroot != llvm::sys::Path::GetRootDirectory()) {
MappedPathStorage.clear();
MappedPathStr =
const DirectoryLookup *&CurDir,
const FileEntry *CurFileEnt) {
// If 'Filename' is absolute, check to see if it exists and no searching.
- if (llvm::sys::Path::isAbsolute(Filename.begin(), Filename.size())) {
+ if (llvm::sys::path::is_absolute(Filename)) {
CurDir = 0;
// If this was an #include_next "/absolute/file", fail.
if (!RelocatablePCH)
return;
- if (Filename.empty() || llvm::sys::Path(Filename).isAbsolute())
+ if (Filename.empty() || llvm::sys::path::is_absolute(Filename))
return;
if (isysroot == 0) {