[PATCH] D85437: [DebugInfo] Fix initialization of DwarfCompileUnit::LabelBegin.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 7 12:13:21 PDT 2020


dblaikie added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:60
   /// The start of the unit within its section.
-  MCSymbol *LabelBegin;
+  MCSymbol *LabelBegin = nullptr;
 
----------------
ikudrin wrote:
> dblaikie wrote:
> > Is this used before its initialization - generally nice not to prematurely initiliaze things, because it thwarts checking like msan that might find bugs if this isn't intended to be used until after some other initialization.
> `LabelBegin` is initialized under a condition, not in the constructor, thus, it can be left uninitialized. If we rely on MSan, the `assert` in `getLabelBegin()` is useless and vice versa.
Fair enough - thanks for the explanation!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85437/new/

https://reviews.llvm.org/D85437



More information about the llvm-commits mailing list