forked from OSchip/llvm-project
Use early returns.
No functionality change. llvm-svn: 183659
This commit is contained in:
parent
bac917f383
commit
4cdc6c14ed
|
@ -98,16 +98,19 @@ ELFTargetInfo::parseFile(std::unique_ptr<MemoryBuffer> &mb,
|
|||
std::vector<std::unique_ptr<File> > &result) const {
|
||||
ScopedTask task(getDefaultDomain(), "parseFile");
|
||||
error_code ec = _elfReader->parseFile(mb, result);
|
||||
if (ec) {
|
||||
// Not an ELF file, check file extension to see if it might be yaml
|
||||
StringRef path = mb->getBufferIdentifier();
|
||||
if (path.endswith(".objtxt"))
|
||||
ec = _yamlReader->parseFile(mb, result);
|
||||
if (ec)
|
||||
// Not a yaml file, assume it is a linkerscript
|
||||
ec = _linkerScriptReader->parseFile(mb, result);
|
||||
if (!ec)
|
||||
return ec;
|
||||
|
||||
// Not an ELF file, check file extension to see if it might be yaml
|
||||
StringRef path = mb->getBufferIdentifier();
|
||||
if (path.endswith(".objtxt")) {
|
||||
ec = _yamlReader->parseFile(mb, result);
|
||||
if (!ec)
|
||||
return ec;
|
||||
}
|
||||
return ec;
|
||||
|
||||
// Not a yaml file, assume it is a linkerscript
|
||||
return _linkerScriptReader->parseFile(mb, result);
|
||||
}
|
||||
|
||||
Writer &ELFTargetInfo::writer() const {
|
||||
|
|
Loading…
Reference in New Issue