summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-11-14 07:26:17 +0000
committerEric Fiselier <eric@efcs.ca>2016-11-14 07:26:17 +0000
commitc79c9d8536b8d4f780afca4d0c2bbf5d4be6db3d (patch)
tree48cd341258676d8f65599997296fc69f92588d7e
parente95fc44ce594c80af76883a0398630d1865dea12 (diff)
downloadbcm5719-llvm-c79c9d8536b8d4f780afca4d0c2bbf5d4be6db3d.tar.gz
bcm5719-llvm-c79c9d8536b8d4f780afca4d0c2bbf5d4be6db3d.zip
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
-rw-r--r--llvm/include/llvm/DebugInfo/PDB/IPDBSession.h2
-rw-r--r--llvm/lib/Bitcode/Reader/BitReader.cpp4
2 files changed, 4 insertions, 2 deletions
diff --git a/llvm/include/llvm/DebugInfo/PDB/IPDBSession.h b/llvm/include/llvm/DebugInfo/PDB/IPDBSession.h
index 3d2c37eff2e..15e97ac198e 100644
--- a/llvm/include/llvm/DebugInfo/PDB/IPDBSession.h
+++ b/llvm/include/llvm/DebugInfo/PDB/IPDBSession.h
@@ -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);
}
diff --git a/llvm/lib/Bitcode/Reader/BitReader.cpp b/llvm/lib/Bitcode/Reader/BitReader.cpp
index 63854307b7b..f64785b3ad9 100644
--- a/llvm/lib/Bitcode/Reader/BitReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitReader.cpp
@@ -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;
OpenPOWER on IntegriCloud