#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/BinaryStreamReader.h"
-#include "llvm/Support/Endian.h"
+#include "llvm/Support/BinaryStreamRef.h"
+#include "llvm/Support/Error.h"
+#include <cstdint>
+#include <vector>
namespace llvm {
+
namespace codeview {
class DebugStringTableSubsection;
FileChecksumKind Kind; // The type of checksum.
ArrayRef<uint8_t> Checksum; // The bytes of the checksum.
};
-}
-}
-namespace llvm {
+} // end namespace codeview
+
template <> struct VarStreamArrayExtractor<codeview::FileChecksumEntry> {
public:
- typedef void ContextType;
+ using ContextType = void;
Error operator()(BinaryStreamRef Stream, uint32_t &Len,
codeview::FileChecksumEntry &Item);
};
-}
-namespace llvm {
namespace codeview {
+
class DebugChecksumsSubsectionRef final : public DebugSubsectionRef {
- typedef VarStreamArray<codeview::FileChecksumEntry> FileChecksumArray;
- typedef FileChecksumArray::Iterator Iterator;
+ using FileChecksumArray = VarStreamArray<codeview::FileChecksumEntry>;
+ using Iterator = FileChecksumArray::Iterator;
public:
DebugChecksumsSubsectionRef()
DenseMap<uint32_t, uint32_t> OffsetMap;
uint32_t SerializedSize = 0;
- llvm::BumpPtrAllocator Storage;
+ BumpPtrAllocator Storage;
std::vector<FileChecksumEntry> Checksums;
};
-}
-}
-#endif
+} // end namespace codeview
+
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGCHECKSUMSSUBSECTION_H
#ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H
#define LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/BinaryStreamReader.h"
-#include "llvm/Support/Endian.h"
-
+#include "llvm/Support/BinaryStreamRef.h"
+#include "llvm/Support/Error.h"
+#include <cstdint>
#include <map>
namespace llvm {
namespace codeview {
+
class DebugCrossModuleExportsSubsectionRef final : public DebugSubsectionRef {
- typedef FixedStreamArray<CrossModuleExport> ReferenceArray;
- typedef ReferenceArray::Iterator Iterator;
+ using ReferenceArray = FixedStreamArray<CrossModuleExport>;
+ using Iterator = ReferenceArray::Iterator;
public:
DebugCrossModuleExportsSubsectionRef()
private:
std::map<uint32_t, uint32_t> Mappings;
};
-}
-}
-#endif
+} // end namespace codeview
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H
#define LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSIMPSUBSECTION_H
#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/BinaryStreamRef.h"
#include "llvm/Support/Endian.h"
+#include "llvm/Support/Error.h"
+#include <cstdint>
+#include <vector>
namespace llvm {
+
namespace codeview {
struct CrossModuleImportItem {
const CrossModuleImport *Header = nullptr;
- llvm::FixedStreamArray<support::ulittle32_t> Imports;
+ FixedStreamArray<support::ulittle32_t> Imports;
};
-}
-}
-namespace llvm {
+} // end namespace codeview
+
template <> struct VarStreamArrayExtractor<codeview::CrossModuleImportItem> {
public:
- typedef void ContextType;
+ using ContextType = void;
Error operator()(BinaryStreamRef Stream, uint32_t &Len,
codeview::CrossModuleImportItem &Item);
};
-}
-namespace llvm {
namespace codeview {
+
class DebugStringTableSubsection;
class DebugCrossModuleImportsSubsectionRef final : public DebugSubsectionRef {
- typedef VarStreamArray<CrossModuleImportItem> ReferenceArray;
- typedef ReferenceArray::Iterator Iterator;
+ using ReferenceArray = VarStreamArray<CrossModuleImportItem>;
+ using Iterator = ReferenceArray::Iterator;
public:
DebugCrossModuleImportsSubsectionRef()
DebugStringTableSubsection &Strings;
StringMap<std::vector<support::ulittle32_t>> Mappings;
};
-}
-}
-#endif
+} // end namespace codeview
+
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSIMPSUBSECTION_H
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_DEBUGINFO_CODEVIEW_BUGINLINEELINESSUBSECTION_H
-#define LLVM_DEBUGINFO_CODEVIEW_BUGINLINEELINESSUBSECTION_H
+#ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGINLINEELINESSUBSECTION_H
+#define LLVM_DEBUGINFO_CODEVIEW_DEBUGINLINEELINESSUBSECTION_H
+#include "llvm/ADT/StringRef.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
#include "llvm/DebugInfo/CodeView/Line.h"
+#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/BinaryStreamRef.h"
+#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
+#include <cstdint>
+#include <vector>
namespace llvm {
+
namespace codeview {
-class DebugInlineeLinesSubsectionRef;
class DebugChecksumsSubsection;
enum class InlineeLinesSignature : uint32_t {
const InlineeSourceLineHeader *Header;
FixedStreamArray<support::ulittle32_t> ExtraFiles;
};
-}
+
+} // end namespace codeview
template <> struct VarStreamArrayExtractor<codeview::InlineeSourceLine> {
Error operator()(BinaryStreamRef Stream, uint32_t &Len,
codeview::InlineeSourceLine &Item);
+
bool HasExtraFiles = false;
};
namespace codeview {
+
class DebugInlineeLinesSubsectionRef final : public DebugSubsectionRef {
- typedef VarStreamArray<InlineeSourceLine> LinesArray;
- typedef LinesArray::Iterator Iterator;
+ using LinesArray = VarStreamArray<InlineeSourceLine>;
+ using Iterator = LinesArray::Iterator;
public:
DebugInlineeLinesSubsectionRef();
private:
DebugChecksumsSubsection &Checksums;
-
bool HasExtraFiles = false;
uint32_t ExtraFileCount = 0;
-
std::vector<Entry> Entries;
};
-}
-}
-#endif
+} // end namespace codeview
+
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGINLINEELINESSUBSECTION_H
-//===- DebugLinesSubsection.h --------------------------------*- C++ -*-===//
+//===- DebugLinesSubsection.h -----------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGLINEFRAGMENT_H
-#define LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGLINEFRAGMENT_H
+#ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGLINESSUBSECTION_H
+#define LLVM_DEBUGINFO_CODEVIEW_DEBUGLINESSUBSECTION_H
+#include "llvm/ADT/StringRef.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
#include "llvm/DebugInfo/CodeView/Line.h"
#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/BinaryStreamRef.h"
+#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
+#include <cstdint>
+#include <vector>
namespace llvm {
namespace codeview {
class DebugLinesSubsectionRef final : public DebugSubsectionRef {
friend class LineColumnExtractor;
- typedef VarStreamArray<LineColumnEntry, LineColumnExtractor> LineInfoArray;
- typedef LineInfoArray::Iterator Iterator;
+
+ using LineInfoArray = VarStreamArray<LineColumnEntry, LineColumnExtractor>;
+ using Iterator = LineInfoArray::Iterator;
public:
DebugLinesSubsectionRef();
private:
DebugChecksumsSubsection &Checksums;
-
uint32_t RelocOffset = 0;
uint16_t RelocSegment = 0;
uint32_t CodeSize = 0;
LineFlags Flags = LF_None;
std::vector<Block> Blocks;
};
-}
-}
-#endif
+} // end namespace codeview
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGLINESSUBSECTION_H
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
#include "llvm/Support/BinaryStreamRef.h"
#include "llvm/Support/Error.h"
-
-#include <stdint.h>
+#include <cstdint>
namespace llvm {
class BinaryStreamReader;
-class BinaryStreamRef;
-class BinaryStreamWriter;
namespace codeview {
StringMap<uint32_t> Strings;
uint32_t StringSize = 1;
};
-}
-}
-#endif
+} // end namespace codeview
+
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGSTRINGTABLESUBSECTION_H
-//===- DebugSubsection.h ------------------------------------*- C++ -*-===//
+//===- DebugSubsectionRecord.h ----------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTRECORD_H
-#define LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTRECORD_H
+#ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGSUBSECTIONRECORD_H
+#define LLVM_DEBUGINFO_CODEVIEW_DEBUGSUBSECTIONRECORD_H
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/BinaryStreamRef.h"
-#include "llvm/Support/BinaryStreamWriter.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
+#include "llvm/Support/MathExtras.h"
+#include <cstdint>
+#include <memory>
namespace llvm {
+
+class BinaryStreamWriter;
+
namespace codeview {
class DebugSubsection;
BinaryStreamRef getRecordData() const;
private:
- CodeViewContainer Container;
- DebugSubsectionKind Kind;
+ CodeViewContainer Container = CodeViewContainer::ObjectFile;
+ DebugSubsectionKind Kind = DebugSubsectionKind::None;
BinaryStreamRef Data;
};
CodeViewContainer Container;
};
-} // namespace codeview
+} // end namespace codeview
template <> struct VarStreamArrayExtractor<codeview::DebugSubsectionRecord> {
Error operator()(BinaryStreamRef Stream, uint32_t &Length,
};
namespace codeview {
-typedef VarStreamArray<DebugSubsectionRecord> DebugSubsectionArray;
-}
-} // namespace llvm
-#endif // LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTRECORD_H
+using DebugSubsectionArray = VarStreamArray<DebugSubsectionRecord>;
+
+} // end namespace codeview
+
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGSUBSECTIONRECORD_H
#ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLRVASUBSECTION_H
#define LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLRVASUBSECTION_H
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
#include "llvm/Support/BinaryStreamArray.h"
-#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
+#include <cstdint>
+#include <vector>
namespace llvm {
+
+class BinaryStreamReader;
+
namespace codeview {
class DebugSymbolRVASubsectionRef final : public DebugSubsectionRef {
public:
- typedef FixedStreamArray<support::ulittle32_t> ArrayType;
+ using ArrayType = FixedStreamArray<support::ulittle32_t>;
DebugSymbolRVASubsectionRef();
private:
std::vector<support::ulittle32_t> RVAs;
};
-} // namespace codeview
-} // namespace llvm
-#endif
+} // end namespace codeview
+
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLRVASUBSECTION_H
-//===- EnumTables.h Enum to string conversion tables ------------*- C++ -*-===//
+//===- EnumTables.h - Enum to string conversion tables ----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
#include "llvm/BinaryFormat/COFF.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/Support/ScopedPrinter.h"
-
-#include <stdint.h>
+#include <cstdint>
namespace llvm {
namespace codeview {
+
ArrayRef<EnumEntry<SymbolKind>> getSymbolTypeNames();
ArrayRef<EnumEntry<TypeLeafKind>> getTypeLeafNames();
ArrayRef<EnumEntry<uint16_t>> getRegisterNames();
ArrayRef<EnumEntry<uint16_t>> getTrampolineNames();
ArrayRef<EnumEntry<COFF::SectionCharacteristics>>
getImageSectionCharacteristicNames();
-} // namespace codeview
-} // namespace llvm
+
+} // end namespace codeview
+} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_ENUMTABLES_H
-//===- LazyRandomTypeCollection.h ---------------------------- *- C++ --*-===//
+//===- LazyRandomTypeCollection.h -------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
#ifndef LLVM_DEBUGINFO_CODEVIEW_LAZYRANDOMTYPECOLLECTION_H
#define LLVM_DEBUGINFO_CODEVIEW_LAZYRANDOMTYPECOLLECTION_H
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/CodeView/TypeCollection.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/Support/Allocator.h"
+#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/StringSaver.h"
+#include <cstdint>
+#include <vector>
namespace llvm {
namespace codeview {
/// into M chunks of roughly equal size, this yields a worst case lookup time
/// of O(N/M) and an amortized time of O(1).
class LazyRandomTypeCollection : public TypeCollection {
- typedef FixedStreamArray<TypeIndexOffset> PartialOffsetArray;
+ using PartialOffsetArray = FixedStreamArray<TypeIndexOffset>;
+
struct CacheEntry {
CVType Type;
uint32_t Offset;
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/Endian.h"
-#include "llvm/Support/Error.h"
-#include <cstddef>
#include <cstdint>
#include <vector>
public:
SymbolRecordKind getKind() const { return Kind; }
+
SymbolRecordKind Kind;
};
: SymbolRecord(Kind), RecordOffset(RecordOffset) {}
std::vector<TypeIndex> Indices;
+
uint32_t RecordOffset;
};
int32_t S1;
};
- BinaryAnnotationIterator(ArrayRef<uint8_t> Annotations) : Data(Annotations) {}
BinaryAnnotationIterator() = default;
+ BinaryAnnotationIterator(ArrayRef<uint8_t> Annotations) : Data(Annotations) {}
BinaryAnnotationIterator(const BinaryAnnotationIterator &Other)
: Data(Other.Data) {}
: SymbolRecord(SymbolRecordKind::InlineSiteSym),
RecordOffset(RecordOffset) {}
- llvm::iterator_range<BinaryAnnotationIterator> annotations() const {
- return llvm::make_range(BinaryAnnotationIterator(AnnotationData),
- BinaryAnnotationIterator());
+ iterator_range<BinaryAnnotationIterator> annotations() const {
+ return make_range(BinaryAnnotationIterator(AnnotationData),
+ BinaryAnnotationIterator());
}
uint32_t Parent;
ulittle16_t Register;
ulittle16_t MayHaveNoName;
};
+
explicit DefRangeRegisterSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
DefRangeRegisterSym(uint32_t RecordOffset)
: SymbolRecord(SymbolRecordKind::DefRangeRegisterSym),
ulittle16_t MayHaveNoName;
ulittle32_t OffsetInParent;
};
+
explicit DefRangeSubfieldRegisterSym(SymbolRecordKind Kind)
: SymbolRecord(Kind) {}
DefRangeSubfieldRegisterSym(uint32_t RecordOffset)
ulittle16_t Flags;
little32_t BasePointerOffset;
};
+
explicit DefRangeRegisterRelSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
explicit DefRangeRegisterRelSym(uint32_t RecordOffset)
: SymbolRecord(SymbolRecordKind::DefRangeRegisterRelSym),
uint32_t RecordOffset;
};
-typedef CVRecord<SymbolKind> CVSymbol;
-typedef VarStreamArray<CVSymbol> CVSymbolArray;
+using CVSymbol = CVRecord<SymbolKind>;
+using CVSymbolArray = VarStreamArray<CVSymbol>;
} // end namespace codeview
} // end namespace llvm
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/iterator_range.h"
#include "llvm/DebugInfo/CodeView/CVRecord.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include <vector>
namespace llvm {
-
-class BinaryStreamReader;
-
namespace codeview {
using support::little32_t;
using support::ulittle16_t;
using support::ulittle32_t;
-typedef CVRecord<TypeLeafKind> CVType;
-typedef RemappedRecord<TypeLeafKind> RemappedType;
+using CVType = CVRecord<TypeLeafKind>;
+using RemappedType = RemappedRecord<TypeLeafKind>;
struct CVMemberRecord {
TypeLeafKind Kind;
ArrayRef<uint8_t> Data;
};
-typedef VarStreamArray<CVType> CVTypeArray;
-typedef iterator_range<CVTypeArray::Iterator> CVTypeRange;
+using CVTypeArray = VarStreamArray<CVType>;
+using CVTypeRange = iterator_range<CVTypeArray::Iterator>;
/// Equvalent to CV_fldattr_t in cvinfo.h.
struct MemberAttributes {
uint16_t Attrs = 0;
+
enum {
MethodKindShift = 2,
};
+
MemberAttributes() = default;
explicit MemberAttributes(MemberAccess Access)
TypeIndex getClassType() const { return ClassType; }
TypeIndex getFunctionType() const { return FunctionType; }
StringRef getName() const { return Name; }
+
TypeIndex ClassType;
TypeIndex FunctionType;
StringRef Name;
TypeIndex ReferentType;
uint32_t Attrs;
-
Optional<MemberPointerInfo> MemberInfo;
private:
UnderlyingType(UnderlyingType) {}
TypeIndex getUnderlyingType() const { return UnderlyingType; }
+
TypeIndex UnderlyingType;
};
TypeIndex getType() const { return Type; }
uint8_t getBitOffset() const { return BitOffset; }
uint8_t getBitSize() const { return BitSize; }
+
TypeIndex Type;
uint8_t BitSize;
uint8_t BitOffset;
}
uint32_t getEntryCount() const { return getSlots().size(); }
+
ArrayRef<VFTableSlotKind> SlotsRef;
std::vector<VFTableSlotKind> Slots;
};
Name(Name) {}
StringRef getGuid() const { return Guid; }
-
uint32_t getAge() const { return Age; }
-
StringRef getName() const { return Name; }
StringRef Guid;
: TypeRecord(TypeRecordKind::StringId), Id(Id), String(String) {}
TypeIndex getId() const { return Id; }
-
StringRef getString() const { return String; }
+
TypeIndex Id;
StringRef String;
};
FunctionType(FunctionType), Name(Name) {}
TypeIndex getParentScope() const { return ParentScope; }
-
TypeIndex getFunctionType() const { return FunctionType; }
-
StringRef getName() const { return Name; }
TypeIndex ParentScope;
ArgIndices(ArgIndices.begin(), ArgIndices.end()) {}
ArrayRef<TypeIndex> getArgs() const { return ArgIndices; }
+
SmallVector<TypeIndex, 4> ArgIndices;
};
TypeIndex getOverriddenVTable() const { return OverriddenVFTable; }
uint32_t getVFPtrOffset() const { return VFPtrOffset; }
StringRef getName() const { return makeArrayRef(MethodNames).front(); }
+
ArrayRef<StringRef> getMethodNames() const {
return makeArrayRef(MethodNames).drop_front();
}
: TypeRecord(TypeRecordKind::MethodOverloadList), Methods(Methods) {}
ArrayRef<OneMethodRecord> getMethods() const { return Methods; }
+
std::vector<OneMethodRecord> Methods;
};
uint16_t getNumOverloads() const { return NumOverloads; }
TypeIndex getMethodList() const { return MethodList; }
StringRef getName() const { return Name; }
+
uint16_t NumOverloads;
TypeIndex MethodList;
StringRef Name;
};
} // end namespace codeview
-
} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_TYPERECORD_H
#ifndef LLVM_DEBUGINFO_CODEVIEW_TYPESERIALIZER_H
#define LLVM_DEBUGINFO_CODEVIEW_TYPESERIALIZER_H
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
+#include "llvm/DebugInfo/CodeView/TypeIndex.h"
+#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/CodeView/TypeRecordMapping.h"
#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
+#include "llvm/Support/Allocator.h"
#include "llvm/Support/BinaryByteStream.h"
#include "llvm/Support/BinaryStreamWriter.h"
-
-#include "llvm/ADT/Optional.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/Allocator.h"
#include "llvm/Support/Error.h"
+#include <cassert>
+#include <cstdint>
+#include <memory>
+#include <vector>
namespace llvm {
-
namespace codeview {
class TypeHasher;
}
};
- typedef SmallVector<MutableArrayRef<uint8_t>, 2> MutableRecordList;
+ using MutableRecordList = SmallVector<MutableArrayRef<uint8_t>, 2>;
static constexpr uint8_t ContinuationLength = 8;
BumpPtrAllocator &RecordStorage;
public:
explicit TypeSerializer(BumpPtrAllocator &Storage, bool Hash = true);
- ~TypeSerializer();
+ ~TypeSerializer() override;
void reset();
return Error::success();
}
};
-}
-}
-#endif
+} // end namespace codeview
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_TYPESERIALIZER_H
-//===- DebugChecksumsSubsection.cpp ----------------------*- C++ -*-===//
+//===- DebugChecksumsSubsection.cpp ---------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
-
-#include "llvm/DebugInfo/CodeView/CodeViewError.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"
#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/BinaryStreamWriter.h"
+#include "llvm/Support/Endian.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/MathExtras.h"
+#include <cassert>
+#include <cstdint>
+#include <cstring>
using namespace llvm;
using namespace llvm::codeview;
// Checksum bytes follow.
};
-Error llvm::VarStreamArrayExtractor<FileChecksumEntry>::
+Error VarStreamArrayExtractor<FileChecksumEntry>::
operator()(BinaryStreamRef Stream, uint32_t &Len, FileChecksumEntry &Item) {
BinaryStreamReader Reader(Stream);
return Error::success();
}
+
Error DebugChecksumsSubsectionRef::initialize(BinaryStreamRef Section) {
BinaryStreamReader Reader(Section);
return initialize(Reader);
-//===- DebugCrossExSubsection.cpp -------------------------------*- C++ -*-===//
+//===- DebugCrossExSubsection.cpp -----------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/CodeView/DebugCrossExSubsection.h"
-
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
+#include "llvm/Support/BinaryStreamWriter.h"
+#include "llvm/Support/Error.h"
+#include <cstdint>
using namespace llvm;
using namespace llvm::codeview;
-//===- DebugCrossImpSubsection.cpp ------------------------------*- C++ -*-===//
+//===- DebugCrossImpSubsection.cpp ----------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h"
-
+#include "llvm/ADT/ArrayRef.h"
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
#include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"
+#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/BinaryStreamWriter.h"
+#include "llvm/Support/Endian.h"
+#include "llvm/Support/Error.h"
+#include <algorithm>
+#include <cstdint>
+#include <utility>
+#include <vector>
using namespace llvm;
using namespace llvm::codeview;
-namespace llvm {
Error VarStreamArrayExtractor<CrossModuleImportItem>::
operator()(BinaryStreamRef Stream, uint32_t &Len,
codeview::CrossModuleImportItem &Item) {
return EC;
return Error::success();
}
-}
Error DebugCrossModuleImportsSubsectionRef::initialize(
BinaryStreamReader Reader) {
-//===- DebugInlineeLinesSubsection.cpp ------------------------*- C++-*-===//
+//===- DebugInlineeLinesSubsection.cpp ------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
-
-#include "llvm/DebugInfo/CodeView/CodeViewError.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
-#include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"
-#include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
+#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/BinaryStreamWriter.h"
+#include "llvm/Support/Endian.h"
+#include "llvm/Support/Error.h"
+#include <cassert>
+#include <cstdint>
using namespace llvm;
using namespace llvm::codeview;
-//===- DebugLinesSubsection.cpp -------------------------------*- C++-*-===//
+//===- DebugLinesSubsection.cpp -------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"
-
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
-#include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"
-#include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
+#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/BinaryStreamWriter.h"
+#include "llvm/Support/Error.h"
+#include <cassert>
+#include <cstdint>
using namespace llvm;
using namespace llvm::codeview;
Error LineColumnExtractor::operator()(BinaryStreamRef Stream, uint32_t &Len,
LineColumnEntry &Item) {
- using namespace codeview;
const LineBlockFragmentHeader *BlockHeader;
BinaryStreamReader Reader(Stream);
if (auto EC = Reader.readObject(BlockHeader))
-//===- DebugStringTableSubsection.cpp - CodeView String Table ---*- C++ -*-===//
+//===- DebugStringTableSubsection.cpp - CodeView String Table -------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"
-
-#include "llvm/Support/BinaryStream.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/Support/BinaryStreamReader.h"
#include "llvm/Support/BinaryStreamWriter.h"
+#include "llvm/Support/Error.h"
+#include <algorithm>
+#include <cassert>
+#include <cstdint>
using namespace llvm;
using namespace llvm::codeview;
Stream = Contents;
return Error::success();
}
+
Error DebugStringTableSubsectionRef::initialize(BinaryStreamReader &Reader) {
return Reader.readStreamRef(Stream);
}
-//===- DebugSubsectionRecord.cpp -----------------------------*- C++-*-===//
+//===- DebugSubsectionRecord.cpp ------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
-
#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/BinaryStreamWriter.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/MathExtras.h"
+#include <algorithm>
+#include <cassert>
+#include <cstdint>
using namespace llvm;
using namespace llvm::codeview;
-DebugSubsectionRecord::DebugSubsectionRecord()
- : Container(CodeViewContainer::ObjectFile),
- Kind(DebugSubsectionKind::None) {}
+DebugSubsectionRecord::DebugSubsectionRecord() = default;
DebugSubsectionRecord::DebugSubsectionRecord(DebugSubsectionKind Kind,
BinaryStreamRef Data,
-//===- DebugSymbolRVASubsection.cpp ------------------------------*- C++-*-===//
+//===- DebugSymbolRVASubsection.cpp ---------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/BinaryStreamWriter.h"
+#include <cstdint>
using namespace llvm;
using namespace llvm::codeview;
-//===- EnumTables.cpp - Enum to string conversion tables --------*- C++ -*-===//
+//===- EnumTables.cpp - Enum to string conversion tables ------------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/CodeView/EnumTables.h"
+#include "llvm/Support/ScopedPrinter.h"
+#include <type_traits>
using namespace llvm;
using namespace codeview;
namespace llvm {
namespace codeview {
+
ArrayRef<EnumEntry<SymbolKind>> getSymbolTypeNames() {
return makeArrayRef(SymbolTypeNames);
}
ArrayRef<EnumEntry<uint32_t>> getPublicSymFlagNames() {
return makeArrayRef(PublicSymFlagNames);
}
+
ArrayRef<EnumEntry<uint8_t>> getProcSymFlagNames() {
return makeArrayRef(ProcSymFlagNames);
}
+
ArrayRef<EnumEntry<uint16_t>> getLocalFlagNames() {
return makeArrayRef(LocalFlags);
}
+
ArrayRef<EnumEntry<uint8_t>> getFrameCookieKindNames() {
return makeArrayRef(FrameCookieKinds);
}
+
ArrayRef<EnumEntry<SourceLanguage>> getSourceLanguageNames() {
return makeArrayRef(SourceLanguages);
}
+
ArrayRef<EnumEntry<uint32_t>> getCompileSym2FlagNames() {
return makeArrayRef(CompileSym2FlagNames);
}
+
ArrayRef<EnumEntry<uint32_t>> getCompileSym3FlagNames() {
return makeArrayRef(CompileSym3FlagNames);
}
+
ArrayRef<EnumEntry<uint32_t>> getFileChecksumNames() {
return makeArrayRef(FileChecksumNames);
}
+
ArrayRef<EnumEntry<unsigned>> getCPUTypeNames() {
return makeArrayRef(CPUTypeNames);
}
+
ArrayRef<EnumEntry<uint32_t>> getFrameProcSymFlagNames() {
return makeArrayRef(FrameProcSymFlagNames);
}
+
ArrayRef<EnumEntry<uint16_t>> getExportSymFlagNames() {
return makeArrayRef(ExportSymFlagNames);
}
+
ArrayRef<EnumEntry<uint32_t>> getModuleSubstreamKindNames() {
return makeArrayRef(ModuleSubstreamKindNames);
}
+
ArrayRef<EnumEntry<uint8_t>> getThunkOrdinalNames() {
return makeArrayRef(ThunkOrdinalNames);
}
+
ArrayRef<EnumEntry<uint16_t>> getTrampolineNames() {
return makeArrayRef(TrampolineNames);
}
+
ArrayRef<EnumEntry<COFF::SectionCharacteristics>>
getImageSectionCharacteristicNames() {
return makeArrayRef(ImageSectionCharacteristicNames);
}
-}
-}
+
+} // end namespace codeview
+} // end namespace llvm
-//===- LazyRandomTypeCollection.cpp ---------------------------- *- C++--*-===//
+//===- LazyRandomTypeCollection.cpp ---------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
-
-#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/None.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
#include "llvm/DebugInfo/CodeView/TypeName.h"
-#include "llvm/DebugInfo/CodeView/TypeServerHandler.h"
-#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
+#include "llvm/DebugInfo/CodeView/TypeRecord.h"
+#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/Endian.h"
+#include "llvm/Support/Error.h"
+#include <algorithm>
+#include <cassert>
+#include <cstdint>
+#include <iterator>
using namespace llvm;
using namespace llvm::codeview;
-//===- TypeSerialzier.cpp ---------------------------------------*- C++ -*-===//
+//===- TypeSerialzier.cpp -------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/CodeView/TypeSerializer.h"
-
+#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseSet.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
+#include "llvm/DebugInfo/CodeView/TypeIndex.h"
+#include "llvm/Support/Allocator.h"
+#include "llvm/Support/BinaryByteStream.h"
#include "llvm/Support/BinaryStreamWriter.h"
-
-#include <string.h>
+#include "llvm/Support/Endian.h"
+#include "llvm/Support/Error.h"
+#include <algorithm>
+#include <cassert>
+#include <cstdint>
+#include <cstring>
using namespace llvm;
using namespace llvm::codeview;
namespace {
+
struct HashedType {
uint64_t Hash;
const uint8_t *Data;
struct HashedTypePtr {
HashedTypePtr() = default;
HashedTypePtr(HashedType *Ptr) : Ptr(Ptr) {}
+
HashedType *Ptr = nullptr;
};
-} // namespace
+
+} // end anonymous namespace
namespace llvm {
+
template <> struct DenseMapInfo<HashedTypePtr> {
static inline HashedTypePtr getEmptyKey() { return HashedTypePtr(nullptr); }
+
static inline HashedTypePtr getTombstoneKey() {
return HashedTypePtr(reinterpret_cast<HashedType *>(1));
}
+
static unsigned getHashValue(HashedTypePtr Val) {
assert(Val.Ptr != getEmptyKey().Ptr && Val.Ptr != getTombstoneKey().Ptr);
return Val.Ptr->Hash;
}
+
static bool isEqual(HashedTypePtr LHSP, HashedTypePtr RHSP) {
HashedType *LHS = LHSP.Ptr;
HashedType *RHS = RHSP.Ptr;
return ::memcmp(LHS->Data, RHS->Data, LHS->Size) == 0;
}
};
-}
+
+} // end namespace llvm
/// Private implementation so that we don't leak our DenseMap instantiations to
/// users.
TypeSerializer::TypeSerializer(BumpPtrAllocator &Storage, bool Hash)
: RecordStorage(Storage), RecordBuffer(MaxRecordLength * 2),
- Stream(RecordBuffer, llvm::support::little), Writer(Stream),
+ Stream(RecordBuffer, support::little), Writer(Stream),
Mapping(Writer) {
// RecordBuffer needs to be able to hold enough data so that if we are 1
// byte short of MaxRecordLen, and then we try to write MaxRecordLen bytes,
// we won't overflow.
if (Hash)
- Hasher = make_unique<TypeHasher>(Storage);
+ Hasher = llvm::make_unique<TypeHasher>(Storage);
}
TypeSerializer::~TypeSerializer() = default;
uint8_t *SegmentBytes = RecordStorage.Allocate<uint8_t>(LengthWithSize);
auto SavedSegment = MutableArrayRef<uint8_t>(SegmentBytes, LengthWithSize);
- MutableBinaryByteStream CS(SavedSegment, llvm::support::little);
+ MutableBinaryByteStream CS(SavedSegment, support::little);
BinaryStreamWriter CW(CS);
if (auto EC = CW.writeBytes(CopyData))
return EC;