mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
[DebugInfo] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 306169
This commit is contained in:
parent
531daa9d45
commit
403aa6c77c
@ -57,7 +57,7 @@ struct DILineInfo {
|
||||
}
|
||||
};
|
||||
|
||||
typedef SmallVector<std::pair<uint64_t, DILineInfo>, 16> DILineInfoTable;
|
||||
using DILineInfoTable = SmallVector<std::pair<uint64_t, DILineInfo>, 16>;
|
||||
|
||||
/// DIInliningInfo - a format-neutral container for inlined code description.
|
||||
class DIInliningInfo {
|
||||
@ -102,7 +102,7 @@ enum class DINameKind { None, ShortName, LinkageName };
|
||||
/// should be filled with data.
|
||||
struct DILineInfoSpecifier {
|
||||
enum class FileLineInfoKind { None, Default, AbsoluteFilePath };
|
||||
typedef DINameKind FunctionNameKind;
|
||||
using FunctionNameKind = DINameKind;
|
||||
|
||||
FileLineInfoKind FLIKind;
|
||||
FunctionNameKind FNKind;
|
||||
@ -174,6 +174,7 @@ public:
|
||||
// No verifier? Just say things went well.
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual DILineInfo getLineInfoForAddress(uint64_t Address,
|
||||
DILineInfoSpecifier Specifier = DILineInfoSpecifier()) = 0;
|
||||
virtual DILineInfoTable getLineInfoForAddressRange(uint64_t Address,
|
||||
|
@ -33,6 +33,7 @@ public:
|
||||
|
||||
dwarf::Attribute Attr;
|
||||
dwarf::Form Form;
|
||||
|
||||
/// The following field is used for ByteSize for non-implicit_const
|
||||
/// attributes and as value for implicit_const ones, indicated by
|
||||
/// Form == DW_FORM_implicit_const.
|
||||
@ -58,7 +59,7 @@ public:
|
||||
/// the ByteSize member.
|
||||
Optional<int64_t> getByteSize(const DWARFUnit &U) const;
|
||||
};
|
||||
typedef SmallVector<AttributeSpec, 8> AttributeSpecVector;
|
||||
using AttributeSpecVector = SmallVector<AttributeSpec, 8>;
|
||||
|
||||
DWARFAbbreviationDeclaration();
|
||||
|
||||
@ -67,8 +68,8 @@ public:
|
||||
dwarf::Tag getTag() const { return Tag; }
|
||||
bool hasChildren() const { return HasChildren; }
|
||||
|
||||
typedef iterator_range<AttributeSpecVector::const_iterator>
|
||||
attr_iterator_range;
|
||||
using attr_iterator_range =
|
||||
iterator_range<AttributeSpecVector::const_iterator>;
|
||||
|
||||
attr_iterator_range attributes() const {
|
||||
return attr_iterator_range(AttributeSpecs.begin(), AttributeSpecs.end());
|
||||
|
@ -32,8 +32,9 @@ class DWARFAcceleratorTable {
|
||||
};
|
||||
|
||||
struct HeaderData {
|
||||
typedef uint16_t AtomType;
|
||||
typedef dwarf::Form Form;
|
||||
using AtomType = uint16_t;
|
||||
using Form = dwarf::Form;
|
||||
|
||||
uint32_t DIEOffsetBase;
|
||||
SmallVector<std::pair<AtomType, Form>, 3> Atoms;
|
||||
};
|
||||
|
@ -10,7 +10,6 @@
|
||||
#ifndef LLVM_DEBUGINFO_DWARF_DWARFCONTEXT_H
|
||||
#define LLVM_DEBUGINFO_DWARF_DWARFCONTEXT_H
|
||||
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/MapVector.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
@ -25,21 +24,24 @@
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDebugLine.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDebugMacro.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFGdbIndex.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFSection.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFTypeUnit.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
|
||||
#include "llvm/Object/Binary.h"
|
||||
#include "llvm/Object/ObjectFile.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/Host.h"
|
||||
#include <cstdint>
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class DataExtractor;
|
||||
class MemoryBuffer;
|
||||
class raw_ostream;
|
||||
|
||||
@ -73,7 +75,7 @@ class DWARFContext : public DIContext {
|
||||
std::unique_ptr<DWARFDebugLocDWO> LocDWO;
|
||||
|
||||
/// The maximum DWARF version of all units.
|
||||
unsigned MaxVersion;
|
||||
unsigned MaxVersion = 0;
|
||||
|
||||
struct DWOFile {
|
||||
object::OwningBinary<object::ObjectFile> File;
|
||||
@ -100,7 +102,7 @@ class DWARFContext : public DIContext {
|
||||
void parseDWOTypeUnits();
|
||||
|
||||
public:
|
||||
DWARFContext() : DIContext(CK_DWARF), MaxVersion(0) {}
|
||||
DWARFContext() : DIContext(CK_DWARF) {}
|
||||
DWARFContext(DWARFContext &) = delete;
|
||||
DWARFContext &operator=(DWARFContext &) = delete;
|
||||
|
||||
@ -112,9 +114,9 @@ public:
|
||||
|
||||
bool verify(raw_ostream &OS, DIDumpType DumpType = DIDT_All) override;
|
||||
|
||||
typedef DWARFUnitSection<DWARFCompileUnit>::iterator_range cu_iterator_range;
|
||||
typedef DWARFUnitSection<DWARFTypeUnit>::iterator_range tu_iterator_range;
|
||||
typedef iterator_range<decltype(TUs)::iterator> tu_section_iterator_range;
|
||||
using cu_iterator_range = DWARFUnitSection<DWARFCompileUnit>::iterator_range;
|
||||
using tu_iterator_range = DWARFUnitSection<DWARFTypeUnit>::iterator_range;
|
||||
using tu_section_iterator_range = iterator_range<decltype(TUs)::iterator>;
|
||||
|
||||
/// Get compile units in this context.
|
||||
cu_iterator_range compile_units() {
|
||||
@ -230,8 +232,10 @@ public:
|
||||
virtual bool isLittleEndian() const = 0;
|
||||
virtual uint8_t getAddressSize() const = 0;
|
||||
virtual const DWARFSection &getInfoSection() = 0;
|
||||
typedef MapVector<object::SectionRef, DWARFSection,
|
||||
std::map<object::SectionRef, unsigned>> TypeSectionMap;
|
||||
|
||||
using TypeSectionMap = MapVector<object::SectionRef, DWARFSection,
|
||||
std::map<object::SectionRef, unsigned>>;
|
||||
|
||||
virtual const TypeSectionMap &getTypesSections() = 0;
|
||||
virtual StringRef getAbbrevSection() = 0;
|
||||
virtual const DWARFSection &getLocSection() = 0;
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class raw_ostream;
|
||||
|
||||
class DWARFAbbreviationDeclarationSet {
|
||||
uint32_t Offset;
|
||||
/// Code of the first abbreviation, if all abbreviations in the set have
|
||||
@ -25,8 +27,8 @@ class DWARFAbbreviationDeclarationSet {
|
||||
uint32_t FirstAbbrCode;
|
||||
std::vector<DWARFAbbreviationDeclaration> Decls;
|
||||
|
||||
typedef std::vector<DWARFAbbreviationDeclaration>::const_iterator
|
||||
const_iterator;
|
||||
using const_iterator =
|
||||
std::vector<DWARFAbbreviationDeclaration>::const_iterator;
|
||||
|
||||
public:
|
||||
DWARFAbbreviationDeclarationSet();
|
||||
@ -51,8 +53,8 @@ private:
|
||||
};
|
||||
|
||||
class DWARFDebugAbbrev {
|
||||
typedef std::map<uint64_t, DWARFAbbreviationDeclarationSet>
|
||||
DWARFAbbreviationDeclarationSetMap;
|
||||
using DWARFAbbreviationDeclarationSetMap =
|
||||
std::map<uint64_t, DWARFAbbreviationDeclarationSet>;
|
||||
|
||||
DWARFAbbreviationDeclarationSetMap AbbrDeclSets;
|
||||
mutable DWARFAbbreviationDeclarationSetMap::const_iterator PrevAbbrOffsetPos;
|
||||
|
@ -46,8 +46,8 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
typedef std::vector<Descriptor> DescriptorColl;
|
||||
typedef iterator_range<DescriptorColl::const_iterator> desc_iterator_range;
|
||||
using DescriptorColl = std::vector<Descriptor>;
|
||||
using desc_iterator_range = iterator_range<DescriptorColl::const_iterator>;
|
||||
|
||||
uint32_t Offset;
|
||||
Header HeaderData;
|
||||
|
@ -76,8 +76,8 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::vector<Range> RangeColl;
|
||||
typedef RangeColl::const_iterator RangeCollIterator;
|
||||
using RangeColl = std::vector<Range>;
|
||||
using RangeCollIterator = RangeColl::const_iterator;
|
||||
|
||||
std::vector<RangeEndpoint> Endpoints;
|
||||
RangeColl Aranges;
|
||||
|
@ -10,6 +10,7 @@
|
||||
#ifndef LLVM_DEBUGINFO_DWARFDEBUGLINE_H
|
||||
#define LLVM_DEBUGINFO_DWARFDEBUGLINE_H
|
||||
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/DIContext.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
|
||||
#include "llvm/Support/DataExtractor.h"
|
||||
@ -104,7 +105,9 @@ public:
|
||||
void postAppend();
|
||||
void reset(bool DefaultIsStmt);
|
||||
void dump(raw_ostream &OS) const;
|
||||
|
||||
static void dumpTableHeader(raw_ostream &OS);
|
||||
|
||||
static bool orderByAddress(const Row &LHS, const Row &RHS) {
|
||||
return LHS.Address < RHS.Address;
|
||||
}
|
||||
@ -216,11 +219,12 @@ public:
|
||||
bool parse(DataExtractor DebugLineData, const RelocAddrMap *RMap,
|
||||
uint32_t *OffsetPtr);
|
||||
|
||||
using RowVector = std::vector<Row>;
|
||||
using RowIter = RowVector::const_iterator;
|
||||
using SequenceVector = std::vector<Sequence>;
|
||||
using SequenceIter = SequenceVector::const_iterator;
|
||||
|
||||
struct Prologue Prologue;
|
||||
typedef std::vector<Row> RowVector;
|
||||
typedef RowVector::const_iterator RowIter;
|
||||
typedef std::vector<Sequence> SequenceVector;
|
||||
typedef SequenceVector::const_iterator SequenceIter;
|
||||
RowVector Rows;
|
||||
SequenceVector Sequences;
|
||||
|
||||
@ -244,14 +248,14 @@ private:
|
||||
struct LineTable *LineTable;
|
||||
/// The row number that starts at zero for the prologue, and increases for
|
||||
/// each row added to the matrix.
|
||||
unsigned RowNumber;
|
||||
unsigned RowNumber = 0;
|
||||
struct Row Row;
|
||||
struct Sequence Sequence;
|
||||
};
|
||||
|
||||
typedef std::map<uint32_t, LineTable> LineTableMapTy;
|
||||
typedef LineTableMapTy::iterator LineTableIter;
|
||||
typedef LineTableMapTy::const_iterator LineTableConstIter;
|
||||
using LineTableMapTy = std::map<uint32_t, LineTable>;
|
||||
using LineTableIter = LineTableMapTy::iterator;
|
||||
using LineTableConstIter = LineTableMapTy::const_iterator;
|
||||
|
||||
const RelocAddrMap *RelocMap;
|
||||
LineTableMapTy LineTableMap;
|
||||
|
@ -39,7 +39,7 @@ class DWARFDebugLoc {
|
||||
SmallVector<Entry, 2> Entries;
|
||||
};
|
||||
|
||||
typedef SmallVector<LocationList, 4> LocationLists;
|
||||
using LocationLists = SmallVector<LocationList, 4>;
|
||||
|
||||
/// A list of all the variables in the debug_loc section, each one describing
|
||||
/// the locations in which the variable is stored.
|
||||
@ -71,7 +71,7 @@ class DWARFDebugLocDWO {
|
||||
SmallVector<Entry, 2> Entries;
|
||||
};
|
||||
|
||||
typedef SmallVector<LocationList, 4> LocationLists;
|
||||
using LocationLists = SmallVector<LocationList, 4>;
|
||||
|
||||
LocationLists Locations;
|
||||
|
||||
|
@ -40,7 +40,7 @@ class DWARFDebugMacro {
|
||||
};
|
||||
};
|
||||
|
||||
typedef SmallVector<Entry, 4> MacroList;
|
||||
using MacroList = SmallVector<Entry, 4>;
|
||||
|
||||
/// A list of all the macro entries in the debug_macinfo section.
|
||||
MacroList Macros;
|
||||
|
@ -12,10 +12,8 @@
|
||||
|
||||
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
|
||||
#include "llvm/Support/DataExtractor.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
@ -29,7 +27,7 @@ struct DWARFAddressRange {
|
||||
};
|
||||
|
||||
/// DWARFAddressRangesVector - represents a set of absolute address ranges.
|
||||
typedef std::vector<DWARFAddressRange> DWARFAddressRangesVector;
|
||||
using DWARFAddressRangesVector = std::vector<DWARFAddressRange>;
|
||||
|
||||
class DWARFDebugRangeList {
|
||||
public:
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
@ -28,7 +27,7 @@ struct RelocAddrEntry {
|
||||
/// dwarf where we expect relocated values. This adds a bit of complexity to the
|
||||
/// dwarf parsing/extraction at the benefit of not allocating memory for the
|
||||
/// entire size of the debug info sections.
|
||||
typedef DenseMap<uint64_t, RelocAddrEntry> RelocAddrMap;
|
||||
using RelocAddrMap = DenseMap<uint64_t, RelocAddrEntry>;
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
|
@ -22,8 +22,6 @@
|
||||
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFSection.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
|
||||
#include "llvm/Object/Binary.h"
|
||||
#include "llvm/Object/ObjectFile.h"
|
||||
#include "llvm/Support/DataExtractor.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
@ -31,6 +29,7 @@
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
@ -72,9 +71,9 @@ class DWARFUnitSection final : public SmallVector<std::unique_ptr<UnitType>, 1>,
|
||||
bool Parsed = false;
|
||||
|
||||
public:
|
||||
typedef SmallVectorImpl<std::unique_ptr<UnitType>> UnitVector;
|
||||
typedef typename UnitVector::iterator iterator;
|
||||
typedef llvm::iterator_range<typename UnitVector::iterator> iterator_range;
|
||||
using UnitVector = SmallVectorImpl<std::unique_ptr<UnitType>>;
|
||||
using iterator = typename UnitVector::iterator;
|
||||
using iterator_range = llvm::iterator_range<typename UnitVector::iterator>;
|
||||
|
||||
UnitType *getUnitForOffset(uint32_t Offset) const override {
|
||||
auto *CU = std::upper_bound(
|
||||
@ -142,8 +141,9 @@ class DWARFUnit {
|
||||
/// IntervalMap does not support range removal, as a result, we use the
|
||||
/// std::map::upper_bound for address range lookup.
|
||||
std::map<uint64_t, std::pair<uint64_t, DWARFDie>> AddrDieMap;
|
||||
typedef iterator_range<std::vector<DWARFDebugInfoEntry>::iterator>
|
||||
die_iterator_range;
|
||||
|
||||
using die_iterator_range =
|
||||
iterator_range<std::vector<DWARFDebugInfoEntry>::iterator>;
|
||||
|
||||
std::shared_ptr<DWARFUnit> DWO;
|
||||
|
||||
|
@ -12,18 +12,16 @@
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
|
||||
#include "llvm/DebugInfo/MSF/MSFCommon.h"
|
||||
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
namespace msf {
|
||||
|
||||
class MSFBuilder {
|
||||
public:
|
||||
/// \brief Create a new `MSFBuilder`.
|
||||
@ -122,7 +120,7 @@ private:
|
||||
Error allocateBlocks(uint32_t NumBlocks, MutableArrayRef<uint32_t> Blocks);
|
||||
uint32_t computeDirectoryByteSize() const;
|
||||
|
||||
typedef std::vector<uint32_t> BlockList;
|
||||
using BlockList = std::vector<uint32_t>;
|
||||
|
||||
BumpPtrAllocator &Allocator;
|
||||
|
||||
@ -136,7 +134,8 @@ private:
|
||||
std::vector<uint32_t> DirectoryBlocks;
|
||||
std::vector<std::pair<uint32_t, BlockList>> StreamData;
|
||||
};
|
||||
} // namespace msf
|
||||
} // namespace llvm
|
||||
|
||||
} // end namespace msf
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_MSF_MSFBUILDER_H
|
||||
|
@ -12,15 +12,15 @@
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
namespace msf {
|
||||
|
||||
static const char Magic[] = {'M', 'i', 'c', 'r', 'o', 's', 'o', 'f',
|
||||
't', ' ', 'C', '/', 'C', '+', '+', ' ',
|
||||
'M', 'S', 'F', ' ', '7', '.', '0', '0',
|
||||
@ -50,8 +50,9 @@ struct SuperBlock {
|
||||
};
|
||||
|
||||
struct MSFLayout {
|
||||
MSFLayout() : SB(nullptr) {}
|
||||
const SuperBlock *SB;
|
||||
MSFLayout() = default;
|
||||
|
||||
const SuperBlock *SB = nullptr;
|
||||
BitVector FreePageMap;
|
||||
ArrayRef<support::ulittle32_t> DirectoryBlocks;
|
||||
ArrayRef<support::ulittle32_t> StreamSizes;
|
||||
@ -90,15 +91,16 @@ inline uint32_t getFpmIntervalLength(const MSFLayout &L) {
|
||||
|
||||
inline uint32_t getNumFpmIntervals(const MSFLayout &L) {
|
||||
uint32_t Length = getFpmIntervalLength(L);
|
||||
return llvm::alignTo(L.SB->NumBlocks, Length) / Length;
|
||||
return alignTo(L.SB->NumBlocks, Length) / Length;
|
||||
}
|
||||
|
||||
inline uint32_t getFullFpmByteSize(const MSFLayout &L) {
|
||||
return llvm::alignTo(L.SB->NumBlocks, 8) / 8;
|
||||
return alignTo(L.SB->NumBlocks, 8) / 8;
|
||||
}
|
||||
|
||||
Error validateSuperBlock(const SuperBlock &SB);
|
||||
} // namespace msf
|
||||
} // namespace llvm
|
||||
|
||||
} // end namespace msf
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_MSF_MSFCOMMON_H
|
||||
|
@ -1,5 +1,4 @@
|
||||
//===- MappedBlockStream.h - Discontiguous stream data in an MSF -*- C++
|
||||
//-*-===//
|
||||
//==- MappedBlockStream.h - Discontiguous stream data in an MSF --*- C++ -*-==//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -13,7 +12,6 @@
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/DebugInfo/MSF/MSFStreamLayout.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/BinaryStream.h"
|
||||
@ -21,6 +19,7 @@
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
@ -40,6 +39,7 @@ struct MSFLayout;
|
||||
/// of bytes.
|
||||
class MappedBlockStream : public BinaryStream {
|
||||
friend class WritableMappedBlockStream;
|
||||
|
||||
public:
|
||||
static std::unique_ptr<MappedBlockStream>
|
||||
createStream(uint32_t BlockSize, const MSFStreamLayout &Layout,
|
||||
@ -57,8 +57,8 @@ public:
|
||||
createDirectoryStream(const MSFLayout &Layout, BinaryStreamRef MsfData,
|
||||
BumpPtrAllocator &Allocator);
|
||||
|
||||
llvm::support::endianness getEndian() const override {
|
||||
return llvm::support::little;
|
||||
support::endianness getEndian() const override {
|
||||
return support::little;
|
||||
}
|
||||
|
||||
Error readBytes(uint32_t Offset, uint32_t Size,
|
||||
@ -68,7 +68,7 @@ public:
|
||||
|
||||
uint32_t getLength() override;
|
||||
|
||||
llvm::BumpPtrAllocator &getAllocator() { return Allocator; }
|
||||
BumpPtrAllocator &getAllocator() { return Allocator; }
|
||||
|
||||
void invalidateCache();
|
||||
|
||||
@ -92,7 +92,7 @@ private:
|
||||
const MSFStreamLayout StreamLayout;
|
||||
BinaryStreamRef MsfData;
|
||||
|
||||
typedef MutableArrayRef<uint8_t> CacheEntry;
|
||||
using CacheEntry = MutableArrayRef<uint8_t>;
|
||||
|
||||
// We just store the allocator by reference. We use this to allocate
|
||||
// contiguous memory for things like arrays or strings that cross a block
|
||||
@ -124,8 +124,8 @@ public:
|
||||
createFpmStream(const MSFLayout &Layout, WritableBinaryStreamRef MsfData,
|
||||
BumpPtrAllocator &Allocator);
|
||||
|
||||
llvm::support::endianness getEndian() const override {
|
||||
return llvm::support::little;
|
||||
support::endianness getEndian() const override {
|
||||
return support::little;
|
||||
}
|
||||
|
||||
Error readBytes(uint32_t Offset, uint32_t Size,
|
||||
@ -141,6 +141,7 @@ public:
|
||||
const MSFStreamLayout &getStreamLayout() const {
|
||||
return ReadInterface.getStreamLayout();
|
||||
}
|
||||
|
||||
uint32_t getBlockSize() const { return ReadInterface.getBlockSize(); }
|
||||
uint32_t getNumBlocks() const { return ReadInterface.getNumBlocks(); }
|
||||
uint32_t getStreamLength() const { return ReadInterface.getStreamLength(); }
|
||||
@ -153,7 +154,6 @@ protected:
|
||||
|
||||
private:
|
||||
MappedBlockStream ReadInterface;
|
||||
|
||||
WritableBinaryStreamRef WriteInterface;
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- SymbolizableModule.h ------------------------------------ C++ -----===//
|
||||
//===- SymbolizableModule.h -------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -14,12 +14,7 @@
|
||||
#define LLVM_DEBUGINFO_SYMBOLIZE_SYMBOLIZABLEMODULE_H
|
||||
|
||||
#include "llvm/DebugInfo/DIContext.h"
|
||||
|
||||
namespace llvm {
|
||||
namespace object {
|
||||
class ObjectFile;
|
||||
}
|
||||
}
|
||||
#include <cstdint>
|
||||
|
||||
namespace llvm {
|
||||
namespace symbolize {
|
||||
@ -28,7 +23,8 @@ using FunctionNameKind = DILineInfoSpecifier::FunctionNameKind;
|
||||
|
||||
class SymbolizableModule {
|
||||
public:
|
||||
virtual ~SymbolizableModule() {}
|
||||
virtual ~SymbolizableModule() = default;
|
||||
|
||||
virtual DILineInfo symbolizeCode(uint64_t ModuleOffset,
|
||||
FunctionNameKind FNKind,
|
||||
bool UseSymbolTable) const = 0;
|
||||
@ -45,7 +41,7 @@ public:
|
||||
virtual uint64_t getModulePreferredBase() const = 0;
|
||||
};
|
||||
|
||||
} // namespace symbolize
|
||||
} // namespace llvm
|
||||
} // end namespace symbolize
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_SYMBOLIZE_SYMBOLIZABLEMODULE_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- Symbolize.h --------------------------------------------- C++ -----===//
|
||||
//===- Symbolize.h ----------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -10,21 +10,27 @@
|
||||
// Header for LLVM symbolization library.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_SYMBOLIZE_SYMBOLIZE_H
|
||||
#define LLVM_DEBUGINFO_SYMBOLIZE_SYMBOLIZE_H
|
||||
|
||||
#include "llvm/DebugInfo/Symbolize/SymbolizableModule.h"
|
||||
#include "llvm/Object/Binary.h"
|
||||
#include "llvm/Object/ObjectFile.h"
|
||||
#include "llvm/Support/ErrorOr.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
namespace symbolize {
|
||||
|
||||
using namespace object;
|
||||
|
||||
using FunctionNameKind = DILineInfoSpecifier::FunctionNameKind;
|
||||
|
||||
class LLVMSymbolizer {
|
||||
@ -36,6 +42,7 @@ public:
|
||||
bool RelativeAddresses : 1;
|
||||
std::string DefaultArch;
|
||||
std::vector<std::string> DsymHints;
|
||||
|
||||
Options(FunctionNameKind PrintFunctions = FunctionNameKind::LinkageName,
|
||||
bool UseSymbolTable = true, bool Demangle = true,
|
||||
bool RelativeAddresses = false, std::string DefaultArch = "")
|
||||
@ -45,6 +52,7 @@ public:
|
||||
};
|
||||
|
||||
LLVMSymbolizer(const Options &Opts = Options()) : Opts(Opts) {}
|
||||
|
||||
~LLVMSymbolizer() {
|
||||
flush();
|
||||
}
|
||||
@ -56,6 +64,7 @@ public:
|
||||
Expected<DIGlobal> symbolizeData(const std::string &ModuleName,
|
||||
uint64_t ModuleOffset);
|
||||
void flush();
|
||||
|
||||
static std::string
|
||||
DemangleName(const std::string &Name,
|
||||
const SymbolizableModule *DbiModuleDescriptor);
|
||||
@ -63,7 +72,7 @@ public:
|
||||
private:
|
||||
// Bundles together object file with code/data and object file with
|
||||
// corresponding debug info. These objects can be the same.
|
||||
typedef std::pair<ObjectFile*, ObjectFile*> ObjectPair;
|
||||
using ObjectPair = std::pair<ObjectFile *, ObjectFile *>;
|
||||
|
||||
/// Returns a SymbolizableModule or an error if loading debug info failed.
|
||||
/// Only one attempt is made to load a module, and errors during loading are
|
||||
@ -106,7 +115,7 @@ private:
|
||||
Options Opts;
|
||||
};
|
||||
|
||||
} // namespace symbolize
|
||||
} // namespace llvm
|
||||
} // end namespace symbolize
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_DEBUGINFO_SYMBOLIZE_SYMBOLIZE_H
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
|
||||
@ -36,7 +37,6 @@
|
||||
#include "llvm/Object/RelocVisitor.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/DataExtractor.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
@ -44,8 +44,8 @@
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@ -55,9 +55,9 @@ using namespace object;
|
||||
|
||||
#define DEBUG_TYPE "dwarf"
|
||||
|
||||
typedef DWARFDebugLine::LineTable DWARFLineTable;
|
||||
typedef DILineInfoSpecifier::FileLineInfoKind FileLineInfoKind;
|
||||
typedef DILineInfoSpecifier::FunctionNameKind FunctionNameKind;
|
||||
using DWARFLineTable = DWARFDebugLine::LineTable;
|
||||
using FileLineInfoKind = DILineInfoSpecifier::FileLineInfoKind;
|
||||
using FunctionNameKind = DILineInfoSpecifier::FunctionNameKind;
|
||||
|
||||
uint64_t llvm::getRelocatedValue(const DataExtractor &Data, uint32_t Size,
|
||||
uint32_t *Off, const RelocAddrMap *Relocs,
|
||||
@ -201,8 +201,7 @@ static void dumpStringOffsetsSection(raw_ostream &OS, StringRef SectionName,
|
||||
}
|
||||
}
|
||||
|
||||
void DWARFContext::dump(raw_ostream &OS, DIDumpOptions DumpOpts){
|
||||
|
||||
void DWARFContext::dump(raw_ostream &OS, DIDumpOptions DumpOpts) {
|
||||
DIDumpType DumpType = DumpOpts.DumpType;
|
||||
bool DumpEH = DumpOpts.DumpEH;
|
||||
bool SummarizeTypes = DumpOpts.SummarizeTypes;
|
||||
@ -1068,7 +1067,7 @@ DWARFContextInMemory::DWARFContextInMemory(const object::ObjectFile &Obj,
|
||||
errs() << "error: failed to compute relocation: " << Name << "\n";
|
||||
continue;
|
||||
}
|
||||
llvm::RelocAddrEntry Rel = {SymInfoOrErr->SectionIndex, Val};
|
||||
RelocAddrEntry Rel = {SymInfoOrErr->SectionIndex, Val};
|
||||
Map->insert({Reloc.getOffset(), Rel});
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDebugFrame.h"
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
@ -71,7 +70,7 @@ protected:
|
||||
|
||||
/// An entry may contain CFI instructions. An instruction consists of an
|
||||
/// opcode and an optional sequence of operands.
|
||||
typedef std::vector<uint64_t> Operands;
|
||||
using Operands = std::vector<uint64_t>;
|
||||
struct Instruction {
|
||||
Instruction(uint8_t Opcode)
|
||||
: Opcode(Opcode)
|
||||
|
@ -9,6 +9,8 @@
|
||||
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDebugLine.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
|
||||
@ -26,13 +28,17 @@
|
||||
using namespace llvm;
|
||||
using namespace dwarf;
|
||||
|
||||
typedef DILineInfoSpecifier::FileLineInfoKind FileLineInfoKind;
|
||||
using FileLineInfoKind = DILineInfoSpecifier::FileLineInfoKind;
|
||||
|
||||
namespace {
|
||||
|
||||
struct ContentDescriptor {
|
||||
dwarf::LineNumberEntryFormat Type;
|
||||
dwarf::Form Form;
|
||||
};
|
||||
typedef SmallVector<ContentDescriptor, 4> ContentDescriptors;
|
||||
|
||||
using ContentDescriptors = SmallVector<ContentDescriptor, 4>;
|
||||
|
||||
} // end anonmyous namespace
|
||||
|
||||
DWARFDebugLine::Prologue::Prologue() { clear(); }
|
||||
@ -333,7 +339,7 @@ void DWARFDebugLine::LineTable::clear() {
|
||||
}
|
||||
|
||||
DWARFDebugLine::ParsingState::ParsingState(struct LineTable *LT)
|
||||
: LineTable(LT), RowNumber(0) {
|
||||
: LineTable(LT) {
|
||||
resetRowAndSequence();
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- DWARFUnit.cpp -----------------------------------------------------===//
|
||||
//===- DWARFUnit.cpp ------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -8,7 +8,6 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
|
||||
@ -17,8 +16,6 @@
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
|
||||
#include "llvm/Object/ObjectFile.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/DataExtractor.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
#include <algorithm>
|
||||
@ -26,6 +23,7 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
@ -55,8 +53,8 @@ DWARFUnit::DWARFUnit(DWARFContext &DC, const DWARFSection &Section,
|
||||
const DWARFUnitIndex::Entry *IndexEntry)
|
||||
: Context(DC), InfoSection(Section), Abbrev(DA), RangeSection(RS),
|
||||
LineSection(LS), StringSection(SS), StringOffsetSection(SOS),
|
||||
StringOffsetSectionBase(0), AddrOffsetSection(AOS), isLittleEndian(LE),
|
||||
isDWO(IsDWO), UnitSection(UnitSection), IndexEntry(IndexEntry) {
|
||||
AddrOffsetSection(AOS), isLittleEndian(LE), isDWO(IsDWO),
|
||||
UnitSection(UnitSection), IndexEntry(IndexEntry) {
|
||||
clear();
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
//===- MSFBuilder.cpp -----------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -6,22 +7,30 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/DebugInfo/MSF/MSFBuilder.h"
|
||||
#include "llvm/DebugInfo/MSF/MSFError.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::msf;
|
||||
using namespace llvm::support;
|
||||
|
||||
namespace {
|
||||
const uint32_t kSuperBlockBlock = 0;
|
||||
const uint32_t kFreePageMap0Block = 1;
|
||||
const uint32_t kFreePageMap1Block = 2;
|
||||
const uint32_t kNumReservedPages = 3;
|
||||
static const uint32_t kSuperBlockBlock = 0;
|
||||
static const uint32_t kFreePageMap0Block = 1;
|
||||
static const uint32_t kFreePageMap1Block = 2;
|
||||
static const uint32_t kNumReservedPages = 3;
|
||||
|
||||
const uint32_t kDefaultFreePageMap = kFreePageMap0Block;
|
||||
const uint32_t kDefaultBlockMapAddr = kNumReservedPages;
|
||||
}
|
||||
static const uint32_t kDefaultFreePageMap = kFreePageMap0Block;
|
||||
static const uint32_t kDefaultBlockMapAddr = kNumReservedPages;
|
||||
|
||||
MSFBuilder::MSFBuilder(uint32_t BlockSize, uint32_t MinBlockCount, bool CanGrow,
|
||||
BumpPtrAllocator &Allocator)
|
||||
@ -263,7 +272,7 @@ Expected<MSFLayout> MSFBuilder::build() {
|
||||
|
||||
// The stream sizes should be re-allocated as a stable pointer and the stream
|
||||
// map should have each of its entries allocated as a separate stable pointer.
|
||||
if (StreamData.size() > 0) {
|
||||
if (!StreamData.empty()) {
|
||||
ulittle32_t *Sizes = Allocator.Allocate<ulittle32_t>(StreamData.size());
|
||||
L.StreamSizes = ArrayRef<ulittle32_t>(Sizes, StreamData.size());
|
||||
L.StreamMap.resize(StreamData.size());
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- MSFCommon.cpp - Common types and functions for MSF files -*- C++ -*-===//
|
||||
//===- MSFCommon.cpp - Common types and functions for MSF files -----------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -9,6 +9,10 @@
|
||||
|
||||
#include "llvm/DebugInfo/MSF/MSFCommon.h"
|
||||
#include "llvm/DebugInfo/MSF/MSFError.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::msf;
|
||||
|
@ -8,23 +8,33 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
|
||||
|
||||
#include "llvm/DebugInfo/MSF/IMSFFile.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/DebugInfo/MSF/MSFCommon.h"
|
||||
#include "llvm/DebugInfo/MSF/MSFStreamLayout.h"
|
||||
#include "llvm/Support/BinaryStreamError.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::msf;
|
||||
|
||||
namespace {
|
||||
|
||||
template <typename Base> class MappedBlockStreamImpl : public Base {
|
||||
public:
|
||||
template <typename... Args>
|
||||
MappedBlockStreamImpl(Args &&... Params)
|
||||
: Base(std::forward<Args>(Params)...) {}
|
||||
};
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
static void initializeFpmStreamLayout(const MSFLayout &Layout,
|
||||
MSFStreamLayout &FpmLayout) {
|
||||
@ -39,7 +49,8 @@ static void initializeFpmStreamLayout(const MSFLayout &Layout,
|
||||
FpmLayout.Length = msf::getFullFpmByteSize(Layout);
|
||||
}
|
||||
|
||||
typedef std::pair<uint32_t, uint32_t> Interval;
|
||||
using Interval = std::pair<uint32_t, uint32_t>;
|
||||
|
||||
static Interval intersect(const Interval &I1, const Interval &I2) {
|
||||
return std::make_pair(std::max(I1.first, I2.first),
|
||||
std::min(I1.second, I2.second));
|
||||
@ -214,7 +225,7 @@ bool MappedBlockStream::tryReadContiguously(uint32_t Offset, uint32_t Size,
|
||||
uint32_t OffsetInBlock = Offset % BlockSize;
|
||||
uint32_t BytesFromFirstBlock = std::min(Size, BlockSize - OffsetInBlock);
|
||||
uint32_t NumAdditionalBlocks =
|
||||
llvm::alignTo(Size - BytesFromFirstBlock, BlockSize) / BlockSize;
|
||||
alignTo(Size - BytesFromFirstBlock, BlockSize) / BlockSize;
|
||||
|
||||
uint32_t RequiredContiguousBlocks = NumAdditionalBlocks + 1;
|
||||
uint32_t E = StreamLayout.Blocks[BlockNum];
|
||||
|
Loading…
x
Reference in New Issue
Block a user