llvm-project/lldb
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
..
cmake cmake: Put PROCESS_VM_READV detection results into Config.h 2017-06-02 12:29:08 +00:00
docs Implementation of remote packets for Trace data. 2017-05-26 11:46:27 +00:00
examples Add an example command to toggle between disassembly-only and source mode. 2017-04-20 21:51:27 +00:00
include/lldb Add a NativeProcessProtocol Factory class 2017-07-07 11:02:19 +00:00
lit Change remaining references to lit.util.capture to use subprocess.check_output. 2017-07-06 21:46:47 +00:00
lldb.xcodeproj Fix Xcode project file for gtest schemes. 2017-07-06 23:25:35 +00:00
lldb.xcworkspace Revert r275223, which committed the wrong thing. 2016-07-12 23:31:42 +00:00
packages/Python/lldbsuite NativeProcessLinux: Fix handling of raise(SIGTRAP) 2017-07-11 10:38:40 +00:00
resources Bump the lldb version # in the xcode project files from 2016-03-15 04:36:11 +00:00
scripts Make scripts/analyze-project-deps.py executable 2017-06-29 13:02:15 +00:00
source switch on enum should be exhaustive and warning-free 2017-07-11 21:06:20 +00:00
test [CMake] Override debugserver to use the build tree on Darwin 2017-03-14 20:04:46 +00:00
third_party/Python/module *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
tools Add a NativeProcessProtocol Factory class 2017-07-07 11:02:19 +00:00
unittests The x86 instruction unwinder can be asked to disassemble non-instruction 2017-07-08 00:12:15 +00:00
utils *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
www Update lldb architecture docs 2017-07-04 12:29:34 +00:00
.arcconfig Upgrade all the .arcconfigs to https. 2016-07-14 13:15:37 +00:00
.clang-format Updated .clang-format rules so bring LLDB in line with LLVM standards. 2016-09-06 17:19:00 +00:00
.gitignore test infra: clear file-charged issues on rerun of file 2016-10-01 00:17:08 +00:00
CMakeLists.txt [CMake] Abstract Config.h generation for Xcode 2017-04-27 16:04:26 +00:00
CODE_OWNERS.txt Greg Clayton is no longer working at Apple, he will continue to 2017-03-01 00:00:45 +00:00
INSTALL.txt Changed builld-llvm.py to use .json files 2017-02-23 02:21:34 +00:00
LICENSE.TXT
use_lldb_suite_root.py *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00