jingham added inline comments.

================
Comment at: lldb/source/Commands/CommandObjectMultiword.cpp:121-129
+  const char *error_str = nullptr;
+  if (!can_replace)
+    error_str = "sub-command already exists";
+  if (!(*pos).second->IsUserCommand())
+    error_str = "can't replace a builtin subcommand";
+
+  if (error_str) {
----------------
JDevlieghere wrote:
> This inline diff looks more confusing than anything, but basically I just 
> switched the errors around (instead of the current fall-through) and return 
> the error immediately. 
This isn't an early return vrs. not early return thing, since the if's are just 
deciding which error to print, then we return directly if there was an error.

TTTT, I like my version better.  Your version hides the error message in the 
middle of two copies of all the llvm::createStringError goo, which makes it 
much harder to read, IMO.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110298

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to