[llvm] 49e20c4 - [RISCV] Consume error from parsing attributes section
Jessica Clarke via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 10 07:06:21 PDT 2020
Author: Jessica Clarke
Date: 2020-04-10T15:05:53+01:00
New Revision: 49e20c4c9efe1c0e74f9c0dc224a8014b93faa3c
URL: https://github.com/llvm/llvm-project/commit/49e20c4c9efe1c0e74f9c0dc224a8014b93faa3c
DIFF: https://github.com/llvm/llvm-project/commit/49e20c4c9efe1c0e74f9c0dc224a8014b93faa3c.diff
LOG: [RISCV] Consume error from parsing attributes section
Summary:
We don't consume the error from getBuildAttributes, so an assertions
build crashes with "Program aborted due to an unhandled Error:".
Explicitly consume it like the ARM version in that case.
Reviewers: asb, jhenderson, MaskRay, HsiangKai
Reviewed By: MaskRay
Subscribers: kristof.beyls, hiraditya, simoncook, kito-cheng, shiva0217, rogfer01, rkruppe, psnobl, benna, Jim, lenary, s.egerton, sameer.abuasal, luismarques, evandro, danielkiss, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77841
Added:
Modified:
llvm/lib/Object/ELFObjectFile.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp
index 8627d1b3751b..c919d25855d2 100644
--- a/llvm/lib/Object/ELFObjectFile.cpp
+++ b/llvm/lib/Object/ELFObjectFile.cpp
@@ -297,8 +297,11 @@ SubtargetFeatures ELFObjectFileBase::getRISCVFeatures() const {
// Add features according to the ELF attribute section.
// If there are any unrecognized features, ignore them.
RISCVAttributeParser Attributes;
- if (Error E = getBuildAttributes(Attributes))
+ if (Error E = getBuildAttributes(Attributes)) {
+ // TODO Propagate Error.
+ consumeError(std::move(E));
return Features; // Keep "c" feature if there is one in PlatformFlags.
+ }
Optional<StringRef> Attr = Attributes.getAttributeString(RISCVAttrs::ARCH);
if (Attr.hasValue()) {
More information about the llvm-commits
mailing list