llvm-project/lldb/source
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
..
API Move Timer and TraceOptions from Core to Utility 2017-06-29 14:32:17 +00:00
Breakpoint Fix error string set in AddName to take a StringRef. 2017-05-17 17:48:55 +00:00
Commands Fix assorted compiler warnings (mismatched signedness and printf specifiers) 2017-07-05 14:54:46 +00:00
Core Pass in the disassembler flavor when disassembling in 2017-07-11 04:22:31 +00:00
DataFormatters Use exact equality for category language matching, for all languages, except those specifically mentioned. 2017-06-06 20:40:24 +00:00
Expression Rename Error -> Status. 2017-05-12 04:51:55 +00:00
Host Add a NativeProcessProtocol Factory class 2017-07-07 11:02:19 +00:00
Initialization Move Timer and TraceOptions from Core to Utility 2017-06-29 14:32:17 +00:00
Interpreter Move Timer and TraceOptions from Core to Utility 2017-06-29 14:32:17 +00:00
Plugins switch on enum should be exhaustive and warning-free 2017-07-11 21:06:20 +00:00
Symbol Move Timer and TraceOptions from Core to Utility 2017-06-29 14:32:17 +00:00
Target Move Timer and TraceOptions from Core to Utility 2017-06-29 14:32:17 +00:00
Utility Move Timer and TraceOptions from Core to Utility 2017-06-29 14:32:17 +00:00
CMakeLists.txt Remove Plugins/Process/POSIX from include_directories 2017-04-11 12:26:25 +00:00
lldb.cpp One more cleanup to lldb version printing 2016-11-14 22:43:08 +00:00