[Bug 47089] New: The use of if (Condition) {...} else if (Condition) {...} pattern should be avoided.(llvm-project/lldb/source/Plugins/Language/ObjC/NSArray.cpp:line 826)

Bug ID 47089
Summary The use of if (Condition) {…} else if (Condition) {…} pattern should be avoided.(llvm-project/lldb/source/Plugins/Language/ObjC/NSArray.cpp:line 826)
Product lldb
Version unspecified
Hardware All
OS All
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter info@ustchcs.com
CC jdevlieghere@apple.com, llvm-bugs@lists.llvm.org

The use of if (Condition) {...} else if (Condition) {...} pattern should be
avoided.
Code on line 827 cannot be executed.

commit e3546c78cabfbf670391a57766872f0a8e28a423

llvm-project/lldb/source/Plugins/Language/ObjC/NSArray.cpp:line 826

   814    if (class_name == g_NSArrayI) {
   815      if (runtime->GetFoundationVersion() >= 1436)
   816        return (new
Foundation1436::NSArrayISyntheticFrontEnd(valobj_sp));
   817      if (runtime->GetFoundationVersion() >= 1430)
   818        return (new
Foundation1430::NSArrayISyntheticFrontEnd(valobj_sp));
   819      else
   820        return (new
Foundation1300::NSArrayISyntheticFrontEnd(valobj_sp));
   821    } else if (class_name == g_NSArrayI_Transfer) {
   822        return (new
Foundation1436::NSArrayI_TransferSyntheticFrontEnd(valobj_sp));
   823    } else if (class_name == g_NSArray0) {
   824    } else if (class_name == g_NSFrozenArrayM) {
   825      return (new
Foundation1436::NSFrozenArrayMSyntheticFrontEnd(valobj_sp));
   826    } else if (class_name == g_NSArray0) {
   827      return (new NSArray0SyntheticFrontEnd(valobj_sp));

Reported by: Ustchcs Toolsets Bugfinder
(bugfinder-2.2: The use of if (Condition) {...} else if (Condition) {...}
pattern should be avoided.)

Jonas Devlieghere changed bug 47089

What Removed Added
Status NEW RESOLVED
Resolution FIXED

Comment # 1 on bug 47089 from Jonas Devlieghere

commit b8ff0daeac0752689ffca9345686845d1b7cfed8
Author: Jonas Devlieghere <[jonas@devlieghere.com](mailto:jonas@devlieghere.com)>

    [lldb] Fix NSArray0 data formatter and add test

    Fixes PR47089