[llvm] r296413 - [DebugInfo] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 6 14:36:42 PST 2017
In the past the LLVM Project's generally avoided mass cleanup (even
whitespace - which is a bit easier to workaround) due to the issues it has
with version history and churn.
I believe I've mentioned/suggested this in the past - but this sort of
cleanup is probably worth an llvm-dev discussion to figure out what the
right path is for it in general. (in that conversation I'd point out that
without tool integration to /maintain/ these invariants/stylistic rules,
it's off less/little value to do the cleanup as it'll regress relatively
quickly)
Please start an llvm-dev thread and get some kind of closure on the best
strategy before continuing with these sort of changes.
On Mon, Feb 27, 2017 at 3:55 PM Eugene Zelenko via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: eugenezelenko
> Date: Mon Feb 27 17:43:14 2017
> New Revision: 296413
>
> URL: http://llvm.org/viewvc/llvm-project?rev=296413&view=rev
> Log:
> [DebugInfo] Fix some Clang-tidy modernize and Include What You Use
> warnings; other minor fixes (NFC).
>
> Modified:
> llvm/trunk/include/llvm/DebugInfo/DIContext.h
> llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
> llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
> llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAttribute.h
> llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h
> llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
> llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h
> llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
> llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
> llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
> llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDie.h
> llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
> llvm/trunk/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
> llvm/trunk/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
> llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp
> llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp
> llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
> llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
> llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
> llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp
> llvm/trunk/lib/DebugInfo/DWARF/DWARFFormValue.cpp
>
> Modified: llvm/trunk/include/llvm/DebugInfo/DIContext.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DIContext.h?rev=296413&r1=296412&r2=296413&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/DIContext.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/DIContext.h Mon Feb 27 17:43:14 2017
> @@ -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;
>
> Modified:
> llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h?rev=296413&r1=296412&r2=296413&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
> (original)
> +++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
> Mon Feb 27 17:43:14 2017
> @@ -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
>
> Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h?rev=296413&r1=296412&r2=296413&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
> (original)
> +++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h Mon
> Feb 27 17:43:14 2017
> @@ -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
>
> Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAttribute.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAttribute.h?rev=296413&r1=296412&r2=296413&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAttribute.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAttribute.h Mon Feb 27
> 17:43:14 2017
> @@ -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
>
> Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h?rev=296413&r1=296412&r2=296413&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h Mon Feb 27
> 17:43:14 2017
> @@ -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
>
> Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h?rev=296413&r1=296412&r2=296413&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h Mon Feb 27
> 17:43:14 2017
> @@ -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
>
> Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h?rev=296413&r1=296412&r2=296413&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h
> (original)
> +++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h Mon Feb
> 27 17:43:14 2017
> @@ -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
>
> Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h?rev=296413&r1=296412&r2=296413&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h Mon Feb 27
> 17:43:14 2017
> @@ -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
>
> Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h?rev=296413&r1=296412&r2=296413&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
> (original)
> +++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h Mon Feb
> 27 17:43:14 2017
> @@ -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
>
> Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h?rev=296413&r1=296412&r2=296413&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h Mon Feb 27
> 17:43:14 2017
> @@ -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
>
> Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDie.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDie.h?rev=296413&r1=296412&r2=296413&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDie.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDie.h Mon Feb 27 17:43:14
> 2017
> @@ -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 iterat
> }
> 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
>
> } // end namespace llvm
>
> -#endif // LLVM_LIB_DEBUGINFO_DWARFDIE_H
> +#endif // LLVM_DEBUGINFO_DWARFDIE_H
>
> Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFFormValue.h?rev=296413&r1=296412&r2=296413&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFFormValue.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFFormValue.h Mon Feb 27
> 17:43:14 2017
> @@ -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
>
> Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp?rev=296413&r1=296412&r2=296413&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
> (original)
> +++ llvm/trunk/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp Mon
> Feb 27 17:43:14 2017
> @@ -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;
>
>
> Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp?rev=296413&r1=296412&r2=296413&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp (original)
> +++ llvm/trunk/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp Mon Feb 27
> 17:43:14 2017
> @@ -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 DWARFAcceleratorTa
> }
> }
> }
> -}
>
> Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp?rev=296413&r1=296412&r2=296413&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp (original)
> +++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp Mon Feb 27
> 17:43:14 2017
> @@ -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() {
>
> Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp?rev=296413&r1=296412&r2=296413&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp (original)
> +++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp Mon Feb 27
> 17:43:14 2017
> @@ -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() {
>
> Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp?rev=296413&r1=296412&r2=296413&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp (original)
> +++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp Mon Feb 27
> 17:43:14 2017
> @@ -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.
>
> Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp?rev=296413&r1=296412&r2=296413&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp (original)
> +++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp Mon Feb 27
> 17:43:14 2017
> @@ -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(co
> 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) {
>
> Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp?rev=296413&r1=296412&r2=296413&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp (original)
> +++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp Mon Feb 27 17:43:14
> 2017
> @@ -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(); }
>
> Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp?rev=296413&r1=296412&r2=296413&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp (original)
> +++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp Mon Feb 27 17:43:14 2017
> @@ -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 &O
> OS << ")\n";
> }
>
> -} // end anonymous namespace
> -
> bool DWARFDie::isSubprogramDIE() const {
> return getTag() == DW_TAG_subprogram;
> }
> @@ -356,7 +362,6 @@ void DWARFDie::dump(raw_ostream &OS, uns
> }
> }
>
> -
> void DWARFDie::getInlinedChainForAddress(
> const uint64_t Address, SmallVectorImpl<DWARFDie> &InlinedChain)
> const {
> if (isNULL())
>
> Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFFormValue.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFFormValue.cpp?rev=296413&r1=296412&r2=296413&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/DebugInfo/DWARF/DWARFFormValue.cpp (original)
> +++ llvm/trunk/lib/DebugInfo/DWARF/DWARFFormValue.cpp Mon Feb 27 17:43:14
> 2017
> @@ -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) co
>
> 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::getAs
> return None;
> return Value.uval;
> }
> -
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170306/871029de/attachment.html>
More information about the llvm-commits
mailing list