[lld] r319355 - Remove `else` or `break` after `fatal`. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 29 12:45:58 PST 2017
Author: ruiu
Date: Wed Nov 29 12:45:58 2017
New Revision: 319355
URL: http://llvm.org/viewvc/llvm-project?rev=319355&view=rev
Log:
Remove `else` or `break` after `fatal`. NFC.
fatal() does not return, so we don't need `else` or `break` after a call
of fatal.
Modified:
lld/trunk/wasm/Writer.cpp
lld/trunk/wasm/WriterUtils.cpp
Modified: lld/trunk/wasm/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Writer.cpp?rev=319355&r1=319354&r2=319355&view=diff
==============================================================================
--- lld/trunk/wasm/Writer.cpp (original)
+++ lld/trunk/wasm/Writer.cpp Wed Nov 29 12:45:58 2017
@@ -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();
}
}
}
Modified: lld/trunk/wasm/WriterUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/WriterUtils.cpp?rev=319355&r1=319354&r2=319355&view=diff
==============================================================================
--- lld/trunk/wasm/WriterUtils.cpp (original)
+++ lld/trunk/wasm/WriterUtils.cpp Wed Nov 29 12:45:58 2017
@@ -112,7 +112,6 @@ void wasm::writeInitExpr(raw_ostream &OS
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,
break;
default:
fatal("unsupported import type: " + Twine(Import.Kind));
- break;
}
}
@@ -166,7 +164,6 @@ void wasm::writeExport(raw_ostream &OS,
break;
default:
fatal("unsupported export type: " + Twine(Export.Kind));
- break;
}
}
More information about the llvm-commits
mailing list