[Lldb-commits] [PATCH] D122753: Fix NSIndexPathSyntheticFrontEnd::Impl::Clear() to only clear the active union member

Shafik Yaghmour via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 30 11:25:08 PDT 2022


shafik created this revision.
shafik added reviewers: labath, aprantl, JDevlieghere.
Herald added a subscriber: arphaman.
Herald added a project: All.
shafik requested review of this revision.

`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.


https://reviews.llvm.org/D122753

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


Index: lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
===================================================================
--- lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
+++ lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
@@ -282,9 +282,17 @@
     };
 
     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() {}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122753.419223.patch
Type: text/x-patch
Size: 619 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220330/cd6ce9ee/attachment.bin>


More information about the lldb-commits mailing list