diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-12-21 16:45:57 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-12-21 16:45:57 +0000 |
commit | fbfd180495e7800975c6d9bdc6d24e706ef70e34 (patch) | |
tree | 8b9c57bb01c6f17bd37ff34ef8f93e3ddc5e32d2 /lib | |
parent | 06a8dc616ec8324694d45cd4d724634a899be9a3 (diff) |
Replace all uses of PathV1::makeAbsolute with PathV2::fs::make_absolute.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122340 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Basic/FileManager.cpp | 7 | ||||
-rw-r--r-- | lib/Frontend/CacheTokens.cpp | 5 | ||||
-rw-r--r-- | lib/Frontend/InitPreprocessor.cpp | 8 | ||||
-rw-r--r-- | lib/Serialization/ASTWriter.cpp | 9 |
4 files changed, 17 insertions, 12 deletions
diff --git a/lib/Basic/FileManager.cpp b/lib/Basic/FileManager.cpp index 921778d7d1..bb37c999d1 100644 --- a/lib/Basic/FileManager.cpp +++ b/lib/Basic/FileManager.cpp @@ -21,6 +21,7 @@ #include "clang/Basic/FileSystemStatCache.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/Path.h" @@ -384,9 +385,9 @@ FileManager::getVirtualFile(llvm::StringRef Filename, off_t Size, return UFE; UFE->FD = FileDescriptor; - llvm::sys::Path FilePath(UFE->Name); - FilePath.makeAbsolute(); - FileEntries[FilePath.str()] = UFE; + llvm::SmallString<128> FilePath(UFE->Name); + llvm::sys::fs::make_absolute(FilePath); + FileEntries[FilePath] = UFE; return UFE; } diff --git a/lib/Frontend/CacheTokens.cpp b/lib/Frontend/CacheTokens.cpp index cd5723aa82..aae572cb98 100644 --- a/lib/Frontend/CacheTokens.cpp +++ b/lib/Frontend/CacheTokens.cpp @@ -23,6 +23,7 @@ #include "clang/Lex/Preprocessor.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringMap.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/Path.h" @@ -540,9 +541,9 @@ void clang::CacheTokens(Preprocessor &PP, llvm::raw_fd_ostream* OS) { // Get the name of the main file. const SourceManager &SrcMgr = PP.getSourceManager(); const FileEntry *MainFile = SrcMgr.getFileEntryForID(SrcMgr.getMainFileID()); - llvm::sys::Path MainFilePath(MainFile->getName()); + llvm::SmallString<128> MainFilePath(MainFile->getName()); - MainFilePath.makeAbsolute(); + llvm::sys::fs::make_absolute(MainFilePath); // Create the PTHWriter. PTHWriter PW(*OS, PP); diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp index 1f15556022..d0111a5d26 100644 --- a/lib/Frontend/InitPreprocessor.cpp +++ b/lib/Frontend/InitPreprocessor.cpp @@ -22,6 +22,7 @@ #include "clang/Basic/FileManager.h" #include "clang/Basic/SourceManager.h" #include "llvm/ADT/APFloat.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" using namespace clang; @@ -55,9 +56,10 @@ std::string clang::NormalizeDashIncludePath(llvm::StringRef File) { // it has not file entry. For now, workaround this by using an // absolute path if we find the file here, and otherwise letting // header search handle it. - llvm::sys::Path Path(File); - Path.makeAbsolute(); - if (!Path.exists()) + llvm::SmallString<128> Path(File); + llvm::sys::fs::make_absolute(Path); + bool exists; + if (llvm::sys::fs::exists(Path.str(), exists) || !exists) Path = File; return Lexer::Stringify(Path.str()); diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index 345cc8e74c..bf07c52335 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -41,6 +41,7 @@ #include "llvm/ADT/APInt.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Bitcode/BitstreamWriter.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" #include <cstdio> @@ -810,9 +811,9 @@ void ASTWriter::WriteMetadata(ASTContext &Context, const char *isysroot) { FileAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // File name unsigned FileAbbrevCode = Stream.EmitAbbrev(FileAbbrev); - llvm::sys::Path MainFilePath(MainFile->getName()); + llvm::SmallString<128> MainFilePath(MainFile->getName()); - MainFilePath.makeAbsolute(); + llvm::sys::fs::make_absolute(MainFilePath); const char *MainFileNameStr = MainFilePath.c_str(); MainFileNameStr = adjustFilenameForRelocatablePCH(MainFileNameStr, @@ -1176,8 +1177,8 @@ void ASTWriter::WriteSourceManagerBlock(SourceManager &SourceMgr, // Turn the file name into an absolute path, if it isn't already. const char *Filename = Content->Entry->getName(); - llvm::sys::Path FilePath(Filename, strlen(Filename)); - FilePath.makeAbsolute(); + llvm::SmallString<128> FilePath(Filename); + llvm::sys::fs::make_absolute(FilePath); Filename = FilePath.c_str(); Filename = adjustFilenameForRelocatablePCH(Filename, isysroot); |