index 370ecbf831ea37f4ab4ded25534da61a4b8204ea..d82087376638ec28a41d5f176dd3431bf2bebd10 100644 (file)
#include "DwarfDebug.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Optional.h"
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringMap.h"
-#include "llvm/DebugInfo.h"
+#include "llvm/IR/DIBuilder.h"
+#include "llvm/IR/DebugInfo.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCSection.h"
DICompileUnit CUNode;
/// Unit debug information entry.
- const OwningPtr<DIE> UnitDie;
+ const std::unique_ptr<DIE> UnitDie;
/// Offset of the UnitDie from beginning of debug info section.
unsigned DebugInfoOffset;
bool hasContent() const { return !UnitDie->getChildren().empty(); }
/// addRange - Add an address range to the list of ranges for this unit.
- void addRange(RangeSpan Range) { CURanges.push_back(Range); }
+ void addRange(RangeSpan Range) {
+ // Only add a range for this unit if we're emitting full debug.
+ if (getCUNode().getEmissionKind() == DIBuilder::FullDebug)
+ CURanges.push_back(Range);
+ }
/// getRanges - Get the list of ranges for this unit.
const SmallVectorImpl<RangeSpan> &getRanges() const { return CURanges; }
void addLabel(DIELoc *Die, dwarf::Form Form, const MCSymbol *Label);
+ /// addLocationList - Add a Dwarf loclistptr attribute data and value.
+ void addLocationList(DIE *Die, dwarf::Attribute Attribute, unsigned Index);
+
/// addSectionLabel - Add a Dwarf section label attribute data and value.
///
void addSectionLabel(DIE *Die, dwarf::Attribute Attribute,
void addSectionDelta(DIE *Die, dwarf::Attribute Attribute, const MCSymbol *Hi,
const MCSymbol *Lo);
+ /// addLabelDelta - Add a label delta attribute data and value.
+ void addLabelDelta(DIE *Die, dwarf::Attribute Attribute, const MCSymbol *Hi,
+ const MCSymbol *Lo);
+
/// addDIEEntry - Add a DIE attribute data and value.
void addDIEEntry(DIE *Die, dwarf::Attribute Attribute, DIE *Entry);
/// constructVariableDIE - Construct a DIE for the given DbgVariable.
DIE *constructVariableDIE(DbgVariable &DV, bool isScopeAbstract);
+ /// constructSubprogramArguments - Construct function argument DIEs.
+ void constructSubprogramArguments(DIE &Buffer, DIArray Args);
+
/// Create a DIE with the given Tag, add the DIE to its parent, and
/// call insertDIE if MD is not null.
DIE *createAndAddDIE(unsigned Tag, DIE &Parent,
virtual DwarfCompileUnit &getCU() = 0;
+ /// \brief Return whether this compilation unit has the
+ /// one-definition-rule (ODR). In C++ this allows the compiler to
+ /// perform type unique during LTO.
+ bool hasODR() const {
+ switch (getLanguage()) {
+ case dwarf::DW_LANG_C_plus_plus:
+ case dwarf::DW_LANG_C_plus_plus_03:
+ case dwarf::DW_LANG_C_plus_plus_11:
+ // For all we care, the C++ part of the language has the ODR and
+ // ObjC methods are not represented in a way that they could be
+ // confused with C++ member functions.
+ case dwarf::DW_LANG_ObjC_plus_plus:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /// \brief Unique C++ member function declarations based on their
+ /// context+mangled name.
+ DISubprogram getOdrUniqueSubprogram(DIScope Context, DISubprogram SP) const;
+
protected:
/// getOrCreateStaticMemberDIE - Create new static data member DIE.
DIE *getOrCreateStaticMemberDIE(DIDerivedType DT);
/// either DW_FORM_addr or DW_FORM_GNU_addr_index.
void addLabelAddress(DIE *Die, dwarf::Attribute Attribute, MCSymbol *Label);
- DwarfCompileUnit &getCU() LLVM_OVERRIDE { return *this; }
+ DwarfCompileUnit &getCU() override { return *this; }
};
class DwarfTypeUnit : public DwarfUnit {
/// Emit the header for this unit, not including the initial length field.
void emitHeader(const MCSection *ASection, const MCSymbol *ASectionSym) const
- LLVM_OVERRIDE;
- unsigned getHeaderSize() const LLVM_OVERRIDE {
+ override;
+ unsigned getHeaderSize() const override {
return DwarfUnit::getHeaderSize() + sizeof(uint64_t) + // Type Signature
sizeof(uint32_t); // Type DIE Offset
}
void initSection(const MCSection *Section);
- DwarfCompileUnit &getCU() LLVM_OVERRIDE { return CU; }
+ DwarfCompileUnit &getCU() override { return CU; }
};
} // end llvm namespace
#endif