[lib/ObjectYAML] - Change interface to return `bool` instead of `int`. NFCI
It was suggested in comments for D67445 to split this part.
Differential revision: https://reviews.llvm.org/D67488
llvm-svn: 371828
diff --git a/llvm/lib/ObjectYAML/WasmEmitter.cpp b/llvm/lib/ObjectYAML/WasmEmitter.cpp
index 5769d7b..28d469c 100644
--- a/llvm/lib/ObjectYAML/WasmEmitter.cpp
+++ b/llvm/lib/ObjectYAML/WasmEmitter.cpp
@@ -26,7 +26,7 @@
class WasmWriter {
public:
WasmWriter(WasmYAML::Object &Obj) : Obj(Obj) {}
- int writeWasm(raw_ostream &OS);
+ bool writeWasm(raw_ostream &OS);
private:
int writeRelocSection(raw_ostream &OS, WasmYAML::Section &Sec,
@@ -563,7 +563,7 @@
return 0;
}
-int WasmWriter::writeWasm(raw_ostream &OS) {
+bool WasmWriter::writeWasm(raw_ostream &OS) {
// Write headers
OS.write(wasm::WasmMagic, sizeof(wasm::WasmMagic));
writeUint32(OS, Obj.Header.Version);
@@ -576,7 +576,7 @@
SecName = S->Name;
if (!Checker.isValidSectionOrder(Sec->Type, SecName)) {
errs() << "Out of order section type: " << Sec->Type << "\n";
- return 1;
+ return false;
}
encodeULEB128(Sec->Type, OS);
std::string OutString;
@@ -625,7 +625,7 @@
return Err;
} else {
errs() << "Unknown section type: " << Sec->Type << "\n";
- return 1;
+ return false;
}
StringStream.flush();
@@ -652,15 +652,14 @@
OS << OutString;
}
- return 0;
+ return true;
}
namespace llvm {
namespace yaml {
-int yaml2wasm(WasmYAML::Object &Doc, raw_ostream &Out) {
+bool yaml2wasm(WasmYAML::Object &Doc, raw_ostream &Out) {
WasmWriter Writer(Doc);
-
return Writer.writeWasm(Out);
}