diff options
Diffstat (limited to 'llvm/lib/DebugInfo/CodeView')
11 files changed, 127 insertions, 46 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/DebugChecksumsSubsection.cpp b/llvm/lib/DebugInfo/CodeView/DebugChecksumsSubsection.cpp index c31b8d1c96d..ccc20eb7488 100644 --- a/llvm/lib/DebugInfo/CodeView/DebugChecksumsSubsection.cpp +++ b/llvm/lib/DebugInfo/CodeView/DebugChecksumsSubsection.cpp @@ -1,4 +1,4 @@ -//===- DebugChecksumsSubsection.cpp ----------------------*- C++ -*-===// +//===- DebugChecksumsSubsection.cpp ---------------------------------------===// // // The LLVM Compiler Infrastructure // @@ -8,10 +8,17 @@ //===----------------------------------------------------------------------===// #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; @@ -25,7 +32,7 @@ struct FileChecksumEntryHeader { // Checksum bytes follow. }; -Error llvm::VarStreamArrayExtractor<FileChecksumEntry>:: +Error VarStreamArrayExtractor<FileChecksumEntry>:: operator()(BinaryStreamRef Stream, uint32_t &Len, FileChecksumEntry &Item) { BinaryStreamReader Reader(Stream); @@ -48,6 +55,7 @@ Error DebugChecksumsSubsectionRef::initialize(BinaryStreamReader Reader) { return Error::success(); } + Error DebugChecksumsSubsectionRef::initialize(BinaryStreamRef Section) { BinaryStreamReader Reader(Section); return initialize(Reader); diff --git a/llvm/lib/DebugInfo/CodeView/DebugCrossExSubsection.cpp b/llvm/lib/DebugInfo/CodeView/DebugCrossExSubsection.cpp index 21e2cc56075..cef27787cfd 100644 --- a/llvm/lib/DebugInfo/CodeView/DebugCrossExSubsection.cpp +++ b/llvm/lib/DebugInfo/CodeView/DebugCrossExSubsection.cpp @@ -1,4 +1,4 @@ -//===- DebugCrossExSubsection.cpp -------------------------------*- C++ -*-===// +//===- DebugCrossExSubsection.cpp -----------------------------------------===// // // The LLVM Compiler Infrastructure // @@ -8,8 +8,10 @@ //===----------------------------------------------------------------------===// #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; diff --git a/llvm/lib/DebugInfo/CodeView/DebugCrossImpSubsection.cpp b/llvm/lib/DebugInfo/CodeView/DebugCrossImpSubsection.cpp index 2c4a0b77934..88c0076915b 100644 --- a/llvm/lib/DebugInfo/CodeView/DebugCrossImpSubsection.cpp +++ b/llvm/lib/DebugInfo/CodeView/DebugCrossImpSubsection.cpp @@ -1,4 +1,4 @@ -//===- DebugCrossImpSubsection.cpp ------------------------------*- C++ -*-===// +//===- DebugCrossImpSubsection.cpp ----------------------------------------===// // // The LLVM Compiler Infrastructure // @@ -8,14 +8,21 @@ //===----------------------------------------------------------------------===// #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) { @@ -34,7 +41,6 @@ operator()(BinaryStreamRef Stream, uint32_t &Len, return EC; return Error::success(); } -} Error DebugCrossModuleImportsSubsectionRef::initialize( BinaryStreamReader Reader) { diff --git a/llvm/lib/DebugInfo/CodeView/DebugInlineeLinesSubsection.cpp b/llvm/lib/DebugInfo/CodeView/DebugInlineeLinesSubsection.cpp index e7719d05dbd..077c103a615 100644 --- a/llvm/lib/DebugInfo/CodeView/DebugInlineeLinesSubsection.cpp +++ b/llvm/lib/DebugInfo/CodeView/DebugInlineeLinesSubsection.cpp @@ -1,4 +1,4 @@ -//===- DebugInlineeLinesSubsection.cpp ------------------------*- C++-*-===// +//===- DebugInlineeLinesSubsection.cpp ------------------------------------===// // // The LLVM Compiler Infrastructure // @@ -8,11 +8,15 @@ //===----------------------------------------------------------------------===// #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; diff --git a/llvm/lib/DebugInfo/CodeView/DebugLinesSubsection.cpp b/llvm/lib/DebugInfo/CodeView/DebugLinesSubsection.cpp index fbcad61d60a..57ad40819fb 100644 --- a/llvm/lib/DebugInfo/CodeView/DebugLinesSubsection.cpp +++ b/llvm/lib/DebugInfo/CodeView/DebugLinesSubsection.cpp @@ -1,4 +1,4 @@ -//===- DebugLinesSubsection.cpp -------------------------------*- C++-*-===// +//===- DebugLinesSubsection.cpp -------------------------------------------===// // // The LLVM Compiler Infrastructure // @@ -8,18 +8,21 @@ //===----------------------------------------------------------------------===// #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)) diff --git a/llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp b/llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp index de02525270c..d723282eb71 100644 --- a/llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp +++ b/llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp @@ -1,4 +1,4 @@ -//===- DebugStringTableSubsection.cpp - CodeView String Table ---*- C++ -*-===// +//===- DebugStringTableSubsection.cpp - CodeView String Table -------------===// // // The LLVM Compiler Infrastructure // @@ -8,10 +8,14 @@ //===----------------------------------------------------------------------===// #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; @@ -23,6 +27,7 @@ Error DebugStringTableSubsectionRef::initialize(BinaryStreamRef Contents) { Stream = Contents; return Error::success(); } + Error DebugStringTableSubsectionRef::initialize(BinaryStreamReader &Reader) { return Reader.readStreamRef(Stream); } diff --git a/llvm/lib/DebugInfo/CodeView/DebugSubsectionRecord.cpp b/llvm/lib/DebugInfo/CodeView/DebugSubsectionRecord.cpp index d69eca018e0..55f343c11e7 100644 --- a/llvm/lib/DebugInfo/CodeView/DebugSubsectionRecord.cpp +++ b/llvm/lib/DebugInfo/CodeView/DebugSubsectionRecord.cpp @@ -1,4 +1,4 @@ -//===- DebugSubsectionRecord.cpp -----------------------------*- C++-*-===// +//===- DebugSubsectionRecord.cpp ------------------------------------------===// // // The LLVM Compiler Infrastructure // @@ -8,16 +8,20 @@ //===----------------------------------------------------------------------===// #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, diff --git a/llvm/lib/DebugInfo/CodeView/DebugSymbolRVASubsection.cpp b/llvm/lib/DebugInfo/CodeView/DebugSymbolRVASubsection.cpp index 5f91b68f3ad..60fbf9d747b 100644 --- a/llvm/lib/DebugInfo/CodeView/DebugSymbolRVASubsection.cpp +++ b/llvm/lib/DebugInfo/CodeView/DebugSymbolRVASubsection.cpp @@ -1,4 +1,4 @@ -//===- DebugSymbolRVASubsection.cpp ------------------------------*- C++-*-===// +//===- DebugSymbolRVASubsection.cpp ---------------------------------------===// // // The LLVM Compiler Infrastructure // @@ -8,6 +8,11 @@ //===----------------------------------------------------------------------===// #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; diff --git a/llvm/lib/DebugInfo/CodeView/EnumTables.cpp b/llvm/lib/DebugInfo/CodeView/EnumTables.cpp index ec00af28395..4cfb55a31b3 100644 --- a/llvm/lib/DebugInfo/CodeView/EnumTables.cpp +++ b/llvm/lib/DebugInfo/CodeView/EnumTables.cpp @@ -1,4 +1,4 @@ -//===- EnumTables.cpp - Enum to string conversion tables --------*- C++ -*-===// +//===- EnumTables.cpp - Enum to string conversion tables ------------------===// // // The LLVM Compiler Infrastructure // @@ -8,6 +8,8 @@ //===----------------------------------------------------------------------===// #include "llvm/DebugInfo/CodeView/EnumTables.h" +#include "llvm/Support/ScopedPrinter.h" +#include <type_traits> using namespace llvm; using namespace codeview; @@ -333,6 +335,7 @@ static const EnumEntry<COFF::SectionCharacteristics> namespace llvm { namespace codeview { + ArrayRef<EnumEntry<SymbolKind>> getSymbolTypeNames() { return makeArrayRef(SymbolTypeNames); } @@ -348,48 +351,63 @@ ArrayRef<EnumEntry<uint16_t>> getRegisterNames() { 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 diff --git a/llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp b/llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp index 20f7e72c3af..5aaf3f1453a 100644 --- a/llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp +++ b/llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp @@ -1,4 +1,4 @@ -//===- LazyRandomTypeCollection.cpp ---------------------------- *- C++--*-===// +//===- LazyRandomTypeCollection.cpp ---------------------------------------===// // // The LLVM Compiler Infrastructure // @@ -8,12 +8,20 @@ //===----------------------------------------------------------------------===// #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; diff --git a/llvm/lib/DebugInfo/CodeView/TypeSerializer.cpp b/llvm/lib/DebugInfo/CodeView/TypeSerializer.cpp index 93c1198e36c..003c13b4a20 100644 --- a/llvm/lib/DebugInfo/CodeView/TypeSerializer.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeSerializer.cpp @@ -1,4 +1,4 @@ -//===- TypeSerialzier.cpp ---------------------------------------*- C++ -*-===// +//===- TypeSerialzier.cpp -------------------------------------------------===// // // The LLVM Compiler Infrastructure // @@ -8,16 +8,27 @@ //===----------------------------------------------------------------------===// #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; @@ -30,20 +41,26 @@ struct HashedType { 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; @@ -54,7 +71,8 @@ template <> struct DenseMapInfo<HashedTypePtr> { 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. @@ -159,13 +177,13 @@ TypeSerializer::addPadding(MutableArrayRef<uint8_t> Record) { 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; @@ -331,7 +349,7 @@ Error TypeSerializer::visitMemberEnd(CVMemberRecord &Record) { 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; |