Page MenuHomePhabricator

ELF: Do not treat errors in InputFiles class as fatal errors.
Needs ReviewPublic

Authored by ruiu on Jan 27 2016, 6:28 PM.

Details

Reviewers
espindola
Summary

This file is not as easy to handle errors as the driver or the
symbol table because of the nature of file IO. However, I think
this patch is not as horrible as I expected; I'm fairly satisfied
with this change. If we find an error, we call error() to record
the error, and return a zero value. Zero value is an empty
vector for the vector, nullptr for a pointer, or an empty string
for the StringRef. Callers gracefully handle such values.

In some cases, we don't have good zero values. I changed the
type of such functions so that they return a boolean value.

All changes are mechanical and should not change the existing
behavior.

Diff Detail

Event Timeline

ruiu updated this revision to Diff 46207.Jan 27 2016, 6:28 PM
ruiu retitled this revision from to ELF: Do not treat errors in InputFiles class as fatal errors..
ruiu updated this object.
ruiu added a reviewer: rafael.
ruiu added a subscriber: llvm-commits.
rafael edited edge metadata.Feb 1 2016, 5:30 AM

First thing: testcase? :-)

rafael added inline comments.Feb 1 2016, 5:33 AM
ELF/InputFiles.cpp
213

It looks like most of this patch is converting uses of fatal that can only be reached with broken files.

I don't see the point of supporting some broken files but not others, and I don't think this will scale to supporting all.

espindola edited reviewers, added: espindola; removed: rafael.Mar 15 2018, 10:54 AM