}
};
-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 {
/// should be filled with data.
struct DILineInfoSpecifier {
enum class FileLineInfoKind { None, Default, AbsoluteFilePath };
- typedef DINameKind FunctionNameKind;
+ using FunctionNameKind = DINameKind;
FileLineInfoKind FLIKind;
FunctionNameKind FNKind;
// 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,
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.
/// the ByteSize member.
Optional<int64_t> getByteSize(const DWARFUnit &U) const;
};
- typedef SmallVector<AttributeSpec, 8> AttributeSpecVector;
+ using AttributeSpecVector = SmallVector<AttributeSpec, 8>;
DWARFAbbreviationDeclaration();
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());
};
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;
};
#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"
#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;
std::unique_ptr<DWARFDebugLocDWO> LocDWO;
/// The maximum DWARF version of all units.
- unsigned MaxVersion;
+ unsigned MaxVersion = 0;
struct DWOFile {
object::OwningBinary<object::ObjectFile> File;
void parseDWOTypeUnits();
public:
- DWARFContext() : DIContext(CK_DWARF), MaxVersion(0) {}
+ DWARFContext() : DIContext(CK_DWARF) {}
DWARFContext(DWARFContext &) = delete;
DWARFContext &operator=(DWARFContext &) = delete;
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() {
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;
namespace llvm {
+class raw_ostream;
+
class DWARFAbbreviationDeclarationSet {
uint32_t Offset;
/// Code of the first abbreviation, if all abbreviations in the set have
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();
};
class DWARFDebugAbbrev {
- typedef std::map<uint64_t, DWARFAbbreviationDeclarationSet>
- DWARFAbbreviationDeclarationSetMap;
+ using DWARFAbbreviationDeclarationSetMap =
+ std::map<uint64_t, DWARFAbbreviationDeclarationSet>;
DWARFAbbreviationDeclarationSetMap AbbrDeclSets;
mutable DWARFAbbreviationDeclarationSetMap::const_iterator PrevAbbrOffsetPos;
};
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;
}
};
- 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;
#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"
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;
}
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;
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;
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.
SmallVector<Entry, 2> Entries;
};
- typedef SmallVector<LocationList, 4> LocationLists;
+ using LocationLists = SmallVector<LocationList, 4>;
LocationLists Locations;
};
};
- typedef SmallVector<Entry, 4> MacroList;
+ using MacroList = SmallVector<Entry, 4>;
/// A list of all the macro entries in the debug_macinfo section.
MacroList Macros;
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
#include "llvm/Support/DataExtractor.h"
-
#include <cassert>
#include <cstdint>
-#include <utility>
#include <vector>
namespace llvm {
};
/// DWARFAddressRangesVector - represents a set of absolute address ranges.
-typedef std::vector<DWARFAddressRange> DWARFAddressRangesVector;
+using DWARFAddressRangesVector = std::vector<DWARFAddressRange>;
class DWARFDebugRangeList {
public:
#include "llvm/ADT/DenseMap.h"
#include <cstdint>
-#include <utility>
namespace llvm {
/// 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
#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>
#include <cstdint>
#include <map>
#include <memory>
+#include <utility>
#include <vector>
namespace llvm {
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(
/// 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;
#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`.
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;
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
#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',
};
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;
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
-//===- MappedBlockStream.h - Discontiguous stream data in an MSF -*- C++
-//-*-===//
+//==- MappedBlockStream.h - Discontiguous stream data in an MSF --*- C++ -*-==//
//
// The LLVM Compiler Infrastructure
//
#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"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include <cstdint>
+#include <memory>
#include <vector>
namespace llvm {
/// of bytes.
class MappedBlockStream : public BinaryStream {
friend class WritableMappedBlockStream;
+
public:
static std::unique_ptr<MappedBlockStream>
createStream(uint32_t BlockSize, const MSFStreamLayout &Layout,
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,
uint32_t getLength() override;
- llvm::BumpPtrAllocator &getAllocator() { return Allocator; }
+ BumpPtrAllocator &getAllocator() { return Allocator; }
void invalidateCache();
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
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,
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(); }
private:
MappedBlockStream ReadInterface;
-
WritableBinaryStreamRef WriteInterface;
};
-//===-- SymbolizableModule.h ------------------------------------ C++ -----===//
+//===- SymbolizableModule.h -------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
#define LLVM_DEBUGINFO_SYMBOLIZE_SYMBOLIZABLEMODULE_H
#include "llvm/DebugInfo/DIContext.h"
-
-namespace llvm {
-namespace object {
-class ObjectFile;
-}
-}
+#include <cstdint>
namespace llvm {
namespace symbolize {
class SymbolizableModule {
public:
- virtual ~SymbolizableModule() {}
+ virtual ~SymbolizableModule() = default;
+
virtual DILineInfo symbolizeCode(uint64_t ModuleOffset,
FunctionNameKind FNKind,
bool UseSymbolTable) const = 0;
virtual uint64_t getModulePreferredBase() const = 0;
};
-} // namespace symbolize
-} // namespace llvm
+} // end namespace symbolize
+} // end namespace llvm
#endif // LLVM_DEBUGINFO_SYMBOLIZE_SYMBOLIZABLEMODULE_H
-//===-- Symbolize.h --------------------------------------------- C++ -----===//
+//===- Symbolize.h ----------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// 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 {
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 = "")
};
LLVMSymbolizer(const Options &Opts = Options()) : Opts(Opts) {}
+
~LLVMSymbolizer() {
flush();
}
Expected<DIGlobal> symbolizeData(const std::string &ModuleName,
uint64_t ModuleOffset);
void flush();
+
static std::string
DemangleName(const std::string &Name,
const SymbolizableModule *DbiModuleDescriptor);
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
Options Opts;
};
-} // namespace symbolize
-} // namespace llvm
+} // end namespace symbolize
+} // end namespace llvm
-#endif
+#endif // LLVM_DEBUGINFO_SYMBOLIZE_SYMBOLIZE_H
#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"
#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"
#include <algorithm>
#include <cstdint>
#include <map>
-#include <set>
#include <string>
+#include <tuple>
#include <utility>
#include <vector>
#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,
}
}
-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;
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});
}
}
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/DWARF/DWARFDebugFrame.h"
-
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Optional.h"
/// 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)
#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"
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(); }
}
DWARFDebugLine::ParsingState::ParsingState(struct LineTable *LT)
- : LineTable(LT), RowNumber(0) {
+ : LineTable(LT) {
resetRowAndSequence();
}
-//===-- DWARFUnit.cpp -----------------------------------------------------===//
+//===- DWARFUnit.cpp ------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#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"
#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>
#include <cstddef>
#include <cstdint>
#include <cstdio>
+#include <utility>
#include <vector>
using namespace llvm;
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();
}
+//===- MSFBuilder.cpp -----------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
//
//===----------------------------------------------------------------------===//
+#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)
// 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());
-//===- MSFCommon.cpp - Common types and functions for MSF files -*- C++ -*-===//
+//===- MSFCommon.cpp - Common types and functions for MSF files -----------===//
//
// The LLVM Compiler Infrastructure
//
#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;
//===----------------------------------------------------------------------===//
#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) {
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));
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];