[llvm] [Object] Beginnings of SFrame parser and dumper (PR #147294)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 15 01:47:02 PDT 2025


================
@@ -6428,6 +6432,55 @@ template <typename ELFT> void ELFDumper<ELFT>::printMemtag() {
   printMemtag(DynamicEntries, AndroidNoteDesc, GlobalDescriptors);
 }
 
+template <typename ELFT>
+void ELFDumper<ELFT>::printSectionsAsSFrame(ArrayRef<std::string> Sections) {
+  constexpr endianness E = ELFT::Endianness;
+  for (object::SectionRef Section :
+       getSectionRefsByNameOrIndex(ObjF, Sections)) {
+    StringRef SectionName = unwrapOrError(FileName, Section.getName());
----------------
jh7370 wrote:

`unwrapOrError` is generally considered deprecated for new code: we should avoid using it because it causes llvm-readobj to abort and prevent dumping any other requested information. Instead, we typically bail out of the specific bit that is being done and report a warning using `reportWarning`. Here, for example, I'd report the warning and simply skip the section.

Same comment goes for other uses of `unwrapOrError` below.

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


More information about the llvm-commits mailing list