[Lldb-commits] [PATCH] D76805: Fix SourceManager::SourceFileCache insertion

Emre Kultursay via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 25 15:11:29 PDT 2020


emrekultursay created this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
emrekultursay added a child revision: D76806: Remove m_last_file_sp from SourceManager.

Lookup and subsequent insert was done using uninitialized
FileSpec object, which caused the cache to be a no-op.

Depends on D76804 <https://reviews.llvm.org/D76804>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76805

Files:
  lldb/source/Core/SourceManager.cpp


Index: lldb/source/Core/SourceManager.cpp
===================================================================
--- lldb/source/Core/SourceManager.cpp
+++ lldb/source/Core/SourceManager.cpp
@@ -696,7 +696,7 @@
 }
 
 void SourceManager::SourceFileCache::AddSourceFile(const FileSP &file_sp) {
-  FileSpec file_spec;
+  FileSpec file_spec = file_sp->GetFileSpec();;
   FileCache::iterator pos = m_file_cache.find(file_spec);
   if (pos == m_file_cache.end())
     m_file_cache[file_spec] = file_sp;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76805.252681.patch
Type: text/x-patch
Size: 495 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200325/947ca01a/attachment-0001.bin>


More information about the lldb-commits mailing list