[PATCH] D142003: [llvm-objdump] Fix reporting error for processing target features

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 18 04:04:36 PST 2023


foad added inline comments.


================
Comment at: llvm/lib/Support/RISCVISAInfo.cpp:706
 
-      if (!IgnoreUnknown && Name.size() == Type.size()) {
-        if (IgnoreUnknown)
-          continue;
+      if (!IgnoreUnknown && Name.size() == Type.size())
         return createStringError(errc::invalid_argument,
----------------
Nit: I think the usual style is to keep the braces if the body of the "if" is more than one physical line, even though it is a single statement.


================
Comment at: llvm/tools/llvm-objdump/llvm-objdump.cpp:2014
   if (!FeaturesValue)
-    WithColor::error(errs(), ToolName) << FeaturesValue.takeError();
+    reportError(Obj->getFileName(), toString(FeaturesValue.takeError()));
   SubtargetFeatures Features = *FeaturesValue;
----------------
Could be `reportError(FeaturesValue.takeError(), Obj->getFileName())`?

Is it possible to write a test for this error message?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142003/new/

https://reviews.llvm.org/D142003



More information about the llvm-commits mailing list