Add explicit (void) cast to unused unique_ptr::release() results

Summary:
This patch adds explicit `(void)` casts to discarded `release()` calls to suppress -Wunused-result.

This patch fixes *all* warnings are generated as a result of [applying `[[nodiscard]]`  within libc++](https://reviews.llvm.org/D26596).
Similar fixes were applied to Clang in r286796.

Reviewers: chandlerc, dberris

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D26598

llvm-svn: 286797
This commit is contained in:
Eric Fiselier 2016-11-14 07:26:17 +00:00
parent e95fc44ce5
commit c79c9d8536
2 changed files with 4 additions and 2 deletions

View File

@ -40,7 +40,7 @@ public:
T *ConcreteSymbol = dyn_cast<T>(Symbol.get());
if (!ConcreteSymbol)
return nullptr;
Symbol.release();
(void)Symbol.release();
return std::unique_ptr<T>(ConcreteSymbol);
}

View File

@ -84,7 +84,9 @@ LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef,
std::unique_ptr<MemoryBuffer> Owner(unwrap(MemBuf));
Expected<std::unique_ptr<Module>> ModuleOrErr =
getOwningLazyBitcodeModule(std::move(Owner), Ctx);
Owner.release();
// Release the buffer if we didn't take ownership of it since we never owned
// it anyway.
(void)Owner.release();
if (Error Err = ModuleOrErr.takeError()) {
std::string Message;