[Lldb-commits] [lldb] 14cad95 - [LLDB] Fix NSIndexPathSyntheticFrontEnd::Impl::Clear() to only clear the active union member

Shafik Yaghmour via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 30 18:01:56 PDT 2022


Author: Shafik Yaghmour
Date: 2022-03-30T18:00:37-07:00
New Revision: 14cad95d38235df6c5fd5dd3da84b91fa69e7e74

URL: https://github.com/llvm/llvm-project/commit/14cad95d38235df6c5fd5dd3da84b91fa69e7e74
DIFF: https://github.com/llvm/llvm-project/commit/14cad95d38235df6c5fd5dd3da84b91fa69e7e74.diff

LOG: [LLDB] Fix NSIndexPathSyntheticFrontEnd::Impl::Clear() to only clear the active union member

NSIndexPathSyntheticFrontEnd::Impl::Clear() currently calls Clear() on both
unions members regardless of which one is active. I modified it to only call
Clear() on the active member.

Differential Revision: https://reviews.llvm.org/D122753

Added: 
    

Modified: 
    lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
index 8db75716e1862..429633e5e6b87 100644
--- a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
@@ -282,9 +282,17 @@ class NSIndexPathSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
     };
 
     void Clear() {
+      switch (m_mode) {
+      case Mode::Inlined:
+        m_inlined.Clear();
+        break;
+      case Mode::Outsourced:
+        m_outsourced.Clear();
+        break;
+      case Mode::Invalid:
+        break;
+      }
       m_mode = Mode::Invalid;
-      m_inlined.Clear();
-      m_outsourced.Clear();
     }
 
     Impl() {}


        


More information about the lldb-commits mailing list