[PATCH] D48512: [gdb] Add pretty printer for Expected

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 25 10:17:32 PDT 2018


dblaikie added a comment.

Thanks for adding to/improving the GDB pretty printer support! Just a few questions/thoughts to try to understand how this works similarly/differently from other related printers!



================
Comment at: utils/gdb-scripts/prettyprinters.py:134
+    return ('value', val['TStorage'].address.cast(
+        val.type.template_argument(0).pointer()).dereference())
+
----------------
dereference() is done here, but not in the Optional pretty printer below - any idea if there's a reason for that inconsistency? (maybe they're implemented differently in a way that I'm missing/not understanding right now)


================
Comment at: utils/gdb-scripts/prettyprinters.py:137
+  def to_string(self):
+    return 'llvm::Expected<{}>'.format(str(self.val.type.template_argument(0)))
+
----------------
llvm::Optional pretty printer doesn't include the template argument (& neither does the built-in std::vector printer, I think?). Probably, for consistency & to avoid being overly verbose, do similarly here & skip the template argument?


Repository:
  rL LLVM

https://reviews.llvm.org/D48512





More information about the llvm-commits mailing list