[Lldb-commits] [PATCH] D113155: [lldb] Remove nested switches from ARMGetSupportedArchitectureAtIndex (NFC)

Slava Gurevich via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 5 20:56:32 PDT 2022


fixathon added inline comments.


================
Comment at: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp:640
+  }
+  return {};
+}
----------------
JDevlieghere wrote:
> fixathon wrote:
> > JDevlieghere wrote:
> > > fixathon wrote:
> > > > Could we delete this unreachable return statement?  It's tripping up static code checkers since all possible branches already have a return.
> > > Yes, let's make it an `llvm_unreachable` (otherwise gcc will complain).
> > If we return {} in the **default** case, and delete this,  gcc should not complain since all possible code paths will have a return, is that right?
> > Alternatively, we could break in the **default** case and leave this return alone. I prefer the first approach for consistency.
> Yes, you're right, it's only a problem for gcc when you explicitly handle every case (see all the instances of `llvm_unreachable("Fully covered switch!");` in lldb/llvm). 
I'll just add a break to the default case to avoid llvm_unreachable(). What's the best way to introduce this change? Can I link it to this diff somehow or a stand-alone new diff?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113155/new/

https://reviews.llvm.org/D113155



More information about the lldb-commits mailing list