[PATCH] D85437: [DebugInfo] Fix initialization of DwarfCompileUnit::LabelBegin.
Igor Kudrin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 6 20:03:41 PDT 2020
ikudrin 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;
----------------
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.
================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:302
MCSymbol *getLabelBegin() const {
- assert(getSection());
+ assert(LabelBegin);
return LabelBegin;
----------------
aprantl wrote:
> can you add an `&& "some meaningful message"` to hint at what went wrong?
Nothing more meaningful than "LabelBegin is not initialized" comes to me, but that would be a tautology. Any suggestions?
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