summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Zelenko <eugene.zelenko@gmail.com>2017-02-27 23:43:14 +0000
committerEugene Zelenko <eugene.zelenko@gmail.com>2017-02-27 23:43:14 +0000
commite94042cafe2cd0b4821298c88a2265755bc0e0c9 (patch)
tree62eb41af2949139ae453b8affc31edd7b5d02343
parenteb0e7cb8dea82b8ab77972d5d3d17a40009d7b37 (diff)
downloadbcm5719-llvm-e94042cafe2cd0b4821298c88a2265755bc0e0c9.tar.gz
bcm5719-llvm-e94042cafe2cd0b4821298c88a2265755bc0e0c9.zip
[DebugInfo] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 296413
-rw-r--r--llvm/include/llvm/DebugInfo/DIContext.h22
-rw-r--r--llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h34
-rw-r--r--llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h17
-rw-r--r--llvm/include/llvm/DebugInfo/DWARF/DWARFAttribute.h20
-rw-r--r--llvm/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h18
-rw-r--r--llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h12
-rw-r--r--llvm/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h13
-rw-r--r--llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h14
-rw-r--r--llvm/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h35
-rw-r--r--llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h33
-rw-r--r--llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h30
-rw-r--r--llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h26
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp8
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp12
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp6
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp7
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp10
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp18
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp11
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDie.cpp29
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp28
21 files changed, 244 insertions, 159 deletions
diff --git a/llvm/include/llvm/DebugInfo/DIContext.h b/llvm/include/llvm/DebugInfo/DIContext.h
index fa673edae6f..e3386a8dcd2 100644
--- a/llvm/include/llvm/DebugInfo/DIContext.h
+++ b/llvm/include/llvm/DebugInfo/DIContext.h
@@ -1,4 +1,4 @@
-//===-- DIContext.h ---------------------------------------------*- C++ -*-===//
+//===- DIContext.h ----------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -32,16 +32,14 @@ class raw_ostream;
struct DILineInfo {
std::string FileName;
std::string FunctionName;
- uint32_t Line;
- uint32_t Column;
- uint32_t StartLine;
+ uint32_t Line = 0;
+ uint32_t Column = 0;
+ uint32_t StartLine = 0;
// DWARF-specific.
- uint32_t Discriminator;
+ uint32_t Discriminator = 0;
- DILineInfo()
- : FileName("<invalid>"), FunctionName("<invalid>"), Line(0), Column(0),
- StartLine(0), Discriminator(0) {}
+ DILineInfo() : FileName("<invalid>"), FunctionName("<invalid>") {}
bool operator==(const DILineInfo &RHS) const {
return Line == RHS.Line && Column == RHS.Column &&
@@ -90,10 +88,10 @@ public:
/// DIGlobal - container for description of a global variable.
struct DIGlobal {
std::string Name;
- uint64_t Start;
- uint64_t Size;
+ uint64_t Start = 0;
+ uint64_t Size = 0;
- DIGlobal() : Name("<invalid>"), Start(0), Size(0) {}
+ DIGlobal() : Name("<invalid>") {}
};
/// A DINameKind is passed to name search methods to specify a
@@ -179,8 +177,8 @@ private:
/// on the fly.
class LoadedObjectInfo {
protected:
- LoadedObjectInfo(const LoadedObjectInfo &) = default;
LoadedObjectInfo() = default;
+ LoadedObjectInfo(const LoadedObjectInfo &) = default;
public:
virtual ~LoadedObjectInfo() = default;
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
index b10e849902c..7324f6e3eb3 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
@@ -1,4 +1,4 @@
-//===-- DWARFAbbreviationDeclaration.h --------------------------*- C++ -*-===//
+//===- DWARFAbbreviationDeclaration.h ---------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,17 +7,22 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_LIB_DEBUGINFO_DWARFABBREVIATIONDECLARATION_H
-#define LLVM_LIB_DEBUGINFO_DWARFABBREVIATIONDECLARATION_H
+#ifndef LLVM_DEBUGINFO_DWARFABBREVIATIONDECLARATION_H
+#define LLVM_DEBUGINFO_DWARFABBREVIATIONDECLARATION_H
+#include "llvm/ADT/iterator_range.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/DataExtractor.h"
#include "llvm/Support/Dwarf.h"
+#include <cassert>
+#include <cstddef>
+#include <cstdint>
+
namespace llvm {
-class DWARFUnit;
class DWARFFormValue;
+class DWARFUnit;
class raw_ostream;
class DWARFAbbreviationDeclaration {
@@ -25,6 +30,7 @@ public:
struct AttributeSpec {
AttributeSpec(dwarf::Attribute A, dwarf::Form F, Optional<int64_t> V)
: Attr(A), Form(F), ByteSizeOrValue(V) {}
+
dwarf::Attribute Attr;
dwarf::Form Form;
/// The following field is used for ByteSize for non-implicit_const
@@ -41,9 +47,11 @@ public:
/// * Form == DW_FORM_implicit_const:
/// ByteSizeOrValue contains value for the implicit_const attribute.
Optional<int64_t> ByteSizeOrValue;
+
bool isImplicitConst() const {
return Form == dwarf::DW_FORM_implicit_const;
}
+
/// Get the fixed byte size of this Form if possible. This function might
/// use the DWARFUnit to calculate the size of the Form, like for
/// DW_AT_address and DW_AT_ref_addr, so this isn't just an accessor for
@@ -118,16 +126,16 @@ private:
/// abbreviation declaration.
struct FixedSizeInfo {
/// The fixed byte size for fixed size forms.
- uint16_t NumBytes;
+ uint16_t NumBytes = 0;
/// Number of DW_FORM_address forms in this abbrevation declaration.
- uint8_t NumAddrs;
+ uint8_t NumAddrs = 0;
/// Number of DW_FORM_ref_addr forms in this abbrevation declaration.
- uint8_t NumRefAddrs;
+ uint8_t NumRefAddrs = 0;
/// Number of 4 byte in DWARF32 and 8 byte in DWARF64 forms.
- uint8_t NumDwarfOffsets;
- /// Constructor
- FixedSizeInfo()
- : NumBytes(0), NumAddrs(0), NumRefAddrs(0), NumDwarfOffsets(0) {}
+ uint8_t NumDwarfOffsets = 0;
+
+ FixedSizeInfo() = default;
+
/// Calculate the fixed size in bytes given a DWARFUnit.
///
/// \param U the DWARFUnit to use when determing the byte size.
@@ -147,6 +155,6 @@ private:
Optional<FixedSizeInfo> FixedAttributeSize;
};
-}
+} // end namespace llvm
-#endif
+#endif // LLVM_DEBUGINFO_DWARFABBREVIATIONDECLARATION_H
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
index 63343728fa9..f95a013d755 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
@@ -1,4 +1,4 @@
-//===--- DWARFAcceleratorTable.h --------------------------------*- C++ -*-===//
+//===- DWARFAcceleratorTable.h ----------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,19 +7,21 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_LIB_DEBUGINFO_DWARFACCELERATORTABLE_H
-#define LLVM_LIB_DEBUGINFO_DWARFACCELERATORTABLE_H
+#ifndef LLVM_DEBUGINFO_DWARFACCELERATORTABLE_H
+#define LLVM_DEBUGINFO_DWARFACCELERATORTABLE_H
#include "llvm/ADT/SmallVector.h"
-#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
+#include "llvm/Support/DataExtractor.h"
#include "llvm/Support/Dwarf.h"
#include <cstdint>
+#include <utility>
namespace llvm {
-class DWARFAcceleratorTable {
+class raw_ostream;
+class DWARFAcceleratorTable {
struct Header {
uint32_t Magic;
uint16_t Version;
@@ -41,6 +43,7 @@ class DWARFAcceleratorTable {
DataExtractor AccelSection;
DataExtractor StringSection;
const RelocAddrMap& Relocs;
+
public:
DWARFAcceleratorTable(DataExtractor AccelSection, DataExtractor StringSection,
const RelocAddrMap &Relocs)
@@ -50,6 +53,6 @@ public:
void dump(raw_ostream &OS) const;
};
-}
+} // end namespace llvm
-#endif
+#endif // LLVM_DEBUGINFO_DWARFACCELERATORTABLE_H
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFAttribute.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFAttribute.h
index 0974f827db5..5919aaddea4 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFAttribute.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFAttribute.h
@@ -1,4 +1,4 @@
-//===-- DWARFAttribute.h ----------------------------------------*- C++ -*-===//
+//===- DWARFAttribute.h -----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,11 +7,12 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_LIB_DEBUGINFO_DWARFATTRIBUTE_H
-#define LLVM_LIB_DEBUGINFO_DWARFATTRIBUTE_H
+#ifndef LLVM_DEBUGINFO_DWARFATTRIBUTE_H
+#define LLVM_DEBUGINFO_DWARFATTRIBUTE_H
-#include "llvm/Support/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
+#include "llvm/Support/Dwarf.h"
+#include <cstdint>
namespace llvm {
@@ -23,17 +24,16 @@ namespace llvm {
/// attributes in a DWARFDie.
struct DWARFAttribute {
/// The debug info/types offset for this attribute.
- uint32_t Offset;
+ uint32_t Offset = 0;
/// The debug info/types section byte size of the data for this attribute.
- uint32_t ByteSize;
+ uint32_t ByteSize = 0;
/// The attribute enumeration of this attribute.
dwarf::Attribute Attr;
/// The form and value for this attribute.
DWARFFormValue Value;
DWARFAttribute(uint32_t O, dwarf::Attribute A = dwarf::Attribute(0),
- dwarf::Form F = dwarf::Form(0)) :
- Offset(0), ByteSize(0), Attr(A), Value(F) {}
+ dwarf::Form F = dwarf::Form(0)) : Attr(A), Value(F) {}
bool isValid() const {
return Offset != 0 && Attr != dwarf::Attribute(0);
@@ -51,6 +51,6 @@ struct DWARFAttribute {
}
};
-}
+} // end namespace llvm
-#endif
+#endif // LLVM_DEBUGINFO_DWARFATTRIBUTE_H
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h
index bba3abe6e9e..b2a4d247ccc 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h
@@ -1,4 +1,4 @@
-//===-- DWARFCompileUnit.h --------------------------------------*- C++ -*-===//
+//===- DWARFCompileUnit.h ---------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,10 +7,11 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_LIB_DEBUGINFO_DWARFCOMPILEUNIT_H
-#define LLVM_LIB_DEBUGINFO_DWARFCOMPILEUNIT_H
+#ifndef LLVM_DEBUGINFO_DWARFCOMPILEUNIT_H
+#define LLVM_DEBUGINFO_DWARFCOMPILEUNIT_H
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
+#include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
namespace llvm {
@@ -23,12 +24,15 @@ public:
const DWARFUnitIndex::Entry *Entry)
: DWARFUnit(Context, Section, DA, RS, SS, SOS, AOS, LS, LE, IsDWO,
UnitSection, Entry) {}
- void dump(raw_ostream &OS);
- static const DWARFSectionKind Section = DW_SECT_INFO;
+
// VTable anchor.
~DWARFCompileUnit() override;
+
+ void dump(raw_ostream &OS);
+
+ static const DWARFSectionKind Section = DW_SECT_INFO;
};
-}
+} // end namespace llvm
-#endif
+#endif // LLVM_DEBUGINFO_DWARFCOMPILEUNIT_H
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
index f732deef548..9f86fe50838 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
@@ -1,4 +1,4 @@
-//===-- DWARFDebugAbbrev.h --------------------------------------*- C++ -*-===//
+//===- DWARFDebugAbbrev.h ---------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,10 +7,12 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_LIB_DEBUGINFO_DWARFDEBUGABBREV_H
-#define LLVM_LIB_DEBUGINFO_DWARFDEBUGABBREV_H
+#ifndef LLVM_DEBUGINFO_DWARFDEBUGABBREV_H
+#define LLVM_DEBUGINFO_DWARFDEBUGABBREV_H
#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
+#include "llvm/Support/DataExtractor.h"
+#include <cstdint>
#include <map>
#include <vector>
@@ -76,6 +78,6 @@ private:
void clear();
};
-}
+} // end namespace llvm
-#endif
+#endif // LLVM_DEBUGINFO_DWARFDEBUGABBREV_H
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h
index 5a602392add..40eb7e9a883 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h
@@ -1,4 +1,4 @@
-//===-- DWARFDebugArangeSet.h -----------------------------------*- C++ -*-===//
+//===- DWARFDebugArangeSet.h ------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,11 +7,12 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_LIB_DEBUGINFO_DWARFDEBUGARANGESET_H
-#define LLVM_LIB_DEBUGINFO_DWARFDEBUGARANGESET_H
+#ifndef LLVM_DEBUGINFO_DWARFDEBUGARANGESET_H
+#define LLVM_DEBUGINFO_DWARFDEBUGARANGESET_H
#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/DataExtractor.h"
+#include <cstdint>
#include <vector>
namespace llvm {
@@ -40,6 +41,7 @@ public:
struct Descriptor {
uint64_t Address;
uint64_t Length;
+
uint64_t getEndAddress() const { return Address + Length; }
};
@@ -53,6 +55,7 @@ private:
public:
DWARFDebugArangeSet() { clear(); }
+
void clear();
bool extract(DataExtractor data, uint32_t *offset_ptr);
void dump(raw_ostream &OS) const;
@@ -67,6 +70,6 @@ public:
}
};
-}
+} // end namespace llvm
-#endif
+#endif // LLVM_DEBUGINFO_DWARFDEBUGARANGESET_H
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
index 791f010a889..c06771d6afb 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
@@ -1,4 +1,4 @@
-//===-- DWARFDebugAranges.h -------------------------------------*- C++ -*-===//
+//===- DWARFDebugAranges.h --------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,11 +7,12 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_LIB_DEBUGINFO_DWARFDEBUGARANGES_H
-#define LLVM_LIB_DEBUGINFO_DWARFDEBUGARANGES_H
+#ifndef LLVM_DEBUGINFO_DWARFDEBUGARANGES_H
+#define LLVM_DEBUGINFO_DWARFDEBUGARANGES_H
#include "llvm/ADT/DenseSet.h"
#include "llvm/Support/DataExtractor.h"
+#include <cstdint>
#include <vector>
namespace llvm {
@@ -42,6 +43,7 @@ private:
else
Length = HighPC - LowPC;
}
+
uint64_t HighPC() const {
if (Length)
return LowPC + Length;
@@ -51,6 +53,7 @@ private:
bool containsAddress(uint64_t Address) const {
return LowPC <= Address && Address < HighPC();
}
+
bool operator<(const Range &other) const {
return LowPC < other.LowPC;
}
@@ -73,7 +76,6 @@ private:
}
};
-
typedef std::vector<Range> RangeColl;
typedef RangeColl::const_iterator RangeCollIterator;
@@ -82,6 +84,6 @@ private:
DenseSet<uint32_t> ParsedCUOffsets;
};
-}
+} // end namespace llvm
-#endif
+#endif // LLVM_DEBUGINFO_DWARFDEBUGARANGES_H
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
index f36f470980b..fc2423a2708 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
@@ -1,4 +1,4 @@
-//===-- DWARFDebugInfoEntry.h -----------------------------------*- C++ -*-===//
+//===- DWARFDebugInfoEntry.h ------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,43 +7,37 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_LIB_DEBUGINFO_DWARFDEBUGINFOENTRY_H
-#define LLVM_LIB_DEBUGINFO_DWARFDEBUGINFOENTRY_H
+#ifndef LLVM_DEBUGINFO_DWARFDEBUGINFOENTRY_H
+#define LLVM_DEBUGINFO_DWARFDEBUGINFOENTRY_H
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/DebugInfo/DIContext.h"
#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
-#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
-#include "llvm/Support/DataTypes.h"
#include "llvm/Support/Dwarf.h"
+#include <cstdint>
namespace llvm {
-class DWARFDebugAranges;
-class DWARFCompileUnit;
+class DataExtractor;
class DWARFUnit;
-class DWARFContext;
-class DWARFFormValue;
-struct DWARFDebugInfoEntryInlinedChain;
/// DWARFDebugInfoEntry - A DIE with only the minimum required data.
class DWARFDebugInfoEntry {
/// Offset within the .debug_info of the start of this entry.
- uint32_t Offset;
+ uint32_t Offset = 0;
/// The integer depth of this DIE within the compile unit DIEs where the
/// compile/type unit DIE has a depth of zero.
- uint32_t Depth;
+ uint32_t Depth = 0;
+
+ const DWARFAbbreviationDeclaration *AbbrevDecl = nullptr;
- const DWARFAbbreviationDeclaration *AbbrevDecl;
public:
- DWARFDebugInfoEntry()
- : Offset(0), Depth(0), AbbrevDecl(nullptr) {}
+ DWARFDebugInfoEntry() = default;
/// Extracts a debug info entry, which is a child of a given unit,
/// starting at a given offset. If DIE can't be extracted, returns false and
/// doesn't change OffsetPtr.
bool extractFast(const DWARFUnit &U, uint32_t *OffsetPtr);
+
/// High performance extraction should use this call.
bool extractFast(const DWARFUnit &U, uint32_t *OffsetPtr,
const DataExtractor &DebugInfoData,
@@ -52,15 +46,18 @@ public:
uint32_t getOffset() const { return Offset; }
uint32_t getDepth() const { return Depth; }
+
dwarf::Tag getTag() const {
return AbbrevDecl ? AbbrevDecl->getTag() : dwarf::DW_TAG_null;
}
+
bool hasChildren() const { return AbbrevDecl && AbbrevDecl->hasChildren(); }
+
const DWARFAbbreviationDeclaration *getAbbreviationDeclarationPtr() const {
return AbbrevDecl;
}
};
-}
+} // end namespace llvm
-#endif
+#endif // LLVM_DEBUGINFO_DWARFDEBUGINFOENTRY_H
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
index 878f1c76ebf..e5bb24707b6 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
@@ -1,4 +1,4 @@
-//===-- DWARFDebugLine.h ----------------------------------------*- C++ -*-===//
+//===- DWARFDebugLine.h -----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,12 +7,13 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_LIB_DEBUGINFO_DWARFDEBUGLINE_H
-#define LLVM_LIB_DEBUGINFO_DWARFDEBUGLINE_H
+#ifndef LLVM_DEBUGINFO_DWARFDEBUGLINE_H
+#define LLVM_DEBUGINFO_DWARFDEBUGLINE_H
#include "llvm/DebugInfo/DIContext.h"
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
#include "llvm/Support/DataExtractor.h"
+#include <cstdint>
#include <map>
#include <string>
#include <vector>
@@ -24,13 +25,14 @@ class raw_ostream;
class DWARFDebugLine {
public:
DWARFDebugLine(const RelocAddrMap* LineInfoRelocMap) : RelocMap(LineInfoRelocMap) {}
+
struct FileNameEntry {
- FileNameEntry() : Name(nullptr), DirIdx(0), ModTime(0), Length(0) {}
+ FileNameEntry() = default;
- const char *Name;
- uint64_t DirIdx;
- uint64_t ModTime;
- uint64_t Length;
+ const char *Name = nullptr;
+ uint64_t DirIdx = 0;
+ uint64_t ModTime = 0;
+ uint64_t Length = 0;
};
struct Prologue {
@@ -64,9 +66,11 @@ public:
std::vector<FileNameEntry> FileNames;
bool IsDWARF64;
+
uint32_t sizeofTotalLength() const {
return IsDWARF64 ? 12 : 4;
}
+
uint32_t sizeofPrologueLength() const {
return IsDWARF64 ? 8 : 4;
}
@@ -76,10 +80,12 @@ public:
return PrologueLength + sizeofTotalLength() + sizeof(Version) +
sizeofPrologueLength();
}
+
// Length of the line table data in bytes (not including the prologue).
uint32_t getStatementTableLength() const {
return TotalLength + sizeofTotalLength() - getLength();
}
+
int32_t getMaxLineIncrementForSpecialOpcode() const {
return LineBase + (int8_t)LineRange - 1;
}
@@ -146,6 +152,8 @@ public:
// compilation unit may consist of multiple sequences, which are not
// guaranteed to be in the order of ascending instruction address.
struct Sequence {
+ Sequence();
+
// Sequence describes instructions at address range [LowPC, HighPC)
// and is described by line table rows [FirstRowIndex, LastRowIndex).
uint64_t LowPC;
@@ -154,15 +162,16 @@ public:
unsigned LastRowIndex;
bool Empty;
- Sequence();
void reset();
static bool orderByLowPC(const Sequence& LHS, const Sequence& RHS) {
return LHS.LowPC < RHS.LowPC;
}
+
bool isValid() const {
return !Empty && (LowPC < HighPC) && (FirstRowIndex < LastRowIndex);
}
+
bool containsPC(uint64_t pc) const {
return (LowPC <= pc && pc < HighPC);
}
@@ -177,6 +186,7 @@ public:
void appendRow(const DWARFDebugLine::Row &R) {
Rows.push_back(R);
}
+
void appendSequence(const DWARFDebugLine::Sequence &S) {
Sequences.push_back(S);
}
@@ -249,6 +259,7 @@ private:
const RelocAddrMap *RelocMap;
LineTableMapTy LineTableMap;
};
-}
-#endif
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_DWARFDEBUGLINE_H
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
index dbaf09aa91e..1c450d2d9a1 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
@@ -1,4 +1,4 @@
-//===-- DWARFDie.h --------------------------------------------------------===//
+//===- DWARFDie.h -----------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,20 +7,25 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_LIB_DEBUGINFO_DWARFDIE_H
-#define LLVM_LIB_DEBUGINFO_DWARFDIE_H
+#ifndef LLVM_DEBUGINFO_DWARFDIE_H
+#define LLVM_DEBUGINFO_DWARFDIE_H
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/iterator.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/ADT/Optional.h"
+#include "llvm/DebugInfo/DIContext.h"
#include "llvm/DebugInfo/DWARF/DWARFAttribute.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h"
+#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
+#include "llvm/Support/Dwarf.h"
+#include <cassert>
+#include <cstdint>
+#include <iterator>
namespace llvm {
class DWARFUnit;
-class DWARFDebugInfoEntry;
class raw_ostream;
//===----------------------------------------------------------------------===//
@@ -36,10 +41,11 @@ class raw_ostream;
/// also simplifies the attribute extraction calls by not having to specify the
/// DWARFUnit for each call.
class DWARFDie {
- DWARFUnit *U;
- const DWARFDebugInfoEntry *Die;
+ DWARFUnit *U = nullptr;
+ const DWARFDebugInfoEntry *Die = nullptr;
+
public:
- DWARFDie() : U(nullptr), Die(nullptr) {}
+ DWARFDie() = default;
DWARFDie(DWARFUnit *Unit, const DWARFDebugInfoEntry * D) : U(Unit), Die(D) {}
bool isValid() const { return U && Die; }
@@ -47,7 +53,6 @@ public:
const DWARFDebugInfoEntry *getDebugInfoEntry() const { return Die; }
DWARFUnit *getDwarfUnit() const { return U; }
-
/// Get the abbreviation declaration for this DIE.
///
/// \returns the abbreviation declaration or NULL for null tags.
@@ -80,6 +85,7 @@ public:
bool isNULL() const {
return getAbbreviationDeclarationPtr() == nullptr;
}
+
/// Returns true if DIE represents a subprogram (not inlined).
bool isSubprogramDIE() const;
@@ -289,16 +295,17 @@ class DWARFDie::attribute_iterator :
/// error will be set if the Err member variable is non-NULL and the iterator
/// will be set to the end value so iteration stops.
void updateForIndex(const DWARFAbbreviationDeclaration &AbbrDecl, uint32_t I);
+
public:
attribute_iterator() = delete;
explicit attribute_iterator(DWARFDie D, bool End);
+
attribute_iterator &operator++();
explicit operator bool() const { return AttrValue.isValid(); }
const DWARFAttribute &operator*() const { return AttrValue; }
bool operator==(const attribute_iterator &X) const { return Index == X.Index; }
};
-
inline bool operator==(const DWARFDie &LHS, const DWARFDie &RHS) {
return LHS.getDebugInfoEntry() == RHS.getDebugInfoEntry() &&
LHS.getDwarfUnit() == RHS.getDwarfUnit();
@@ -318,16 +325,19 @@ class DWARFDie::iterator : public iterator_facade_base<iterator,
}
public:
iterator() = default;
+
explicit iterator(DWARFDie D) : Die(D) {
// If we start out with only a Null DIE then invalidate.
skipNull();
}
+
iterator &operator++() {
Die = Die.getSibling();
// Don't include the NULL die when iterating.
skipNull();
return *this;
}
+
explicit operator bool() const { return Die.isValid(); }
const DWARFDie &operator*() const { return Die; }
bool operator==(const iterator &X) const { return Die == X.Die; }
@@ -349,4 +359,4 @@ inline iterator_range<DWARFDie::iterator> DWARFDie::children() const {
} // end namespace llvm
-#endif // LLVM_LIB_DEBUGINFO_DWARFDIE_H
+#endif // LLVM_DEBUGINFO_DWARFDIE_H
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
index 878dcab5801..c8d7a0c1ac7 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
@@ -1,4 +1,4 @@
-//===-- DWARFFormValue.h ----------------------------------------*- C++ -*-===//
+//===- DWARFFormValue.h -----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -11,13 +11,14 @@
#define LLVM_DEBUGINFO_DWARFFORMVALUE_H
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/Support/DataExtractor.h"
#include "llvm/Support/Dwarf.h"
+#include <cstdint>
namespace llvm {
-template <typename T> class ArrayRef;
class DWARFUnit;
class raw_ostream;
@@ -38,7 +39,7 @@ public:
private:
struct ValueType {
- ValueType() : data(nullptr) {
+ ValueType() {
uval = 0;
}
@@ -47,24 +48,27 @@ private:
int64_t sval;
const char* cstr;
};
- const uint8_t* data;
+ const uint8_t* data = nullptr;
};
dwarf::Form Form; // Form for this value.
ValueType Value; // Contains all data for the form.
- const DWARFUnit *U; // Remember the DWARFUnit at extract time.
+ const DWARFUnit *U = nullptr; // Remember the DWARFUnit at extract time.
public:
- DWARFFormValue(dwarf::Form F = dwarf::Form(0)) : Form(F), U(nullptr) {}
+ DWARFFormValue(dwarf::Form F = dwarf::Form(0)) : Form(F) {}
+
dwarf::Form getForm() const { return Form; }
void setForm(dwarf::Form F) { Form = F; }
void setUValue(uint64_t V) { Value.uval = V; }
void setSValue(int64_t V) { Value.sval = V; }
void setPValue(const char *V) { Value.cstr = V; }
+
void setBlockValue(const ArrayRef<uint8_t> &Data) {
Value.data = Data.data();
setUValue(Data.size());
}
+
bool isFormClass(FormClass FC) const;
const DWARFUnit *getUnit() const { return U; }
void dump(raw_ostream &OS) const;
@@ -77,6 +81,7 @@ public:
/// \returns whether the extraction succeeded.
bool extractValue(const DataExtractor &Data, uint32_t *OffsetPtr,
const DWARFUnit *U);
+
bool isInlinedCStr() const {
return Value.data != nullptr && Value.data == (const uint8_t*)Value.cstr;
}
@@ -92,6 +97,7 @@ public:
Optional<ArrayRef<uint8_t>> getAsBlock() const;
Optional<uint64_t> getAsCStringOffset() const;
Optional<uint64_t> getAsReferenceUVal() const;
+
/// Get the fixed byte size for a given form.
///
/// If the form always has a fixed valid byte size that doesn't depend on a
@@ -110,6 +116,7 @@ public:
/// and was needed to calculate the byte size.
static Optional<uint8_t> getFixedByteSize(dwarf::Form Form,
const DWARFUnit *U = nullptr);
+
/// Get the fixed byte size for a given form.
///
/// If the form has a fixed byte size given a valid DWARF version and address
@@ -138,6 +145,7 @@ public:
/// \returns true on success, false if the form was not skipped.
bool skipValue(DataExtractor debug_info_data, uint32_t *offset_ptr,
const DWARFUnit *U) const;
+
/// Skip a form in \p debug_info_data at offset specified by \p offset_ptr.
///
/// Skips the bytes for this form in the debug info and updates the offset.
@@ -150,6 +158,7 @@ public:
/// \returns true on success, false if the form was not skipped.
static bool skipValue(dwarf::Form form, DataExtractor debug_info_data,
uint32_t *offset_ptr, const DWARFUnit *U);
+
/// Skip a form in \p debug_info_data at offset specified by \p offset_ptr.
///
/// Skips the bytes for this form in the debug info and updates the offset.
@@ -170,6 +179,7 @@ private:
};
namespace dwarf {
+
/// Take an optional DWARFFormValue and try to extract a string value from it.
///
/// \param V and optional DWARFFormValue to attempt to extract the value from.
@@ -316,6 +326,6 @@ namespace dwarf {
} // end namespace dwarf
-}
+} // end namespace llvm
-#endif
+#endif // LLVM_DEBUGINFO_DWARFFORMVALUE_H
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp b/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
index 08bc74a81e9..fbea2964d3a 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
@@ -1,4 +1,4 @@
-//===-- DWARFAbbreviationDeclaration.cpp ----------------------------------===//
+//===- DWARFAbbreviationDeclaration.cpp -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,12 +7,18 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/ADT/None.h"
+#include "llvm/ADT/Optional.h"
#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
+#include "llvm/Support/DataExtractor.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
+#include <cstddef>
+#include <cstdint>
+
using namespace llvm;
using namespace dwarf;
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
index 2eac2cd50b8..85e1eaedfc6 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
@@ -1,4 +1,4 @@
-//===--- DWARFAcceleratorTable.cpp ----------------------------------------===//
+//===- DWARFAcceleratorTable.cpp ------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,12 +7,19 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/ADT/SmallVector.h"
#include "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h"
+#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
+#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
#include "llvm/Support/Dwarf.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
+#include <cstddef>
+#include <cstdint>
+#include <utility>
-namespace llvm {
+using namespace llvm;
bool DWARFAcceleratorTable::extract() {
uint32_t Offset = 0;
@@ -131,4 +138,3 @@ LLVM_DUMP_METHOD void DWARFAcceleratorTable::dump(raw_ostream &OS) const {
}
}
}
-}
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp
index e63e28997ed..76dd2e4c21b 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp
@@ -1,4 +1,4 @@
-//===-- DWARFDebugAbbrev.cpp ----------------------------------------------===//
+//===- DWARFDebugAbbrev.cpp -----------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -10,6 +10,10 @@
#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
+#include <algorithm>
+#include <cinttypes>
+#include <cstdint>
+
using namespace llvm;
DWARFAbbreviationDeclarationSet::DWARFAbbreviationDeclarationSet() {
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp
index 67589cd01e5..ed5d726ae4e 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp
@@ -1,4 +1,4 @@
-//===-- DWARFDebugArangeSet.cpp -------------------------------------------===//
+//===- DWARFDebugArangeSet.cpp --------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -10,8 +10,11 @@
#include "llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
-#include <algorithm>
#include <cassert>
+#include <cinttypes>
+#include <cstdint>
+#include <cstring>
+
using namespace llvm;
void DWARFDebugArangeSet::clear() {
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
index 27a02c4c50d..0cf71f53044 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
@@ -1,4 +1,4 @@
-//===-- DWARFDebugAranges.cpp -----------------------------------*- C++ -*-===//
+//===- DWARFDebugAranges.cpp ----------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -11,11 +11,13 @@
#include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h"
-#include "llvm/Support/Format.h"
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/DataExtractor.h"
#include <algorithm>
#include <cassert>
+#include <cstdint>
#include <set>
+#include <vector>
+
using namespace llvm;
void DWARFDebugAranges::extract(DataExtractor DebugArangesData) {
@@ -81,7 +83,7 @@ void DWARFDebugAranges::construct() {
std::sort(Endpoints.begin(), Endpoints.end());
uint64_t PrevAddress = -1ULL;
for (const auto &E : Endpoints) {
- if (PrevAddress < E.Address && ValidCUs.size() > 0) {
+ if (PrevAddress < E.Address && !ValidCUs.empty()) {
// If the address range between two endpoints is described by some
// CU, first try to extend the last range in Aranges. If we can't
// do it, start a new range.
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
index c487e1dca7c..35f673c7acc 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
@@ -1,4 +1,4 @@
-//===-- DWARFDebugInfoEntry.cpp -------------------------------------------===//
+//===- DWARFDebugInfoEntry.cpp --------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,20 +7,17 @@
//
//===----------------------------------------------------------------------===//
-#include "SyntaxHighlighting.h"
-#include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
-#include "llvm/DebugInfo/DWARF/DWARFContext.h"
+#include "llvm/ADT/Optional.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h"
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
-#include "llvm/Support/DataTypes.h"
-#include "llvm/Support/Debug.h"
-#include "llvm/Support/Dwarf.h"
-#include "llvm/Support/Format.h"
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
+#include "llvm/Support/DataExtractor.h"
+#include <cstddef>
+#include <cstdint>
+
using namespace llvm;
using namespace dwarf;
-using namespace syntax;
bool DWARFDebugInfoEntry::extractFast(const DWARFUnit &U,
uint32_t *OffsetPtr) {
@@ -28,6 +25,7 @@ bool DWARFDebugInfoEntry::extractFast(const DWARFUnit &U,
const uint32_t UEndOffset = U.getNextUnitOffset();
return extractFast(U, OffsetPtr, DebugInfoData, UEndOffset, 0);
}
+
bool DWARFDebugInfoEntry::extractFast(const DWARFUnit &U, uint32_t *OffsetPtr,
const DataExtractor &DebugInfoData,
uint32_t UEndOffset, uint32_t D) {
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
index 494059461fd..e4670519b79 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
@@ -1,4 +1,4 @@
-//===-- DWARFDebugLine.cpp ------------------------------------------------===//
+//===- DWARFDebugLine.cpp -------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,14 +7,23 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/ADT/SmallString.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugLine.h"
+#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
+#include <cassert>
+#include <cinttypes>
+#include <cstdint>
+#include <cstdio>
+#include <utility>
+
using namespace llvm;
using namespace dwarf;
+
typedef DILineInfoSpecifier::FileLineInfoKind FileLineInfoKind;
DWARFDebugLine::Prologue::Prologue() { clear(); }
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
index bdeff7bd3af..fc49fdeaad5 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
@@ -1,4 +1,4 @@
-//===-- DWARFDie.cpp ------------------------------------------------------===//
+//===- DWARFDie.cpp -------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,25 +7,33 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/DebugInfo/DWARF/DWARFDie.h"
#include "SyntaxHighlighting.h"
-#include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
+#include "llvm/ADT/None.h"
+#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
-#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
-#include "llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h"
+#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
+#include "llvm/DebugInfo/DWARF/DWARFDie.h"
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
-#include "llvm/Support/DataTypes.h"
-#include "llvm/Support/Debug.h"
+#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
+#include "llvm/Support/DataExtractor.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/Format.h"
+#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
+#include <algorithm>
+#include <cassert>
+#include <cinttypes>
+#include <cstdint>
+#include <string>
+#include <utility>
using namespace llvm;
using namespace dwarf;
using namespace syntax;
-namespace {
- static void dumpApplePropertyAttribute(raw_ostream &OS, uint64_t Val) {
+static void dumpApplePropertyAttribute(raw_ostream &OS, uint64_t Val) {
OS << " (";
do {
uint64_t Shift = countTrailingZeros(Val);
@@ -122,8 +130,6 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,
OS << ")\n";
}
-} // end anonymous namespace
-
bool DWARFDie::isSubprogramDIE() const {
return getTag() == DW_TAG_subprogram;
}
@@ -356,7 +362,6 @@ void DWARFDie::dump(raw_ostream &OS, unsigned RecurseDepth,
}
}
-
void DWARFDie::getInlinedChainForAddress(
const uint64_t Address, SmallVectorImpl<DWARFDie> &InlinedChain) const {
if (isNULL())
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
index 0bed1a1e99c..e60a5dc313c 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
@@ -1,4 +1,4 @@
-//===-- DWARFFormValue.cpp ------------------------------------------------===//
+//===- DWARFFormValue.cpp -------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -9,16 +9,21 @@
#include "SyntaxHighlighting.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/None.h"
+#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
-#include "llvm/Support/Debug.h"
+#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
+#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
#include "llvm/Support/Dwarf.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
-#include <cassert>
+#include <cinttypes>
+#include <cstdint>
#include <limits>
+
using namespace llvm;
using namespace dwarf;
using namespace syntax;
@@ -66,13 +71,16 @@ class FormSizeHelper {
public:
FormSizeHelper(uint16_t V, uint8_t A, llvm::dwarf::DwarfFormat F)
- : Version(V), AddrSize(A), Format(F) {}
+ : Version(V), AddrSize(A), Format(F) {}
+
uint8_t getAddressByteSize() const { return AddrSize; }
+
uint8_t getRefAddrByteSize() const {
if (Version == 2)
return AddrSize;
return getDwarfOffsetByteSize();
}
+
uint8_t getDwarfOffsetByteSize() const {
switch (Format) {
case dwarf::DwarfFormat::DWARF32:
@@ -497,21 +505,18 @@ DWARFFormValue::dump(raw_ostream &OS) const {
case DW_FORM_sdata: OS << Value.sval; break;
case DW_FORM_udata: OS << Value.uval; break;
- case DW_FORM_strp: {
+ case DW_FORM_strp:
OS << format(" .debug_str[0x%8.8x] = ", (uint32_t)uvalue);
dumpString(OS);
break;
- }
- case DW_FORM_GNU_str_index: {
+ case DW_FORM_GNU_str_index:
OS << format(" indexed (%8.8x) string = ", (uint32_t)uvalue);
dumpString(OS);
break;
- }
- case DW_FORM_GNU_strp_alt: {
+ case DW_FORM_GNU_strp_alt:
OS << format("alt indirect string, offset: 0x%" PRIx64 "", uvalue);
dumpString(OS);
break;
- }
case DW_FORM_ref_addr:
OS << format("0x%016" PRIx64, uvalue);
break;
@@ -676,4 +681,3 @@ Optional<uint64_t> DWARFFormValue::getAsReferenceUVal() const {
return None;
return Value.uval;
}
-
OpenPOWER on IntegriCloud