[PATCH] D85293: [DebugInfo] Simplify DIEInteger::SizeOf(). NFCI.

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 5 04:44:43 PDT 2020


ikudrin created this revision.
ikudrin added reviewers: labath, jhenderson, dblaikie, JDevlieghere.
ikudrin added projects: LLVM, debug-info.
Herald added a subscriber: hiraditya.
ikudrin requested review of this revision.

An `AsmPrinter` is always passed to the method, therefore there is no need to check it.

Note that the check was added in D44418 <https://reviews.llvm.org/D44418> and before that revision `AP` was used in the method unconditionally.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85293

Files:
  llvm/lib/CodeGen/AsmPrinter/DIE.cpp


Index: llvm/lib/CodeGen/AsmPrinter/DIE.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DIE.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DIE.cpp
@@ -430,10 +430,10 @@
 /// SizeOf - Determine size of integer value in bytes.
 ///
 unsigned DIEInteger::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
-  dwarf::FormParams Params = {0, 0, dwarf::DWARF32};
-  if (AP)
-    Params = {AP->getDwarfVersion(), uint8_t(AP->getPointerSize()),
-              AP->OutStreamer->getContext().getDwarfFormat()};
+  assert(AP && "AsmPrinter is required to set FormParams");
+  dwarf::FormParams Params = {AP->getDwarfVersion(),
+                              uint8_t(AP->getPointerSize()),
+                              AP->OutStreamer->getContext().getDwarfFormat()};
 
   if (Optional<uint8_t> FixedSize = dwarf::getFixedFormByteSize(Form, Params))
     return *FixedSize;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85293.283194.patch
Type: text/x-patch
Size: 912 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200805/260d192a/attachment-0001.bin>


More information about the llvm-commits mailing list