[llvm] d400606 - [DebugInfo] Fix initialization of DwarfCompileUnit::LabelBegin.

Igor Kudrin via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 10 02:19:39 PDT 2020


Author: Igor Kudrin
Date: 2020-08-10T15:57:21+07:00
New Revision: d400606f8cb2474a436df42d7d6c897ba6c9c4ee

URL: https://github.com/llvm/llvm-project/commit/d400606f8cb2474a436df42d7d6c897ba6c9c4ee
DIFF: https://github.com/llvm/llvm-project/commit/d400606f8cb2474a436df42d7d6c897ba6c9c4ee.diff

LOG: [DebugInfo] Fix initialization of DwarfCompileUnit::LabelBegin.

This also fixes the condition in the assertion in
DwarfCompileUnit::getLabelBegin() because it checked something unrelated
to the returned value.

Differential Revision: https://reviews.llvm.org/D85437

Added: 
    

Modified: 
    llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
index 85aee2307e06..78015897408d 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
@@ -57,7 +57,7 @@ class DwarfCompileUnit final : public DwarfUnit {
   DwarfCompileUnit *Skeleton = nullptr;
 
   /// The start of the unit within its section.
-  MCSymbol *LabelBegin;
+  MCSymbol *LabelBegin = nullptr;
 
   /// The start of the unit macro info within macro section.
   MCSymbol *MacroLabelBegin;
@@ -299,7 +299,7 @@ class DwarfCompileUnit final : public DwarfUnit {
   void addAddrTableBase();
 
   MCSymbol *getLabelBegin() const {
-    assert(getSection());
+    assert(LabelBegin && "LabelBegin is not initialized");
     return LabelBegin;
   }
 


        


More information about the llvm-commits mailing list