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 | f4c38c9289aeb90f6aaff039a5b23ca234faa352 (patch) | |
| tree | 0ce382ca74eaa16c9decffcdf3df84bf5913117b /clang/Basic/FileManager.cpp | |
| parent | 8c8947fb921e01d0937c47873a3c818ff20d1da0 (diff) | |
| download | bcm5719-llvm-f4c38c9289aeb90f6aaff039a5b23ca234faa352.tar.gz bcm5719-llvm-f4c38c9289aeb90f6aaff039a5b23ca234faa352.zip | |
Refactored inode and device number into FileEntry, and changed the
ADT storing FileEntry's in FileManager from a map to a set.
llvm-svn: 45184
Diffstat (limited to 'clang/Basic/FileManager.cpp')
| -rw-r--r-- | clang/Basic/FileManager.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/clang/Basic/FileManager.cpp b/clang/Basic/FileManager.cpp index 9edbd03873f..2467fa6872c 100644 --- a/clang/Basic/FileManager.cpp +++ b/clang/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; } |

