[PATCH] D142003: [llvm-objdump] Fix reporting error for processing target features
Elena Lepilkina via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 18 03:10:47 PST 2023
eklepilkina created this revision.
Herald added subscribers: luke, frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya.
Herald added a reviewer: jhenderson.
Herald added a reviewer: MaskRay.
Herald added a project: All.
eklepilkina requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D142003
Files:
llvm/lib/Support/RISCVISAInfo.cpp
llvm/tools/llvm-objdump/llvm-objdump.cpp
Index: llvm/tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -2011,7 +2011,7 @@
// Package up features to be passed to target/subtarget
Expected<SubtargetFeatures> FeaturesValue = Obj->getFeatures();
if (!FeaturesValue)
- WithColor::error(errs(), ToolName) << FeaturesValue.takeError();
+ reportError(Obj->getFileName(), toString(FeaturesValue.takeError()));
SubtargetFeatures Features = *FeaturesValue;
if (!MAttrs.empty()) {
for (unsigned I = 0; I != MAttrs.size(); ++I)
Index: llvm/lib/Support/RISCVISAInfo.cpp
===================================================================
--- llvm/lib/Support/RISCVISAInfo.cpp
+++ llvm/lib/Support/RISCVISAInfo.cpp
@@ -703,13 +703,10 @@
Desc.str().c_str(), Ext.str().c_str());
}
- if (!IgnoreUnknown && Name.size() == Type.size()) {
- if (IgnoreUnknown)
- continue;
+ if (!IgnoreUnknown && Name.size() == Type.size())
return createStringError(errc::invalid_argument,
"%s name missing after '%s'",
Desc.str().c_str(), Type.str().c_str());
- }
unsigned Major, Minor, ConsumeLength;
if (auto E = getExtensionVersion(Name, Vers, Major, Minor, ConsumeLength,
@@ -723,12 +720,9 @@
}
// Check if duplicated extension.
- if (!IgnoreUnknown && llvm::is_contained(AllExts, Name)) {
- if (IgnoreUnknown)
- continue;
+ if (!IgnoreUnknown && llvm::is_contained(AllExts, Name))
return createStringError(errc::invalid_argument, "duplicated %s '%s'",
Desc.str().c_str(), Name.str().c_str());
- }
ISAInfo->addExtension(Name, Major, Minor);
// Extension format is correct, keep parsing the extensions.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142003.490095.patch
Type: text/x-patch
Size: 1974 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230118/246f92e1/attachment.bin>
More information about the llvm-commits
mailing list