[lld] r197732 - [lld] fix unused variable warning in non-debug builds
Nick Kledzik
kledzik at apple.com
Thu Dec 19 14:29:07 PST 2013
Author: kledzik
Date: Thu Dec 19 16:29:07 2013
New Revision: 197732
URL: http://llvm.org/viewvc/llvm-project?rev=197732&view=rev
Log:
[lld] fix unused variable warning in non-debug builds
Modified:
lld/trunk/lib/Passes/RoundTripNativePass.cpp
lld/trunk/lib/Passes/RoundTripYAMLPass.cpp
Modified: lld/trunk/lib/Passes/RoundTripNativePass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/RoundTripNativePass.cpp?rev=197732&r1=197731&r2=197732&view=diff
==============================================================================
--- lld/trunk/lib/Passes/RoundTripNativePass.cpp (original)
+++ lld/trunk/lib/Passes/RoundTripNativePass.cpp Thu Dec 19 16:29:07 2013
@@ -41,8 +41,11 @@ void RoundTripNativePass::perform(std::u
std::unique_ptr<MemoryBuffer> mb(buff.take());
error_code ec = _context.registry().parseFile(mb, _nativeFile);
- assert(!ec && "native reader not registered");
- File *objFile = _nativeFile[0].get();
+ if (ec) {
+ // Note: we need a way for Passes to report errors.
+ llvm_unreachable("native reader not registered or read error");
+ }
+ File *objFile = _nativeFile[0].get();
mergedFile.reset(new FileToMutable(_context, *objFile));
llvm::sys::fs::remove(tmpNativeFile.str());
Modified: lld/trunk/lib/Passes/RoundTripYAMLPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/RoundTripYAMLPass.cpp?rev=197732&r1=197731&r2=197732&view=diff
==============================================================================
--- lld/trunk/lib/Passes/RoundTripYAMLPass.cpp (original)
+++ lld/trunk/lib/Passes/RoundTripYAMLPass.cpp Thu Dec 19 16:29:07 2013
@@ -46,11 +46,12 @@ void RoundTripYAMLPass::perform(std::uni
if (buff->getBufferSize() < MAX_YAML_FILE_SIZE) {
std::unique_ptr<MemoryBuffer> mb(buff.take());
error_code ec = _context.registry().parseFile(mb, _yamlFile);
- assert(!ec && "yaml reader not registered");
- File *objFile = _yamlFile[0].get();
- const File *obj = dyn_cast<const File>(objFile);
- assert(obj && "yaml generated file is not an relocatable file");
- mergedFile.reset(new FileToMutable(_context, *obj));
+ if (ec) {
+ // Note: we need a way for Passes to report errors.
+ llvm_unreachable("yaml reader not registered or read error");
+ }
+ File *objFile = _yamlFile[0].get();
+ mergedFile.reset(new FileToMutable(_context, *objFile));
}
llvm::sys::fs::remove(tmpYAMLFile.str());
More information about the llvm-commits
mailing list