summaryrefslogtreecommitdiffstats
path: root/clang/Basic/FileManager.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-10-30 03:11:40 +0000
committerChris Lattner <sabre@nondot.org>2006-10-30 03:11:40 +0000
commita85cbe28a0166d4a752b01cee4eda66a99a37a1a (patch)
treecdefa0945cb851014d3c6174f5f4c3f8b3943a80 /clang/Basic/FileManager.cpp
parentaf653759440d53910ffe95d0519bf7c6cc3966a8 (diff)
downloadbcm5719-llvm-a85cbe28a0166d4a752b01cee4eda66a99a37a1a.tar.gz
bcm5719-llvm-a85cbe28a0166d4a752b01cee4eda66a99a37a1a.zip
Avoid storing a directory name in both the DirEntries map keys and in the
UniqueDirs value. Instead, just have the UniqueDirs value contain a pointer to the key in the DirEntries map. llvm-svn: 39083
Diffstat (limited to 'clang/Basic/FileManager.cpp')
-rw-r--r--clang/Basic/FileManager.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/Basic/FileManager.cpp b/clang/Basic/FileManager.cpp
index c1520c80e44..5ee032ef033 100644
--- a/clang/Basic/FileManager.cpp
+++ b/clang/Basic/FileManager.cpp
@@ -59,11 +59,12 @@ const DirectoryEntry *FileManager::getDirectory(const std::string &Filename) {
DirectoryEntry &UDE =
UniqueDirs[std::make_pair(StatBuf.st_dev, StatBuf.st_ino)];
- if (UDE.getName()[0]) // Already have an entry with this inode, return it.
+ if (UDE.getName()) // Already have an entry with this inode, return it.
return NamedDirEnt = &UDE;
- // Otherwise, we don't have this directory yet, add it.
- UDE.Name = Filename;
+ // Otherwise, we don't have this directory yet, add it. We use the string
+ // key from the DirEntries map as the string.
+ UDE.Name = DirEntries.GetKeyForValueInMap(NamedDirEnt);
return NamedDirEnt = &UDE;
}
OpenPOWER on IntegriCloud