Remove safeguard from RoundTripYAML pass.

RoundTripYAML pass is removed from the regular execution pass in r204296,
so the safeguard to protect it from OOM error is no longer needed, because
we are sure that the pass is only used for tests, and test files are all
small.

We also want to see RoundTripYAML pass to fail in tests if it fails,
rather than silently skipping failing tests.

llvm-svn: 204772
This commit is contained in:
Rui Ueyama 2014-03-26 00:21:11 +00:00
parent 85a8491a93
commit ad386648b8
1 changed files with 6 additions and 14 deletions

View File

@ -18,11 +18,6 @@
#include <memory>
// Skip YAML files larger than this to avoid OOM error. The YAML reader consumes
// excessively large amount of memory when parsing a large file.
// TODO: Fix the YAML reader to reduce memory footprint.
static const size_t MAX_YAML_FILE_SIZE = 50 * 1024 * 1024;
using namespace lld;
/// Perform the actual pass
@ -45,15 +40,12 @@ void RoundTripYAMLPass::perform(std::unique_ptr<MutableFile> &mergedFile) {
if (MemoryBuffer::getFile(tmpYAMLFile.str(), mb))
return;
if (mb->getBufferSize() < MAX_YAML_FILE_SIZE) {
error_code ec = _context.registry().parseFile(mb, _yamlFile);
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));
error_code ec = _context.registry().parseFile(mb, _yamlFile);
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());
}