aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/FileManager.cpp
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2016-10-11 07:31:29 +0000
committerMehdi Amini <mehdi.amini@apple.com>2016-10-11 07:31:29 +0000
commit0df59d8c029db83a6ca7de2186fcd556c7d7ab29 (patch)
treee21b3bd819c916b40cffe64333c3662fc0d184a8 /clang/lib/Basic/FileManager.cpp
parentcbf2e67461cee2193317dee77f819b0dc891faba (diff)
downloadllvm-0df59d8c029db83a6ca7de2186fcd556c7d7ab29.zip
llvm-0df59d8c029db83a6ca7de2186fcd556c7d7ab29.tar.gz
llvm-0df59d8c029db83a6ca7de2186fcd556c7d7ab29.tar.bz2
Turn FileManager DirectoryEntry::Name from raw pointer to StringRef (NFC)
llvm-svn: 283856
Diffstat (limited to 'clang/lib/Basic/FileManager.cpp')
-rw-r--r--clang/lib/Basic/FileManager.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp
index 29b8f38..50050d0 100644
--- a/clang/lib/Basic/FileManager.cpp
+++ b/clang/lib/Basic/FileManager.cpp
@@ -140,7 +140,7 @@ void FileManager::addAncestorsAsVirtualDirs(StringRef Path) {
// Add the virtual directory to the cache.
auto UDE = llvm::make_unique<DirectoryEntry>();
- UDE->Name = NamedDirEnt.first().data();
+ UDE->Name = NamedDirEnt.first();
NamedDirEnt.second = UDE.get();
VirtualDirectoryEntries.push_back(std::move(UDE));
@@ -185,7 +185,7 @@ const DirectoryEntry *FileManager::getDirectory(StringRef DirName,
// Get the null-terminated directory name as stored as the key of the
// SeenDirEntries map.
- const char *InterndDirName = NamedDirEnt.first().data();
+ StringRef InterndDirName = NamedDirEnt.first();
// Check to see if the directory exists.
FileData Data;
@@ -203,7 +203,7 @@ const DirectoryEntry *FileManager::getDirectory(StringRef DirName,
DirectoryEntry &UDE = UniqueRealDirs[Data.UniqueID];
NamedDirEnt.second = &UDE;
- if (!UDE.getName()) {
+ if (UDE.getName().empty()) {
// We don't have this directory yet, add it. We use the string
// key from the SeenDirEntries map as the string.
UDE.Name = InterndDirName;
@@ -232,7 +232,7 @@ const FileEntry *FileManager::getFile(StringRef Filename, bool openFile,
// Get the null-terminated file name as stored as the key of the
// SeenFileEntries map.
- const char *InterndFileName = NamedFileEnt.first().data();
+ StringRef InterndFileName = NamedFileEnt.first();
// Look up the directory for the file. When looking up something like
// sys/foo.h we'll discover all of the search directories that have a 'sys'
@@ -463,7 +463,7 @@ FileManager::getBufferForFile(StringRef Filename) {
/// if the path points to a virtual file or does not exist, or returns
/// false if it's an existent real file. If FileDescriptor is NULL,
/// do directory look-up instead of file look-up.
-bool FileManager::getStatValue(const char *Path, FileData &Data, bool isFile,
+bool FileManager::getStatValue(StringRef Path, FileData &Data, bool isFile,
std::unique_ptr<vfs::File> *F) {
// FIXME: FileSystemOpts shouldn't be passed in here, all paths should be
// absolute!
@@ -535,7 +535,7 @@ StringRef FileManager::getCanonicalName(const DirectoryEntry *Dir) {
#ifdef LLVM_ON_UNIX
char CanonicalNameBuf[PATH_MAX];
- if (realpath(Dir->getName(), CanonicalNameBuf))
+ if (realpath(Dir->getName().str().c_str(), CanonicalNameBuf))
CanonicalName = StringRef(CanonicalNameBuf).copy(CanonicalNameStorage);
#else
SmallString<256> CanonicalNameBuf(CanonicalName);