[llvm] [SystemZ][z/OS] yaml2obj GOFF symbols (PR #75971)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 15 02:06:26 PDT 2024


================
@@ -314,13 +308,11 @@ bool GOFFState::writeObject() {
   if (HasError)
     return false;
   // Iterate over all records.
-  for (auto &Rec : Doc.Records) {
-    if (auto *Sym = dyn_cast<GOFFYAML::Symbol>(Rec.get())) {
+  for (const std::unique_ptr<llvm::GOFFYAML::RecordBase> &Rec : Doc.Records)
+    if (const auto *Sym = dyn_cast<GOFFYAML::Symbol>(Rec.get()))
       writeSymbol(*Sym);
-    } else {
-      reportError("Unknown record type");
-    }
-  }
+    else
+      reportError("unknown record type");
----------------
jh7370 wrote:

Per the coding standards, more context is needed in the error message: in a large file with many records, how is the user supposed to know which one has the unknown type? You sould include the index and/or the value of the unknown type.

https://github.com/llvm/llvm-project/pull/75971


More information about the llvm-commits mailing list