diff options
author | Ted Kremenek <kremenek@apple.com> | 2007-12-18 20:45:25 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2007-12-18 20:45:25 +0000 |
commit | da9954400aab56bc3df60eb1b7be2489121c6166 (patch) | |
tree | d36859e3ddcb825331c8ca1c351639f067bb34be /Basic/FileManager.cpp | |
parent | 2b9d2ca4ce53fffbe8a77c7db2fe4df5ccfb9fd4 (diff) |
Added to FileEntry a pointer to the <dev_t,ino_t> pair for the file, and
accessors to FileEntry to query these values.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45171 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Basic/FileManager.cpp')
-rw-r--r-- | Basic/FileManager.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Basic/FileManager.cpp b/Basic/FileManager.cpp index 8ffde1f6fc..9edbd03873 100644 --- a/Basic/FileManager.cpp +++ b/Basic/FileManager.cpp @@ -65,7 +65,7 @@ const DirectoryEntry *FileManager::getDirectory(const char *NameStart, return 0; // It exists. See if we have already opened a directory with the same inode. - // This occurs when one dir is symlinked to another, for example. + // This occurs when one dir is symlinked to another, for example. DirectoryEntry &UDE = UniqueDirs[std::make_pair(StatBuf.st_dev, StatBuf.st_ino)]; @@ -144,7 +144,12 @@ const FileEntry *FileManager::getFile(const char *NameStart, // It exists. See if we have already opened a directory with the same inode. // This occurs when one dir is symlinked to another, for example. - FileEntry &UFE = UniqueFiles[std::make_pair(StatBuf.st_dev, StatBuf.st_ino)]; + std::pair<FileEntryMap::iterator,bool> X = + UniqueFiles.insert(FileEntryMap::value_type(std::make_pair(StatBuf.st_dev, + StatBuf.st_ino), + FileEntry())); + + FileEntry &UFE = X.first->second; NamedFileEnt.setValue(&UFE); if (UFE.getName()) // Already have an entry with this inode, return it. @@ -158,6 +163,7 @@ const FileEntry *FileManager::getFile(const char *NameStart, UFE.ModTime = StatBuf.st_mtime; UFE.Dir = DirInfo; UFE.UID = NextFileUID++; + UFE.InoDev = &X.first->first; return &UFE; } |