llvm-project/lldb/source/Plugins/Language/ObjC
Tim Hammerquist 95c003b96f switch on enum should be exhaustive and warning-free
Summary:
Testing the value of type_code against the closed enum TypeCodes
provides statically verifiable completeness of testing. However, one
branch assigns to type_code by casting directly from a masked integer
value. This is currently handled by adding a default: case after
checking each TypeCodes instance. This patch introduces a bool variable
containing the "default" state value, allowing the switch to be
exhaustive, protect against future instances not being handled in the
switch, and preserves the original logic.

This addresses the warning:
warning: default label in switch which covers all enumeration values
[-Wcovered-switch-default]

As an issue of maintainability, the bitmask on line 524 handles the
current values of TypeCodes enum, but this will be invalid if the enum
is extended. This patch does not address this, and a more closed
conversion from cfinfoa -> TypeCodes would help protect against this.

Reviewers: spyffe, lhames, sas

Reviewed By: sas

Subscribers: sas, lldb-commits

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

llvm-svn: 307712
2017-07-11 21:06:20 +00:00
..
CF.cpp Rename Error -> Status. 2017-05-12 04:51:55 +00:00
CF.h Move classes from Core -> Utility. 2017-02-02 21:39:50 +00:00
CMakeLists.txt [CMake] [2/4] Update a batch of plugins 2017-01-31 22:23:49 +00:00
Cocoa.cpp switch on enum should be exhaustive and warning-free 2017-07-11 21:06:20 +00:00
Cocoa.h Move classes from Core -> Utility. 2017-02-02 21:39:50 +00:00
CoreMedia.cpp Remove dependencies from Utility to Core and Target. 2017-02-14 19:06:07 +00:00
CoreMedia.h Move classes from Core -> Utility. 2017-02-02 21:39:50 +00:00
NSArray.cpp Updated the NSArray and NSDictionary formatters to support new storage formats. 2017-06-23 23:15:03 +00:00
NSDictionary.cpp Updated the NSArray and NSDictionary formatters to support new storage formats. 2017-06-23 23:15:03 +00:00
NSDictionary.h Move classes from Core -> Utility. 2017-02-02 21:39:50 +00:00
NSError.cpp Rename Error -> Status. 2017-05-12 04:51:55 +00:00
NSException.cpp Rename Error -> Status. 2017-05-12 04:51:55 +00:00
NSIndexPath.cpp Don't allow direct access to StreamString's internal buffer. 2016-11-16 21:15:24 +00:00
NSSet.cpp [Data formatters] Make NSSetM support both old- and new-style representation 2017-06-30 00:39:17 +00:00
NSSet.h Move classes from Core -> Utility. 2017-02-02 21:39:50 +00:00
NSString.cpp Rename Error -> Status. 2017-05-12 04:51:55 +00:00
NSString.h Move classes from Core -> Utility. 2017-02-02 21:39:50 +00:00
ObjCLanguage.cpp Updated NSNumber formatter for new internal representation. 2017-06-19 18:32:22 +00:00
ObjCLanguage.h Move classes from Core -> Utility. 2017-02-02 21:39:50 +00:00