From 5d8005a07ec6516f59c429a9950fe1845669ab0c Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Mon, 26 Aug 2019 17:31:06 +0000 Subject: [PATCH] Fix use of invalidated iterator introduced by r369680. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369932 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/FileManager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Basic/FileManager.cpp b/lib/Basic/FileManager.cpp index 7138f6677e..649e4d2239 100644 --- a/lib/Basic/FileManager.cpp +++ b/lib/Basic/FileManager.cpp @@ -263,15 +263,15 @@ FileManager::getFileRef(StringRef Filename, bool openFile, bool CacheFailure) { // If the name returned by getStatValue is different than Filename, re-intern // the name. if (Status.getName() != Filename) { - auto &NamedFileEnt = + auto &NewNamedFileEnt = *SeenFileEntries.insert({Status.getName(), &UFE}).first; - assert((*NamedFileEnt.second).get() == &UFE && + assert((*NewNamedFileEnt.second).get() == &UFE && "filename from getStatValue() refers to wrong file"); - InterndFileName = NamedFileEnt.first().data(); + InterndFileName = NewNamedFileEnt.first().data(); // In addition to re-interning the name, construct a redirecting seen file // entry, that will point to the name the filesystem actually wants to use. StringRef *Redirect = new (CanonicalNameStorage) StringRef(InterndFileName); - SeenFileInsertResult.first->second = Redirect; + NamedFileEnt.second = Redirect; } if (UFE.isValid()) { // Already have an entry with this inode, return it. -- 2.40.0