[llvm] 1262cf7 - Fix incorrect fallthrough in e4eb6216c2e
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 6 15:41:59 PST 2021
Author: Nico Weber
Date: 2021-12-06T18:41:52-05:00
New Revision: 1262cf7f045fd8255f433a3335265fe3bb65c9c4
URL: https://github.com/llvm/llvm-project/commit/1262cf7f045fd8255f433a3335265fe3bb65c9c4
DIFF: https://github.com/llvm/llvm-project/commit/1262cf7f045fd8255f433a3335265fe3bb65c9c4.diff
LOG: Fix incorrect fallthrough in e4eb6216c2e
Added:
Modified:
llvm/lib/DebugInfo/MSF/MSFBuilder.cpp
Removed:
################################################################################
diff --git a/llvm/lib/DebugInfo/MSF/MSFBuilder.cpp b/llvm/lib/DebugInfo/MSF/MSFBuilder.cpp
index 437d9e1b53ea..8e4805962a8c 100644
--- a/llvm/lib/DebugInfo/MSF/MSFBuilder.cpp
+++ b/llvm/lib/DebugInfo/MSF/MSFBuilder.cpp
@@ -345,17 +345,18 @@ Expected<FileBufferByteStream> MSFBuilder::commit(StringRef Path,
uint64_t FileSize = uint64_t(Layout.SB->BlockSize) * Layout.SB->NumBlocks;
// Ensure that the file size is under the limit for the specified block size.
if (FileSize > getMaxFileSizeFromBlockSize(Layout.SB->BlockSize)) {
- msf_error_code error_code;
- switch (Layout.SB->BlockSize) {
- case 8192:
- error_code = msf_error_code::size_overflow_8192;
- case 16384:
- error_code = msf_error_code::size_overflow_16384;
- case 32768:
- error_code = msf_error_code::size_overflow_32768;
- default:
- error_code = msf_error_code::size_overflow_4096;
- }
+ msf_error_code error_code = [](uint32_t BlockSize) {
+ switch (BlockSize) {
+ case 8192:
+ return msf_error_code::size_overflow_8192;
+ case 16384:
+ return msf_error_code::size_overflow_16384;
+ case 32768:
+ return msf_error_code::size_overflow_32768;
+ default:
+ return msf_error_code::size_overflow_4096;
+ }
+ }(Layout.SB->BlockSize);
return make_error<MSFError>(
error_code,
More information about the llvm-commits
mailing list