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

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 01:28:43 PDT 2019


Author: grimar
Date: Thu Sep  5 01:28:43 2019
New Revision: 371023

URL: http://llvm.org/viewvc/llvm-project?rev=371023&view=rev
Log:
[lib/ObjectYAML] - Stop calling error(1) when mapping the st_other field of a symbol.

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.

Differential revision: https://reviews.llvm.org/D67150

Modified:
    llvm/trunk/lib/ObjectYAML/ELFYAML.cpp
    llvm/trunk/test/tools/yaml2obj/elf-symbol-stother.yaml

Modified: llvm/trunk/lib/ObjectYAML/ELFYAML.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/ELFYAML.cpp?rev=371023&r1=371022&r2=371023&view=diff
==============================================================================
--- llvm/trunk/lib/ObjectYAML/ELFYAML.cpp (original)
+++ llvm/trunk/lib/ObjectYAML/ELFYAML.cpp Thu Sep  5 01:28:43 2019
@@ -894,10 +894,8 @@ struct NormalizedOther {
     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 &) {
@@ -942,7 +940,7 @@ struct NormalizedOther {
     return Map;
   }
 
-  const IO &YamlIO;
+  IO &YamlIO;
   Optional<std::vector<StOtherPiece>> Other;
   std::string UnknownFlagsHolder;
 };

Modified: llvm/trunk/test/tools/yaml2obj/elf-symbol-stother.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/yaml2obj/elf-symbol-stother.yaml?rev=371023&r1=371022&r2=371023&view=diff
==============================================================================
--- llvm/trunk/test/tools/yaml2obj/elf-symbol-stother.yaml (original)
+++ llvm/trunk/test/tools/yaml2obj/elf-symbol-stother.yaml Thu Sep  5 01:28:43 2019
@@ -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:




More information about the llvm-commits mailing list