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
diff --git a/Basic/FileManager.cpp b/Basic/FileManager.cpp
index 8ffde1f..9edbd03 100644
--- a/Basic/FileManager.cpp
+++ b/Basic/FileManager.cpp
@@ -65,7 +65,7 @@
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 @@
// 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 @@
UFE.ModTime = StatBuf.st_mtime;
UFE.Dir = DirInfo;
UFE.UID = NextFileUID++;
+ UFE.InoDev = &X.first->first;
return &UFE;
}