Always evaluate the second argument for CHECK() lazily.
This patch is to rename check CHECK and make it a C macro, so that
we can evaluate the second argument lazily.
Differential Revision: https://reviews.llvm.org/D40915
llvm-svn: 319974
diff --git a/lld/wasm/InputFiles.cpp b/lld/wasm/InputFiles.cpp
index c259bdb..90bca13 100644
--- a/lld/wasm/InputFiles.cpp
+++ b/lld/wasm/InputFiles.cpp
@@ -104,7 +104,7 @@
void ObjFile::parse() {
// Parse a memory buffer as a wasm file.
DEBUG(dbgs() << "Parsing object: " << toString(this) << "\n");
- std::unique_ptr<Binary> Bin = check(createBinary(MB), toString(this));
+ std::unique_ptr<Binary> Bin = CHECK(createBinary(MB), toString(this));
auto *Obj = dyn_cast<WasmObjectFile>(Bin.get());
if (!Obj)
@@ -223,7 +223,7 @@
void ArchiveFile::parse() {
// Parse a MemoryBufferRef as an archive file.
DEBUG(dbgs() << "Parsing library: " << toString(this) << "\n");
- File = check(Archive::create(MB), toString(this));
+ File = CHECK(Archive::create(MB), toString(this));
// Read the symbol table to construct Lazy symbols.
int Count = 0;
@@ -236,7 +236,7 @@
void ArchiveFile::addMember(const Archive::Symbol *Sym) {
const Archive::Child &C =
- check(Sym->getMember(),
+ CHECK(Sym->getMember(),
"could not get the member for symbol " + Sym->getName());
// Don't try to load the same member twice (this can happen when members
@@ -248,7 +248,7 @@
DEBUG(dbgs() << "from archive: " << toString(this) << "\n");
MemoryBufferRef MB =
- check(C.getMemoryBufferRef(),
+ CHECK(C.getMemoryBufferRef(),
"could not get the buffer for the member defining symbol " +
Sym->getName());