#ifndef LLVM_DEBUGINFO_CODEVIEW_TYPETABLEBUILDER_H
#define LLVM_DEBUGINFO_CODEVIEW_TYPETABLEBUILDER_H
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/DebugInfo/CodeView/TypeSerializer.h"
+#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Error.h"
+#include <algorithm>
+#include <cassert>
+#include <cstdint>
+#include <type_traits>
namespace llvm {
-
namespace codeview {
class TypeTableBuilder {
private:
- TypeTableBuilder(const TypeTableBuilder &) = delete;
- TypeTableBuilder &operator=(const TypeTableBuilder &) = delete;
-
- TypeIndex handleError(llvm::Error EC) const {
+ TypeIndex handleError(Error EC) const {
assert(false && "Couldn't write Type!");
- llvm::consumeError(std::move(EC));
+ consumeError(std::move(EC));
return TypeIndex();
}
public:
explicit TypeTableBuilder(BumpPtrAllocator &Allocator)
: Allocator(Allocator), Serializer(Allocator) {}
+ TypeTableBuilder(const TypeTableBuilder &) = delete;
+ TypeTableBuilder &operator=(const TypeTableBuilder &) = delete;
bool empty() const { return Serializer.records().empty(); }
return Index;
}
};
-}
-}
-#endif
+} // end namespace codeview
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_TYPETABLEBUILDER_H
#include "llvm/ADT/SmallVector.h"
#include "llvm/Object/ObjectFile.h"
-#include "llvm/Support/Casting.h"
-#include "llvm/Support/DataTypes.h"
+#include <cassert>
+#include <cstdint>
+#include <memory>
#include <string>
+#include <tuple>
+#include <utility>
namespace llvm {
/// DIInliningInfo - a format-neutral container for inlined code description.
class DIInliningInfo {
SmallVector<DILineInfo, 4> Frames;
- public:
- DIInliningInfo() {}
+
+public:
+ DIInliningInfo() = default;
+
DILineInfo getFrame(unsigned Index) const {
assert(Index < Frames.size());
return Frames[Index];
}
+
DILineInfo *getMutableFrame(unsigned Index) {
assert(Index < Frames.size());
return &Frames[Index];
}
+
uint32_t getNumberOfFrames() const {
return Frames.size();
}
+
void addFrame(const DILineInfo &Frame) {
Frames.push_back(Frame);
}
CK_DWARF,
CK_PDB
};
- DIContextKind getKind() const { return Kind; }
DIContext(DIContextKind K) : Kind(K) {}
- virtual ~DIContext() {}
+ virtual ~DIContext() = default;
+
+ DIContextKind getKind() const { return Kind; }
virtual void dump(raw_ostream &OS, DIDumpType DumpType = DIDT_All,
bool DumpEH = false, bool SummarizeTypes = false) = 0;
uint64_t Size, DILineInfoSpecifier Specifier = DILineInfoSpecifier()) = 0;
virtual DIInliningInfo getInliningInfoForAddress(uint64_t Address,
DILineInfoSpecifier Specifier = DILineInfoSpecifier()) = 0;
+
private:
const DIContextKind Kind;
};
virtual std::unique_ptr<LoadedObjectInfo> clone() const = 0;
};
-}
+} // end namespace llvm
-#endif
+#endif // LLVM_DEBUGINFO_DICONTEXT_H
#ifndef LLVM_LIB_DEBUGINFO_DWARFCONTEXT_H
#define LLVM_LIB_DEBUGINFO_DWARFCONTEXT_H
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/iterator_range.h"
#include "llvm/ADT/MapVector.h"
+#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/DIContext.h"
#include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
+#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugAranges.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugFrame.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugLine.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugMacro.h"
-#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.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/ObjectFile.h"
+#include <cstdint>
+#include <deque>
+#include <map>
+#include <memory>
+#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, std::pair<uint8_t, int64_t> > RelocAddrMap;
+typedef DenseMap<uint64_t, std::pair<uint8_t, int64_t>> RelocAddrMap;
/// DWARFContext
/// This data structure is the top level entity that deals with dwarf debug
/// information parsing. The actual data is supplied through pure virtual
/// methods that a concrete implementation provides.
class DWARFContext : public DIContext {
-
DWARFUnitSection<DWARFCompileUnit> CUs;
std::deque<DWARFUnitSection<DWARFTypeUnit>> TUs;
std::unique_ptr<DWARFUnitIndex> CUIndex;
std::unique_ptr<DWARFDebugAbbrev> AbbrevDWO;
std::unique_ptr<DWARFDebugLocDWO> LocDWO;
- DWARFContext(DWARFContext &) = delete;
- DWARFContext &operator=(DWARFContext &) = delete;
-
/// Read compile units from the debug_info section (if necessary)
/// and store them in CUs.
void parseCompileUnits();
public:
DWARFContext() : DIContext(CK_DWARF) {}
+ DWARFContext(DWARFContext &) = delete;
+ DWARFContext &operator=(DWARFContext &) = delete;
static bool classof(const DIContext *DICtx) {
return DICtx->getKind() == CK_DWARF;
static bool isSupportedVersion(unsigned version) {
return version == 2 || version == 3 || version == 4 || version == 5;
}
+
private:
/// Return the compile unit that includes an offset (relative to .debug_info).
DWARFCompileUnit *getCompileUnitForOffset(uint32_t Offset);
/// pointers to it.
class DWARFContextInMemory : public DWARFContext {
virtual void anchor();
+
bool IsLittleEndian;
uint8_t AddressSize;
DWARFSection InfoSection;
public:
DWARFContextInMemory(const object::ObjectFile &Obj,
const LoadedObjectInfo *L = nullptr);
+
bool isLittleEndian() const override { return IsLittleEndian; }
uint8_t getAddressSize() const override { return AddressSize; }
const DWARFSection &getInfoSection() override { return InfoSection; }
StringRef getTUIndexSection() override { return TUIndexSection; }
};
-}
+} // end namespace llvm
-#endif
+#endif // LLVM_LIB_DEBUGINFO_DWARFCONTEXT_H
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/DataExtractor.h"
-#include "llvm/Support/Dwarf.h"
+#include <cstdint>
namespace llvm {
MacroList Macros;
public:
- DWARFDebugMacro() {}
+ DWARFDebugMacro() = default;
+
/// Print the macro list found within the debug_macinfo section.
void dump(raw_ostream &OS) const;
/// Parse the debug_macinfo section accessible via the 'data' parameter.
void parse(DataExtractor data);
};
-}
+} // end namespace llvm
-#endif
+#endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGMACRO_H
#include "llvm/Support/Error.h"
#include "llvm/Support/FileOutputBuffer.h"
#include "llvm/Support/MemoryBuffer.h"
+#include <algorithm>
#include <cstdint>
+#include <cstring>
#include <memory>
-#include <type_traits>
namespace llvm {
namespace msf {
class ByteStream : public ReadableStream {
public:
- ByteStream() {}
+ ByteStream() = default;
explicit ByteStream(ArrayRef<uint8_t> Data) : Data(Data) {}
explicit ByteStream(StringRef Data)
: Data(Data.bytes_begin(), Data.bytes_end()) {}
Buffer = Data.slice(Offset, Size);
return Error::success();
}
+
Error readLongestContiguousChunk(uint32_t Offset,
ArrayRef<uint8_t> &Buffer) const override {
if (Offset >= Data.size())
class MutableByteStream : public WritableStream {
public:
- MutableByteStream() {}
+ MutableByteStream() = default;
explicit MutableByteStream(MutableArrayRef<uint8_t> Data)
: Data(Data), ImmutableStream(Data) {}
ArrayRef<uint8_t> &Buffer) const override {
return ImmutableStream.readBytes(Offset, Size, Buffer);
}
+
Error readLongestContiguousChunk(uint32_t Offset,
ArrayRef<uint8_t> &Buffer) const override {
return ImmutableStream.readLongestContiguousChunk(Offset, Buffer);
ArrayRef<uint8_t> &Buffer) const override {
return Impl.readBytes(Offset, Size, Buffer);
}
+
Error readLongestContiguousChunk(uint32_t Offset,
ArrayRef<uint8_t> &Buffer) const override {
return Impl.readLongestContiguousChunk(Offset, Buffer);
Error writeBytes(uint32_t Offset, ArrayRef<uint8_t> Data) const override {
return Impl.writeBytes(Offset, Data);
}
+
Error commit() const override { return Impl.commit(); }
private:
StreamImpl Impl;
};
-
} // end namespace msf
} // end namespace llvm
#define LLVM_DEBUGINFO_MSF_IMSFFILE_H
#include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/DebugInfo/MSF/StreamArray.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
-
-#include <stdint.h>
+#include <cstdint>
namespace llvm {
namespace msf {
class IMSFFile {
public:
- virtual ~IMSFFile() {}
+ virtual ~IMSFFile() = default;
virtual uint32_t getBlockSize() const = 0;
virtual uint32_t getBlockCount() const = 0;
virtual Error setBlockData(uint32_t BlockIndex, uint32_t Offset,
ArrayRef<uint8_t> Data) const = 0;
};
-}
-}
+
+} // end namespace msf
+} // end namespace llvm
#endif // LLVM_DEBUGINFO_MSF_IMSFFILE_H
#include "llvm/DebugInfo/MSF/MSFError.h"
#include "llvm/DebugInfo/MSF/StreamInterface.h"
#include "llvm/Support/Error.h"
+#include <cstddef>
#include <cstdint>
-#include <memory>
-#include <type_traits>
namespace llvm {
namespace msf {
+
template <typename T> struct SequencedItemTraits {
static size_t length(const T &Item) = delete;
static ArrayRef<uint8_t> bytes(const T &Item) = delete;
template <typename T, typename Traits = SequencedItemTraits<T>>
class SequencedItemStream : public ReadableStream {
public:
- SequencedItemStream() {}
+ SequencedItemStream() = default;
Error readBytes(uint32_t Offset, uint32_t Size,
ArrayRef<uint8_t> &Buffer) const override {
return make_error<MSFError>(msf_error_code::insufficient_buffer);
return CurrentIndex;
}
+
ArrayRef<T> Items;
};
+
} // end namespace msf
} // end namespace llvm
-//===- StreamArray.h - Array backed by an arbitrary stream ----------------===//
+//===- StreamArray.h - Array backed by an arbitrary stream ------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
#ifndef LLVM_DEBUGINFO_MSF_STREAMARRAY_H
#define LLVM_DEBUGINFO_MSF_STREAMARRAY_H
-#include "llvm/DebugInfo/MSF/SequencedItemStream.h"
+#include "llvm/ADT/ArrayRef.h"
#include "llvm/DebugInfo/MSF/StreamRef.h"
#include "llvm/Support/Error.h"
-
-#include <functional>
-#include <type_traits>
+#include <cassert>
+#include <cstdint>
namespace llvm {
namespace msf {
template <typename ValueType,
typename Extractor = VarStreamArrayExtractor<ValueType>>
+
class VarStreamArray {
friend class VarStreamArrayIterator<ValueType, Extractor>;
public:
typedef VarStreamArrayIterator<ValueType, Extractor> Iterator;
- VarStreamArray() {}
+ VarStreamArray() = default;
explicit VarStreamArray(const Extractor &E) : E(E) {}
explicit VarStreamArray(ReadableStreamRef Stream) : Stream(Stream) {}
}
}
}
- VarStreamArrayIterator() {}
+ VarStreamArrayIterator() = default;
explicit VarStreamArrayIterator(const Extractor &E) : Extract(E) {}
- ~VarStreamArrayIterator() {}
+ ~VarStreamArrayIterator() = default;
bool operator==(const IterType &R) const {
if (Array && R.Array) {
friend class FixedStreamArrayIterator<T>;
public:
- FixedStreamArray() : Stream() {}
+ FixedStreamArray() = default;
FixedStreamArray(ReadableStreamRef Stream) : Stream(Stream) {
assert(Stream.getLength() % sizeof(T) == 0);
}
FixedStreamArrayIterator<T> begin() const {
return FixedStreamArrayIterator<T>(*this, 0);
}
+
FixedStreamArrayIterator<T> end() const {
return FixedStreamArrayIterator<T>(*this, size());
}
class ReadableStream {
public:
- virtual ~ReadableStream() {}
+ virtual ~ReadableStream() = default;
// Given an offset into the stream and a number of bytes, attempt to read
// the bytes and set the output ArrayRef to point to a reference into the
class WritableStream : public ReadableStream {
public:
- virtual ~WritableStream() {}
+ ~WritableStream() override = default;
// Attempt to write the given bytes into the stream at the desired offset.
// This will always necessitate a copy. Cannot shrink or grow the stream,
#ifndef LLVM_DEBUGINFO_MSF_STREAMREF_H
#define LLVM_DEBUGINFO_MSF_STREAMREF_H
+#include "llvm/ADT/ArrayRef.h"
#include "llvm/DebugInfo/MSF/MSFError.h"
#include "llvm/DebugInfo/MSF/StreamInterface.h"
+#include "llvm/Support/Error.h"
+#include <algorithm>
+#include <cstdint>
namespace llvm {
namespace msf {
+
template <class StreamType, class RefType> class StreamRefBase {
public:
StreamRefBase() : Stream(nullptr), ViewOffset(0), Length(0) {}
class ReadableStreamRef
: public StreamRefBase<ReadableStream, ReadableStreamRef> {
public:
- ReadableStreamRef() : StreamRefBase() {}
+ ReadableStreamRef() = default;
ReadableStreamRef(const ReadableStream &Stream)
: StreamRefBase(Stream, 0, Stream.getLength()) {}
ReadableStreamRef(const ReadableStream &Stream, uint32_t Offset,
class WritableStreamRef
: public StreamRefBase<WritableStream, WritableStreamRef> {
public:
- WritableStreamRef() : StreamRefBase() {}
+ WritableStreamRef() = default;
WritableStreamRef(const WritableStream &Stream)
: StreamRefBase(Stream, 0, Stream.getLength()) {}
WritableStreamRef(const WritableStream &Stream, uint32_t Offset,
Error commit() const { return Stream->commit(); }
};
-} // namespace msf
-} // namespace llvm
+} // end namespace msf
+} // end namespace llvm
#endif // LLVM_DEBUGINFO_MSF_STREAMREF_H
#define LLVM_DEBUGINFO_MSF_STREAMWRITER_H
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/MSF/MSFError.h"
#include "llvm/DebugInfo/MSF/StreamArray.h"
-#include "llvm/DebugInfo/MSF/StreamInterface.h"
#include "llvm/DebugInfo/MSF/StreamRef.h"
-#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
-
-#include <string>
+#include <cstdint>
+#include <type_traits>
namespace llvm {
namespace msf {
class StreamWriter {
public:
- StreamWriter() {}
+ StreamWriter() = default;
explicit StreamWriter(WritableStreamRef Stream);
Error writeBytes(ArrayRef<uint8_t> Buffer);
}
template <typename T> Error writeArray(ArrayRef<T> Array) {
- if (Array.size() == 0)
+ if (Array.empty())
return Error::success();
if (Array.size() > UINT32_MAX / sizeof(T))
WritableStreamRef Stream;
uint32_t Offset = 0;
};
-} // namespace msf
-} // namespace llvm
+
+} // end namespace msf
+} // end namespace llvm
#endif // LLVM_DEBUGINFO_MSF_STREAMWRITER_H
#ifndef LLVM_DEBUGINFO_PDB_CONCRETESYMBOLENUMERATOR_H
#define LLVM_DEBUGINFO_PDB_CONCRETESYMBOLENUMERATOR_H
-#include "IPDBEnumChildren.h"
+#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
+#include "llvm/DebugInfo/PDB/PDBTypes.h"
#include "llvm/Support/Casting.h"
+#include <algorithm>
+#include <cstdint>
#include <memory>
namespace llvm {
ConcreteSymbolEnumerator(std::unique_ptr<IPDBEnumSymbols> SymbolEnumerator)
: Enumerator(std::move(SymbolEnumerator)) {}
- ~ConcreteSymbolEnumerator() override {}
+ ~ConcreteSymbolEnumerator() override = default;
uint32_t getChildCount() const override {
return Enumerator->getChildCount();
std::unique_ptr<IPDBEnumSymbols> Enumerator;
};
-}
-}
-#endif
+} // end namespace pdb
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_PDB_CONCRETESYMBOLENUMERATOR_H
#ifndef LLVM_DEBUGINFO_PDB_IPDBENUMCHILDREN_H
#define LLVM_DEBUGINFO_PDB_IPDBENUMCHILDREN_H
-#include "PDBTypes.h"
+#include <cstdint>
#include <memory>
namespace llvm {
typedef std::unique_ptr<ChildType> ChildTypePtr;
typedef IPDBEnumChildren<ChildType> MyType;
- virtual ~IPDBEnumChildren() {}
+ virtual ~IPDBEnumChildren() = default;
virtual uint32_t getChildCount() const = 0;
virtual ChildTypePtr getChildAtIndex(uint32_t Index) const = 0;
virtual void reset() = 0;
virtual MyType *clone() const = 0;
};
-}
-}
-#endif
+} // end namespace pdb
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_PDB_IPDBENUMCHILDREN_H
#include "llvm/DebugInfo/DIContext.h"
#include "llvm/DebugInfo/PDB/IPDBSession.h"
+#include <cstdint>
+#include <memory>
+#include <string>
namespace llvm {
namespace object {
class COFFObjectFile;
- }
+} // end namespace object
+
+namespace pdb {
- namespace pdb {
/// PDBContext
/// This data structure is the top level entity that deals with PDB debug
/// information parsing. This data structure exists only when there is a
/// (e.g. PDB and DWARF). More control and power over the debug information
/// access can be had by using the PDB interfaces directly.
class PDBContext : public DIContext {
-
- PDBContext(PDBContext &) = delete;
- PDBContext &operator=(PDBContext &) = delete;
-
public:
PDBContext(const object::COFFObjectFile &Object,
std::unique_ptr<IPDBSession> PDBSession);
+ PDBContext(PDBContext &) = delete;
+ PDBContext &operator=(PDBContext &) = delete;
static bool classof(const DIContext *DICtx) {
return DICtx->getKind() == CK_PDB;
std::string getFunctionName(uint64_t Address, DINameKind NameKind) const;
std::unique_ptr<IPDBSession> Session;
};
- }
-}
-#endif
+} // end namespace pdb
+
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_PDB_PDBCONTEXT_H
namespace llvm {
namespace pdb {
+
struct SectionContrib;
struct SectionContrib2;
class ISectionContribVisitor {
public:
- virtual ~ISectionContribVisitor() {}
+ virtual ~ISectionContribVisitor() = default;
virtual void visit(const SectionContrib &C) = 0;
virtual void visit(const SectionContrib2 &C) = 0;
};
-} // namespace pdb
-} // namespace llvm
+
+} // end namespace pdb
+} // end namespace llvm
#endif // LLVM_DEBUGINFO_PDB_RAW_ISECTIONCONTRIBVISITOR_H
#include "llvm/DebugInfo/MSF/StreamArray.h"
#include "llvm/DebugInfo/MSF/StreamRef.h"
#include "llvm/DebugInfo/PDB/Raw/RawTypes.h"
-#include "llvm/Support/Endian.h"
+#include "llvm/Support/Error.h"
#include <cstdint>
#include <vector>
namespace llvm {
+
namespace pdb {
class ModInfo {
struct ModuleInfoEx {
ModuleInfoEx(const ModInfo &Info) : Info(Info) {}
- ModuleInfoEx(const ModuleInfoEx &Ex)
- : Info(Ex.Info), SourceFiles(Ex.SourceFiles) {}
+ ModuleInfoEx(const ModuleInfoEx &Ex) = default;
ModInfo Info;
std::vector<StringRef> SourceFiles;
} // end namespace pdb
namespace msf {
+
template <> struct VarStreamArrayExtractor<pdb::ModInfo> {
Error operator()(ReadableStreamRef Stream, uint32_t &Length,
pdb::ModInfo &Info) const {
return Error::success();
}
};
+
} // end namespace msf
} // end namespace llvm
#define LLVM_DEBUGINFO_PDB_TPIHASHING_H
#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/StringExtras.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
+#include <cstdint>
+#include <string>
namespace llvm {
namespace pdb {
+
class TpiHashUpdater : public codeview::TypeVisitorCallbacks {
public:
- TpiHashUpdater() {}
+ TpiHashUpdater() = default;
#define TYPE_RECORD(EnumName, EnumVal, Name) \
virtual Error visitKnownRecord(codeview::CVType &CVR, \
uint32_t NumHashBuckets;
uint32_t Index = -1;
};
-}
-}
-#endif
+} // end namespace pdb
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_PDB_TPIHASHING_H