[PATCH] D45556: [DebugInfo] Generate DWARF debug information for labels.
Adrian Prantl via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 12 08:47:31 PDT 2018
aprantl added inline comments.
================
Comment at: lib/CodeGen/AsmPrinter/DebugHandlerBase.h:53
+using InlinedLabel =
+ std::pair<const DILabel *, const DILocation *>;
+using LabelInstrMap = MapVector<InlinedLabel, const MachineInstr *>;
----------------
Often it's better for readability to just define a struct with named members so we can access .label and .loc instead of .first and .second.
================
Comment at: lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:490
+/// constructLabelDIE - Construct a DIE for the given DwarfLabel.
+DIE *DwarfCompileUnit::constructLabelDIE(DwarfLabel &DL,
----------------
Please put the doxygen comment on the declaration and don't repeat the function name.
================
Comment at: lib/CodeGen/AsmPrinter/DwarfDebug.cpp:1232
+void DwarfDebug::createConcreteLabel(DwarfCompileUnit &TheCU,
+ LexicalScope &Scope,
----------------
This and the next function looks like it is almost the same code as createConcreteVariable and collectVariableInfo. Could the implementation be shared (see my comment on DwarfLabel)?
================
Comment at: lib/CodeGen/AsmPrinter/DwarfDebug.h:191
+/// Labels are collected from \c DBG_LABEL instructions.
+class DwarfLabel {
+ const DILabel *Label; /// Label Descriptor.
----------------
Could this share a common base with DbgVariable?
================
Comment at: lib/CodeGen/AsmPrinter/DwarfDebug.h:198
+public:
+ // We need MCSymbol information to generate DW_AT_low_pc.
+ DwarfLabel(const DILabel *L, const DILocation *IA, const MCSymbol *Sym)
----------------
///
================
Comment at: lib/CodeGen/AsmPrinter/DwarfDebug.h:202
+
+ // Accessors.
+ const DILabel *getLabel() const { return Label; }
----------------
```
/// @{
/// Accessors.
```
================
Comment at: lib/CodeGen/AsmPrinter/DwarfDebug.h:208
+ DIE *getDIE() const { return TheDIE; }
+ StringRef getName() const { return Label->getName(); }
+
----------------
`/// @}`
================
Comment at: lib/CodeGen/AsmPrinter/DwarfDebug.h:210
+
+ // Translate tag to proper Dwarf tag.
+ dwarf::Tag getTag() const {
----------------
///
Repository:
rL LLVM
https://reviews.llvm.org/D45556
More information about the llvm-commits
mailing list