From e48f223ed682147f714c2d1da21db07e25403f60 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Wed, 29 Nov 2017 20:45:58 +0000 Subject: [PATCH] Remove `else` or `break` after `fatal`. NFC. fatal() does not return, so we don't need `else` or `break` after a call of fatal. llvm-svn: 319355 --- lld/wasm/Writer.cpp | 18 ++++++++---------- lld/wasm/WriterUtils.cpp | 3 --- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp index 301326ba375a..fa9c0df6a05c 100644 --- a/lld/wasm/Writer.cpp +++ b/lld/wasm/Writer.cpp @@ -602,17 +602,15 @@ void Writer::calculateOffsets() { // Elem uint32_t SegmentCount = WasmFile->elements().size(); if (SegmentCount) { - if (SegmentCount > 1) { + if (SegmentCount > 1) fatal(File->getName() + ": contains more than element segment"); - } else { - const WasmElemSegment &Segment = WasmFile->elements()[0]; - if (Segment.TableIndex != 0) - fatal(File->getName() + ": unsupported table index"); - else if (Segment.Offset.Value.Int32 != 0) - fatal(File->getName() + ": unsupported segment offset"); - else - NumElements += Segment.Functions.size(); - } + + const WasmElemSegment &Segment = WasmFile->elements()[0]; + if (Segment.TableIndex != 0) + fatal(File->getName() + ": unsupported table index"); + if (Segment.Offset.Value.Int32 != 0) + fatal(File->getName() + ": unsupported segment offset"); + NumElements += Segment.Functions.size(); } } } diff --git a/lld/wasm/WriterUtils.cpp b/lld/wasm/WriterUtils.cpp index 882f4498656e..e3be081b3add 100644 --- a/lld/wasm/WriterUtils.cpp +++ b/lld/wasm/WriterUtils.cpp @@ -112,7 +112,6 @@ void wasm::writeInitExpr(raw_ostream &OS, const WasmInitExpr &InitExpr) { break; default: fatal("unknown opcode in init expr: " + Twine(InitExpr.Opcode)); - break; } writeU8(OS, WASM_OPCODE_END, "opcode:end"); } @@ -147,7 +146,6 @@ void wasm::writeImport(raw_ostream &OS, const WasmImport &Import) { break; default: fatal("unsupported import type: " + Twine(Import.Kind)); - break; } } @@ -166,7 +164,6 @@ void wasm::writeExport(raw_ostream &OS, const WasmExport &Export) { break; default: fatal("unsupported export type: " + Twine(Export.Kind)); - break; } }