diff --git a/llvm/lib/ObjectYAML/ELFEmitter.cpp b/llvm/lib/ObjectYAML/ELFEmitter.cpp --- a/llvm/lib/ObjectYAML/ELFEmitter.cpp +++ b/llvm/lib/ObjectYAML/ELFEmitter.cpp @@ -51,7 +51,7 @@ raw_svector_ostream OS; Error ReachedLimitErr = Error::success(); - bool checkLimit(uint64_t Size) { + [[nodiscard]] bool checkLimit(uint64_t Size) { if (!ReachedLimitErr && getOffset() + Size <= MaxSize) return true; if (!ReachedLimitErr) @@ -70,7 +70,7 @@ Error takeLimitError() { // Request to write 0 bytes to check we did not reach the limit. - checkLimit(0); + (void)checkLimit(0); return std::move(ReachedLimitErr); }