1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[CodeView] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 306616
This commit is contained in:
Eugene Zelenko 2017-06-29 00:05:44 +00:00
parent 351728e70c
commit 42b9403673
24 changed files with 313 additions and 162 deletions

View File

@ -12,13 +12,19 @@
#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;
@ -28,24 +34,22 @@ struct FileChecksumEntry {
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()
@ -89,10 +93,12 @@ private:
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

View File

@ -10,18 +10,21 @@
#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()
@ -58,7 +61,8 @@ public:
private:
std::map<uint32_t, uint32_t> Mappings;
};
}
}
#endif
} // end namespace codeview
} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H

View File

@ -11,38 +11,43 @@
#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()
@ -82,7 +87,9 @@ private:
DebugStringTableSubsection &Strings;
StringMap<std::vector<support::ulittle32_t>> Mappings;
};
}
}
#endif
} // end namespace codeview
} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSIMPSUBSECTION_H

View File

@ -7,19 +7,26 @@
//
//===----------------------------------------------------------------------===//
#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 {
@ -40,18 +47,21 @@ struct InlineeSourceLine {
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();
@ -99,13 +109,13 @@ public:
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

View File

@ -1,4 +1,4 @@
//===- DebugLinesSubsection.h --------------------------------*- C++ -*-===//
//===- DebugLinesSubsection.h -----------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@ -7,14 +7,20 @@
//
//===----------------------------------------------------------------------===//
#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 {
@ -72,8 +78,9 @@ public:
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();
@ -130,14 +137,14 @@ public:
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

View File

@ -12,17 +12,15 @@
#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 {
@ -83,7 +81,9 @@ private:
StringMap<uint32_t> Strings;
uint32_t StringSize = 1;
};
}
}
#endif
} // end namespace codeview
} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGSTRINGTABLESUBSECTION_H

View File

@ -1,4 +1,4 @@
//===- DebugSubsection.h ------------------------------------*- C++ -*-===//
//===- DebugSubsectionRecord.h ----------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@ -7,17 +7,22 @@
//
//===----------------------------------------------------------------------===//
#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;
@ -42,8 +47,8 @@ public:
BinaryStreamRef getRecordData() const;
private:
CodeViewContainer Container;
DebugSubsectionKind Kind;
CodeViewContainer Container = CodeViewContainer::ObjectFile;
DebugSubsectionKind Kind = DebugSubsectionKind::None;
BinaryStreamRef Data;
};
@ -71,7 +76,7 @@ private:
CodeViewContainer Container;
};
} // namespace codeview
} // end namespace codeview
template <> struct VarStreamArrayExtractor<codeview::DebugSubsectionRecord> {
Error operator()(BinaryStreamRef Stream, uint32_t &Length,
@ -88,8 +93,11 @@ template <> struct VarStreamArrayExtractor<codeview::DebugSubsectionRecord> {
};
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

View File

@ -10,17 +10,23 @@
#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();
@ -53,7 +59,9 @@ public:
private:
std::vector<support::ulittle32_t> RVAs;
};
} // namespace codeview
} // namespace llvm
#endif
} // end namespace codeview
} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLRVASUBSECTION_H

View File

@ -1,4 +1,4 @@
//===- EnumTables.h Enum to string conversion tables ------------*- C++ -*-===//
//===- EnumTables.h - Enum to string conversion tables ----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@ -14,11 +14,11 @@
#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();
@ -38,7 +38,8 @@ ArrayRef<EnumEntry<uint8_t>> getThunkOrdinalNames();
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

View File

@ -1,4 +1,4 @@
//===- LazyRandomTypeCollection.h ---------------------------- *- C++ --*-===//
//===- LazyRandomTypeCollection.h -------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@ -10,12 +10,18 @@
#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 {
@ -43,7 +49,8 @@ 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;

View File

@ -21,8 +21,6 @@
#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>
@ -35,6 +33,7 @@ protected:
public:
SymbolRecordKind getKind() const { return Kind; }
SymbolRecordKind Kind;
};
@ -153,6 +152,7 @@ public:
: SymbolRecord(Kind), RecordOffset(RecordOffset) {}
std::vector<TypeIndex> Indices;
uint32_t RecordOffset;
};
@ -165,8 +165,8 @@ struct BinaryAnnotationIterator {
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) {}
@ -342,9 +342,9 @@ public:
: 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;
@ -479,6 +479,7 @@ public:
ulittle16_t Register;
ulittle16_t MayHaveNoName;
};
explicit DefRangeRegisterSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
DefRangeRegisterSym(uint32_t RecordOffset)
: SymbolRecord(SymbolRecordKind::DefRangeRegisterSym),
@ -501,6 +502,7 @@ public:
ulittle16_t MayHaveNoName;
ulittle32_t OffsetInParent;
};
explicit DefRangeSubfieldRegisterSym(SymbolRecordKind Kind)
: SymbolRecord(Kind) {}
DefRangeSubfieldRegisterSym(uint32_t RecordOffset)
@ -546,6 +548,7 @@ public:
ulittle16_t Flags;
little32_t BasePointerOffset;
};
explicit DefRangeRegisterRelSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
explicit DefRangeRegisterRelSym(uint32_t RecordOffset)
: SymbolRecord(SymbolRecordKind::DefRangeRegisterRelSym),
@ -935,8 +938,8 @@ public:
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

View File

@ -15,6 +15,7 @@
#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"
@ -25,31 +26,30 @@
#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)
@ -226,6 +226,7 @@ public:
TypeIndex getClassType() const { return ClassType; }
TypeIndex getFunctionType() const { return FunctionType; }
StringRef getName() const { return Name; }
TypeIndex ClassType;
TypeIndex FunctionType;
StringRef Name;
@ -330,7 +331,6 @@ public:
TypeIndex ReferentType;
uint32_t Attrs;
Optional<MemberPointerInfo> MemberInfo;
private:
@ -490,6 +490,7 @@ public:
UnderlyingType(UnderlyingType) {}
TypeIndex getUnderlyingType() const { return UnderlyingType; }
TypeIndex UnderlyingType;
};
@ -505,6 +506,7 @@ public:
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;
@ -527,6 +529,7 @@ public:
}
uint32_t getEntryCount() const { return getSlots().size(); }
ArrayRef<VFTableSlotKind> SlotsRef;
std::vector<VFTableSlotKind> Slots;
};
@ -541,9 +544,7 @@ public:
Name(Name) {}
StringRef getGuid() const { return Guid; }
uint32_t getAge() const { return Age; }
StringRef getName() const { return Name; }
StringRef Guid;
@ -560,8 +561,8 @@ public:
: TypeRecord(TypeRecordKind::StringId), Id(Id), String(String) {}
TypeIndex getId() const { return Id; }
StringRef getString() const { return String; }
TypeIndex Id;
StringRef String;
};
@ -576,9 +577,7 @@ public:
FunctionType(FunctionType), Name(Name) {}
TypeIndex getParentScope() const { return ParentScope; }
TypeIndex getFunctionType() const { return FunctionType; }
StringRef getName() const { return Name; }
TypeIndex ParentScope;
@ -635,6 +634,7 @@ public:
ArgIndices(ArgIndices.begin(), ArgIndices.end()) {}
ArrayRef<TypeIndex> getArgs() const { return ArgIndices; }
SmallVector<TypeIndex, 4> ArgIndices;
};
@ -656,6 +656,7 @@ public:
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();
}
@ -707,6 +708,7 @@ public:
: TypeRecord(TypeRecordKind::MethodOverloadList), Methods(Methods) {}
ArrayRef<OneMethodRecord> getMethods() const { return Methods; }
std::vector<OneMethodRecord> Methods;
};
@ -723,6 +725,7 @@ public:
uint16_t getNumOverloads() const { return NumOverloads; }
TypeIndex getMethodList() const { return MethodList; }
StringRef getName() const { return Name; }
uint16_t NumOverloads;
TypeIndex MethodList;
StringRef Name;
@ -874,7 +877,6 @@ public:
};
} // end namespace codeview
} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_TYPERECORD_H

View File

@ -10,19 +10,25 @@
#ifndef LLVM_DEBUGINFO_CODEVIEW_TYPESERIALIZER_H
#define LLVM_DEBUGINFO_CODEVIEW_TYPESERIALIZER_H
#include "llvm/DebugInfo/CodeView/TypeRecordMapping.h"
#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
#include "llvm/Support/BinaryByteStream.h"
#include "llvm/Support/BinaryStreamWriter.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.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/Support/Error.h"
#include <cassert>
#include <cstdint>
#include <memory>
#include <vector>
namespace llvm {
namespace codeview {
class TypeHasher;
@ -46,7 +52,7 @@ class TypeSerializer : public TypeVisitorCallbacks {
}
};
typedef SmallVector<MutableArrayRef<uint8_t>, 2> MutableRecordList;
using MutableRecordList = SmallVector<MutableArrayRef<uint8_t>, 2>;
static constexpr uint8_t ContinuationLength = 8;
BumpPtrAllocator &RecordStorage;
@ -82,7 +88,7 @@ class TypeSerializer : public TypeVisitorCallbacks {
public:
explicit TypeSerializer(BumpPtrAllocator &Storage, bool Hash = true);
~TypeSerializer();
~TypeSerializer() override;
void reset();
@ -146,7 +152,8 @@ private:
return Error::success();
}
};
}
}
#endif
} // end namespace codeview
} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_TYPESERIALIZER_H

View File

@ -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);

View File

@ -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;

View File

@ -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) {

View File

@ -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;

View File

@ -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))

View File

@ -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);
}

View File

@ -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,

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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;