diff options
author | Ted Kremenek <kremenek@apple.com> | 2007-12-18 22:29:39 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2007-12-18 22:29:39 +0000 |
commit | bca6d125c77c93c7fa41798c15348175a6bb1267 (patch) | |
tree | 019ee92a9df10f0d2791bd605bcfbe42cf841ca9 /Basic/FileManager.cpp | |
parent | 82dfaf7c0ccbbde43f701b12367dbf22265dcb4e (diff) |
Refactored inode and device number into FileEntry, and changed the
ADT storing FileEntry's in FileManager from a map to a set.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45184 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Basic/FileManager.cpp')
-rw-r--r-- | Basic/FileManager.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Basic/FileManager.cpp b/Basic/FileManager.cpp index 9edbd03873..2467fa6872 100644 --- a/Basic/FileManager.cpp +++ b/Basic/FileManager.cpp @@ -142,14 +142,12 @@ const FileEntry *FileManager::getFile(const char *NameStart, } //std::cerr << ": exists\n"; - // It exists. See if we have already opened a directory with the same inode. + // It exists. See if we have already opened a file with the same inode. // This occurs when one dir is symlinked to another, for example. - 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; + FileEntry &UFE = + const_cast<FileEntry&>(*UniqueFiles.insert(FileEntry(StatBuf.st_dev, + StatBuf.st_ino)).first); + NamedFileEnt.setValue(&UFE); if (UFE.getName()) // Already have an entry with this inode, return it. @@ -163,7 +161,6 @@ 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; } |