[PATCH] D67150: [lib/ObjectYAML] - Stop calling error(1) when mapping the st_other field of a symbol.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 4 03:31:41 PDT 2019


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
grimar updated this revision to Diff 218634.
grimar added a comment.

- Remove ' \n' from the error message.


This eliminates one of the `error(1)` call in this lib.
It is different from the others because happens on a fields mapping stage
and can be easily fixed.


https://reviews.llvm.org/D67150

Files:
  lib/ObjectYAML/ELFYAML.cpp
  test/tools/yaml2obj/elf-symbol-stother.yaml


Index: test/tools/yaml2obj/elf-symbol-stother.yaml
===================================================================
--- test/tools/yaml2obj/elf-symbol-stother.yaml
+++ test/tools/yaml2obj/elf-symbol-stother.yaml
@@ -4,7 +4,7 @@
 ## to a different machine type to what is specified by the YAML.
 
 # RUN: not yaml2obj --docnum=1 2>&1 %s | FileCheck %s --check-prefix=ERR
-# ERR: error: an unknown value is used for symbol's 'Other' field: STO_MIPS_OPTIONAL.
+# ERR: error: an unknown value is used for symbol's 'Other' field: STO_MIPS_OPTIONAL
 
 --- !ELF
 FileHeader:
Index: lib/ObjectYAML/ELFYAML.cpp
===================================================================
--- lib/ObjectYAML/ELFYAML.cpp
+++ lib/ObjectYAML/ELFYAML.cpp
@@ -892,10 +892,8 @@
     if (to_integer(Name, Val))
       return Val;
 
-    llvm::WithColor::error()
-        << "an unknown value is used for symbol's 'Other' field: " << Name
-        << ".\n";
-    exit(1);
+    YamlIO.setError("an unknown value is used for symbol's 'Other' field: " +
+                    Name);
   }
 
   Optional<uint8_t> denormalize(IO &) {
@@ -940,7 +938,7 @@
     return Map;
   }
 
-  const IO &YamlIO;
+  IO &YamlIO;
   Optional<std::vector<StOtherPiece>> Other;
   std::string UnknownFlagsHolder;
 };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67150.218634.patch
Type: text/x-patch
Size: 1268 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190904/21a3db2c/attachment.bin>


More information about the llvm-commits mailing list