diff options
author | Fangrui Song <maskray@google.com> | 2020-02-21 11:32:33 -0800 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2020-03-05 10:57:27 -0800 |
commit | 791efb148f28e89a62413bcefd242911c6974ea6 (patch) | |
tree | c3588d41e495b72c3a11d26414f7c7d097c22a01 /llvm/lib/Object/ELFObjectFile.cpp | |
parent | f23df1b2a323094e5a6869ef085f100fd065bc0d (diff) | |
download | llvm-791efb148f28e89a62413bcefd242911c6974ea6.zip llvm-791efb148f28e89a62413bcefd242911c6974ea6.tar.gz llvm-791efb148f28e89a62413bcefd242911c6974ea6.tar.bz2 |
[ARM] Rewrite ARMAttributeParser
* Delete boilerplate
* Change functions to return `Error`
* Test parsing errors
* Update callers of ARMAttributeParser::parse() to check the `Error` return value.
Since this patch touches nearly everything in the file, I apply
http://llvm.org/docs/Proposals/VariableNames.html and change variable
names to lower case.
Reviewed By: compnerd
Differential Revision: https://reviews.llvm.org/D75015
Diffstat (limited to 'llvm/lib/Object/ELFObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/ELFObjectFile.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp index bf6ffd6..855e032 100644 --- a/llvm/lib/Object/ELFObjectFile.cpp +++ b/llvm/lib/Object/ELFObjectFile.cpp @@ -157,8 +157,10 @@ SubtargetFeatures ELFObjectFileBase::getMIPSFeatures() const { SubtargetFeatures ELFObjectFileBase::getARMFeatures() const { SubtargetFeatures Features; ARMAttributeParser Attributes; - if (Error E = getBuildAttributes(Attributes)) + if (Error E = getBuildAttributes(Attributes)) { + consumeError(std::move(E)); return SubtargetFeatures(); + } // both ARMv7-M and R have to support thumb hardware div bool isV7 = false; @@ -305,8 +307,11 @@ void ELFObjectFileBase::setARMSubArch(Triple &TheTriple) const { return; ARMAttributeParser Attributes; - if (Error E = getBuildAttributes(Attributes)) + if (Error E = getBuildAttributes(Attributes)) { + // TODO Propagate Error. + consumeError(std::move(E)); return; + } std::string Triple; // Default to ARM, but use the triple if it's been set. |