summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorTim Hammerquist <penryu@apple.com>2017-07-11 21:06:20 +0000
committerTim Hammerquist <penryu@apple.com>2017-07-11 21:06:20 +0000
commit95c003b96f12eab0d1d60aa7240e8a7da489ad85 (patch)
tree008404c5a445286ff819bd3f3bd08db32e9dccba /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent93cf9b4f91386b63ba7c3a1e902e91c110108f2d (diff)
downloadbcm5719-llvm-95c003b96f12eab0d1d60aa7240e8a7da489ad85.tar.gz
bcm5719-llvm-95c003b96f12eab0d1d60aa7240e8a7da489ad85.zip
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
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud