#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/Support/FormatAdapters.h"
-#include "llvm/Support/FormatProviders.h"
#include "llvm/Support/FormatVariadic.h"
+#include "llvm/Support/raw_ostream.h"
+#include <cstdint>
namespace llvm {
+
namespace codeview {
+
namespace detail {
-class GuidAdapter final : public llvm::FormatAdapter<ArrayRef<uint8_t>> {
+
+class GuidAdapter final : public FormatAdapter<ArrayRef<uint8_t>> {
ArrayRef<uint8_t> Guid;
public:
explicit GuidAdapter(ArrayRef<uint8_t> Guid);
explicit GuidAdapter(StringRef Guid);
- void format(llvm::raw_ostream &Stream, StringRef Style);
+
+ void format(raw_ostream &Stream, StringRef Style) override ;
};
-}
+
+} // end namespace detail
inline detail::GuidAdapter fmt_guid(StringRef Item) {
return detail::GuidAdapter(Item);
inline detail::GuidAdapter fmt_guid(ArrayRef<uint8_t> Item) {
return detail::GuidAdapter(Item);
}
-}
+
+} // end namespace codeview
template <> struct format_provider<codeview::TypeIndex> {
public:
- static void format(const codeview::TypeIndex &V, llvm::raw_ostream &Stream,
+ static void format(const codeview::TypeIndex &V, raw_ostream &Stream,
StringRef Style) {
if (V.isNoneType())
Stream << "<no type>";
}
}
};
-}
-#endif
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_FORMATTERS_H
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_DEBUGINFO_CODEVIEW_STRINGS_AND_CHECKSUMS_H
-#define LLVM_DEBUGINFO_CODEVIEW_STRINGS_AND_CHECKSUMS_H
+#ifndef LLVM_DEBUGINFO_CODEVIEW_STRINGSANDCHECKSUMS_H
+#define LLVM_DEBUGINFO_CODEVIEW_STRINGSANDCHECKSUMS_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 <memory>
namespace llvm {
namespace codeview {
-class DebugSubsectionRecord;
-class DebugChecksumsSubsectionRef;
-class DebugStringTableSubsectionRef;
-class DebugChecksumsSubsection;
-class DebugStringTableSubsection;
-
class StringsAndChecksumsRef {
public:
// If no subsections are known about initially, we find as much as we can.
public:
using StringsPtr = std::shared_ptr<DebugStringTableSubsection>;
using ChecksumsPtr = std::shared_ptr<DebugChecksumsSubsection>;
+
// If no subsections are known about initially, we find as much as we can.
- StringsAndChecksums() {}
+ StringsAndChecksums() = default;
void setStrings(const StringsPtr &SP) { Strings = SP; }
void setChecksums(const ChecksumsPtr &CP) { Checksums = CP; }
ChecksumsPtr Checksums;
};
-} // namespace codeview
-} // namespace llvm
+} // end namespace codeview
+} // end namespace llvm
-#endif
+#endif // LLVM_DEBUGINFO_CODEVIEW_STRINGSANDCHECKSUMS_H
-//===- symbolSerializer.h ---------------------------------------*- C++ -*-===//
+//===- SymbolSerializer.h ---------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
#ifndef LLVM_DEBUGINFO_CODEVIEW_SYMBOLSERIALIZER_H
#define LLVM_DEBUGINFO_CODEVIEW_SYMBOLSERIALIZER_H
+#include "llvm/ADT/Optional.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
+#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/SymbolRecordMapping.h"
#include "llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h"
-
-#include "llvm/ADT/Optional.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringMap.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/BinaryByteStream.h"
#include "llvm/Support/BinaryStreamWriter.h"
#include "llvm/Support/Error.h"
+#include <cstdint>
+#include <vector>
namespace llvm {
-class BinaryStreamWriter;
namespace codeview {
class SymbolSerializer : public SymbolVisitorCallbacks {
}
public:
+ SymbolSerializer(BumpPtrAllocator &Storage, CodeViewContainer Container);
+
template <typename SymType>
static CVSymbol writeOneSymbol(SymType &Sym, BumpPtrAllocator &Storage,
CodeViewContainer Container) {
return Result;
}
- SymbolSerializer(BumpPtrAllocator &Storage, CodeViewContainer Container);
-
- virtual Error visitSymbolBegin(CVSymbol &Record) override;
- virtual Error visitSymbolEnd(CVSymbol &Record) override;
+ Error visitSymbolBegin(CVSymbol &Record) override;
+ Error visitSymbolEnd(CVSymbol &Record) override;
#define SYMBOL_RECORD(EnumName, EnumVal, Name) \
- virtual Error visitKnownRecord(CVSymbol &CVR, Name &Record) override { \
+ Error visitKnownRecord(CVSymbol &CVR, Name &Record) override { \
return visitKnownRecordImpl(CVR, Record); \
}
#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
return Mapping.visitKnownRecord(CVR, Record);
}
};
-}
-}
-#endif
+} // end namespace codeview
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLSERIALIZER_H
#ifndef LLVM_DEBUGINFO_CODEVIEW_TYPESERVERHANDLER_H
#define LLVM_DEBUGINFO_CODEVIEW_TYPESERVERHANDLER_H
-#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/Support/Error.h"
namespace llvm {
namespace codeview {
+
+class TypeServer2Record;
class TypeVisitorCallbacks;
class TypeServerHandler {
public:
- virtual ~TypeServerHandler() {}
+ virtual ~TypeServerHandler() = default;
/// Handle a TypeServer record. If the implementation returns true
/// the record will not be processed by the top-level visitor. If
return false;
}
};
-}
-}
-#endif
+} // end namespace codeview
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_TYPESERVERHANDLER_H
-//===- IPDBDataStream.h - base interface for child enumerator -*- C++ ---*-===//
+//===- IPDBDataStream.h - base interface for child enumerator ---*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
#ifndef LLVM_DEBUGINFO_PDB_IPDBDATASTREAM_H
#define LLVM_DEBUGINFO_PDB_IPDBDATASTREAM_H
-#include "PDBTypes.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
+#include <cstdint>
+#include <string>
namespace llvm {
namespace pdb {
/// stream type.
class IPDBDataStream {
public:
- typedef llvm::SmallVector<uint8_t, 32> RecordType;
+ using RecordType = SmallVector<uint8_t, 32>;
virtual ~IPDBDataStream();
virtual uint32_t getRecordCount() const = 0;
virtual std::string getName() const = 0;
- virtual llvm::Optional<RecordType> getItemAtIndex(uint32_t Index) const = 0;
+ virtual Optional<RecordType> getItemAtIndex(uint32_t Index) const = 0;
virtual bool getNext(RecordType &Record) = 0;
virtual void reset() = 0;
virtual IPDBDataStream *clone() const = 0;
};
-}
-}
-#endif
+} // end namespace pdb
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_PDB_IPDBDATASTREAM_H
template <typename ChildType> class IPDBEnumChildren {
public:
- typedef std::unique_ptr<ChildType> ChildTypePtr;
- typedef IPDBEnumChildren<ChildType> MyType;
+ using ChildTypePtr = std::unique_ptr<ChildType>;
+ using MyType = IPDBEnumChildren<ChildType>;
virtual ~IPDBEnumChildren() = default;
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_DEBUGINFO_PDB_RAW_DBIMODULELIST_H
-#define LLVM_DEBUGINFO_PDB_RAW_DBIMODULELIST_H
+#ifndef LLVM_DEBUGINFO_PDB_NATIVE_DBIMODULELIST_H
+#define LLVM_DEBUGINFO_PDB_NATIVE_DBIMODULELIST_H
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator.h"
-#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
+#include "llvm/ADT/iterator_range.h"
#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"
#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/BinaryStreamRef.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
+#include <cstddef>
#include <cstdint>
+#include <iterator>
#include <vector>
namespace llvm {
-namespace codeview {}
namespace pdb {
class DbiModuleList;
class DbiModuleSourceFilesIterator
: public iterator_facade_base<DbiModuleSourceFilesIterator,
std::random_access_iterator_tag, StringRef> {
- typedef iterator_facade_base<DbiModuleSourceFilesIterator,
- std::random_access_iterator_tag, StringRef>
- BaseType;
+ using BaseType =
+ iterator_facade_base<DbiModuleSourceFilesIterator,
+ std::random_access_iterator_tag, StringRef>;
public:
DbiModuleSourceFilesIterator(const DbiModuleList &Modules, uint32_t Modi,
BinaryStreamRef FileInfoSubstream;
BinaryStreamRef NamesBuffer;
};
-}
-}
-#endif // LLVM_DEBUGINFO_PDB_RAW_DBIMODULELIST_H
\ No newline at end of file
+} // end namespace pdb
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_PDB_NATIVE_DBIMODULELIST_H
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_DEBUGINFO_PDB_RAW_HASH_H
-#define LLVM_DEBUGINFO_PDB_RAW_HASH_H
+#ifndef LLVM_DEBUGINFO_PDB_NATIVE_HASH_H
+#define LLVM_DEBUGINFO_PDB_NATIVE_HASH_H
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
-#include <stdint.h>
+#include <cstdint>
namespace llvm {
namespace pdb {
+
uint32_t hashStringV1(StringRef Str);
uint32_t hashStringV2(StringRef Str);
uint32_t hashBufferV8(ArrayRef<uint8_t> Data);
-}
-}
-#endif
+} // end namespace pdb
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_PDB_NATIVE_HASH_H
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_DEBUGINFO_PDB_RAW_HASHTABLE_H
-#define LLVM_DEBUGINFO_PDB_RAW_HASHTABLE_H
+#ifndef LLVM_DEBUGINFO_PDB_NATIVE_HASHTABLE_H
+#define LLVM_DEBUGINFO_PDB_NATIVE_HASHTABLE_H
-#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SparseBitVector.h"
-#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator.h"
-#include "llvm/Support/BinaryStreamArray.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 <cstdint>
+#include <iterator>
#include <utility>
+#include <vector>
namespace llvm {
+
+class BinaryStreamReader;
+class BinaryStreamWriter;
+
namespace pdb {
class HashTableIterator;
class HashTable {
friend class HashTableIterator;
+
struct Header {
support::ulittle32_t Size;
support::ulittle32_t Capacity;
};
- typedef std::vector<std::pair<uint32_t, uint32_t>> BucketList;
+ using BucketList = std::vector<std::pair<uint32_t, uint32_t>>;
public:
HashTable();
protected:
bool isPresent(uint32_t K) const { return Present.test(K); }
bool isDeleted(uint32_t K) const { return Deleted.test(K); }
+
BucketList Buckets;
mutable SparseBitVector<> Present;
mutable SparseBitVector<> Deleted;
: public iterator_facade_base<HashTableIterator, std::forward_iterator_tag,
std::pair<uint32_t, uint32_t>> {
friend class HashTable;
+
HashTableIterator(const HashTable &Map, uint32_t Index, bool IsEnd);
public:
};
} // end namespace pdb
+
} // end namespace llvm
-#endif // LLVM_DEBUGINFO_PDB_RAW_HASHTABLE_H
+#endif // LLVM_DEBUGINFO_PDB_NATIVE_HASHTABLE_H
-//===- ModuleDebugStream.h - PDB Module Info Stream Access ----------------===//
+//===- ModuleDebugStream.h - PDB Module Info Stream Access ------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_DEBUGINFO_PDB_RAW_MODULEDEBUGSTREAM_H
-#define LLVM_DEBUGINFO_PDB_RAW_MODULEDEBUGSTREAM_H
+#ifndef LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H
+#define LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H
#include "llvm/ADT/iterator_range.h"
-#include "llvm/DebugInfo/CodeView/CVRecord.h"
#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
#include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
-#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/BinaryStreamRef.h"
#include "llvm/Support/Error.h"
+#include <cstdint>
+#include <memory>
namespace llvm {
namespace pdb {
-class PDBFile;
+
class DbiModuleDescriptor;
class ModuleDebugStreamRef {
- typedef codeview::DebugSubsectionArray::Iterator DebugSubsectionIterator;
+ using DebugSubsectionIterator = codeview::DebugSubsectionArray::Iterator;
public:
ModuleDebugStreamRef(const DbiModuleDescriptor &Module,
ModuleDebugStreamRef &operator=(ModuleDebugStreamRef &&Other) = default;
- llvm::iterator_range<DebugSubsectionIterator> subsections() const;
+ iterator_range<DebugSubsectionIterator> subsections() const;
bool hasDebugSubsections() const;
codeview::DebugSubsectionArray Subsections;
};
-}
-}
-#endif
+} // end namespace pdb
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_DEBUGINFO_PDB_RAW_PDBNAMEDSTREAMMAP_H
-#define LLVM_DEBUGINFO_PDB_RAW_PDBNAMEDSTREAMMAP_H
+#ifndef LLVM_DEBUGINFO_PDB_NATIVE_NAMEDSTREAMMAP_H
+#define LLVM_DEBUGINFO_PDB_NATIVE_NAMEDSTREAMMAP_H
+#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/iterator_range.h"
#include "llvm/DebugInfo/PDB/Native/HashTable.h"
#include "llvm/Support/Error.h"
#include <cstdint>
namespace llvm {
+
class BinaryStreamReader;
class BinaryStreamWriter;
namespace pdb {
-class NamedStreamMapBuilder;
+
class NamedStreamMap {
+ friend class NamedStreamMapBuilder;
+
struct FinalizationInfo {
uint32_t StringDataBytes = 0;
uint32_t SerializedLength = 0;
};
- friend NamedStreamMapBuilder;
public:
NamedStreamMap();
};
} // end namespace pdb
+
} // end namespace llvm
-#endif // LLVM_DEBUGINFO_PDB_RAW_PDBNAMEDSTREAMMAP_H
+#endif // LLVM_DEBUGINFO_PDB_NATIVE_NAMEDSTREAMMAP_H
-//===- NativeRawSymbol.h - Native implementation of IPDBRawSymbol - C++ -*-===//
+//==- NativeRawSymbol.h - Native implementation of IPDBRawSymbol -*- C++ -*-==//
//
// The LLVM Compiler Infrastructure
//
#define LLVM_DEBUGINFO_PDB_NATIVE_NATIVERAWSYMBOL_H
#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
+#include <cstdint>
+#include <memory>
namespace llvm {
namespace pdb {
std::unique_ptr<IPDBEnumSymbols>
findInlineFramesByRVA(uint32_t RVA) const override;
- void getDataBytes(llvm::SmallVector<uint8_t, 32> &Bytes) const override;
+ void getDataBytes(SmallVector<uint8_t, 32> &Bytes) const override;
void getFrontEndVersion(VersionInfo &Version) const override;
void getBackEndVersion(VersionInfo &Version) const override;
PDB_MemberAccess getAccess() const override;
uint32_t SymbolId;
};
-}
-}
+} // end namespace pdb
+} // end namespace llvm
-#endif
+#endif // LLVM_DEBUGINFO_PDB_NATIVE_NATIVERAWSYMBOL_H
#ifndef LLVM_DEBUGINFO_PDB_PDB_H
#define LLVM_DEBUGINFO_PDB_PDB_H
-#include "PDBTypes.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/DebugInfo/PDB/PDBTypes.h"
#include "llvm/Support/Error.h"
#include <memory>
-#include <system_error>
namespace llvm {
-class StringRef;
-
namespace pdb {
+class IPDBSession;
+
Error loadDataForPDB(PDB_ReaderType Type, StringRef Path,
std::unique_ptr<IPDBSession> &Session);
Error loadDataForEXE(PDB_ReaderType Type, StringRef Path,
std::unique_ptr<IPDBSession> &Session);
-}
-}
-#endif
+
+} // end namespace pdb
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_PDB_PDB_H
-//===- PDBExtras.h - helper functions and classes for PDBs -------*- C++-*-===//
+//===- PDBExtras.h - helper functions and classes for PDBs ------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
#ifndef LLVM_DEBUGINFO_PDB_PDBEXTRAS_H
#define LLVM_DEBUGINFO_PDB_PDBEXTRAS_H
-#include "PDBTypes.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/DebugInfo/PDB/PDBTypes.h"
#include <unordered_map>
namespace llvm {
+class raw_ostream;
+
namespace pdb {
-typedef std::unordered_map<PDB_SymType, int> TagStats;
+
+using TagStats = std::unordered_map<PDB_SymType, int>;
raw_ostream &operator<<(raw_ostream &OS, const PDB_VariantType &Value);
raw_ostream &operator<<(raw_ostream &OS, const PDB_CallingConv &Conv);
raw_ostream &operator<<(raw_ostream &OS, const Variant &Value);
raw_ostream &operator<<(raw_ostream &OS, const VersionInfo &Version);
raw_ostream &operator<<(raw_ostream &OS, const TagStats &Stats);
-}
-}
-#endif
+} // end namespace pdb
+
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_PDB_PDBEXTRAS_H
-//===- PDBTypes.h - Defines enums for various fields contained in PDB ---*-===//
+//===- PDBTypes.h - Defines enums for various fields contained in PDB ----====//
//
// The LLVM Compiler Infrastructure
//
#ifndef LLVM_DEBUGINFO_PDB_PDBTYPES_H
#define LLVM_DEBUGINFO_PDB_PDBTYPES_H
-#include "llvm/Config/llvm-config.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
+#include <cstddef>
#include <cstdint>
#include <cstring>
#include <functional>
namespace llvm {
namespace pdb {
-class PDBSymDumper;
-class PDBSymbol;
-
class IPDBDataStream;
-template <class T> class IPDBEnumChildren;
class IPDBLineNumber;
-class IPDBRawSymbol;
-class IPDBSession;
class IPDBSourceFile;
-
-typedef IPDBEnumChildren<PDBSymbol> IPDBEnumSymbols;
-typedef IPDBEnumChildren<IPDBSourceFile> IPDBEnumSourceFiles;
-typedef IPDBEnumChildren<IPDBDataStream> IPDBEnumDataStreams;
-typedef IPDBEnumChildren<IPDBLineNumber> IPDBEnumLineNumbers;
-
+class PDBSymDumper;
+class PDBSymbol;
class PDBSymbolExe;
class PDBSymbolCompiland;
class PDBSymbolCompilandDetails;
class PDBSymbolTypeDimension;
class PDBSymbolUnknown;
+using IPDBEnumSymbols = IPDBEnumChildren<PDBSymbol>;
+using IPDBEnumSourceFiles = IPDBEnumChildren<IPDBSourceFile>;
+using IPDBEnumDataStreams = IPDBEnumChildren<IPDBDataStream>;
+using IPDBEnumLineNumbers = IPDBEnumChildren<IPDBLineNumber>;
+
/// Specifies which PDB reader implementation is to be used. Only a value
/// of PDB_ReaderType::DIA is currently supported, but Native is in the works.
enum class PDB_ReaderType {
/// These values correspond to the CV_CPU_TYPE_e enumeration, and are documented
/// here: https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
-typedef codeview::CPUType PDB_Cpu;
+using PDB_Cpu = codeview::CPUType;
enum class PDB_Machine {
Invalid = 0xffff,
/// at the following locations:
/// https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
/// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680207(v=vs.85).aspx
-///
-typedef codeview::CallingConvention PDB_CallingConv;
+using PDB_CallingConv = codeview::CallingConvention;
/// These values correspond to the CV_CFL_LANG enumeration, and are documented
/// here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx
-typedef codeview::SourceLanguage PDB_Lang;
+using PDB_Lang = codeview::SourceLanguage;
/// These values correspond to the DataKind enumeration, and are documented
/// here: https://msdn.microsoft.com/en-us/library/b2x2t313.aspx
};
struct Variant {
- Variant() : Type(PDB_VariantType::Empty) {}
+ Variant() = default;
- Variant(const Variant &Other) : Type(PDB_VariantType::Empty) {
+ Variant(const Variant &Other) {
*this = Other;
}
delete[] Value.String;
}
- PDB_VariantType Type;
+ PDB_VariantType Type = PDB_VariantType::Empty;
union {
bool Bool;
int8_t Int8;
}
};
+} // end namespace pdb
} // end namespace llvm
-}
namespace std {
+
template <> struct hash<llvm::pdb::PDB_SymType> {
- typedef llvm::pdb::PDB_SymType argument_type;
- typedef std::size_t result_type;
+ using argument_type = llvm::pdb::PDB_SymType;
+ using result_type = std::size_t;
result_type operator()(const argument_type &Arg) const {
return std::hash<int>()(static_cast<int>(Arg));
}
};
+
} // end namespace std
#endif // LLVM_DEBUGINFO_PDB_PDBTYPES_H
#ifndef LLVM_DEBUGINFO_PDB_UDTLAYOUT_H
#define LLVM_DEBUGINFO_PDB_UDTLAYOUT_H
-#include "PDBSymbol.h"
-#include "PDBTypes.h"
-
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitVector.h"
-#include "llvm/ADT/DenseMap.h"
-
-#include <list>
+#include "llvm/ADT/StringRef.h"
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h"
+#include "llvm/DebugInfo/PDB/PDBTypes.h"
+#include <cstdint>
#include <memory>
+#include <string>
+#include <vector>
namespace llvm {
-
-class raw_ostream;
-
namespace pdb {
-class PDBSymTypeBaseClass;
-class PDBSymbolData;
-class PDBSymbolTypeUDT;
-class PDBSymbolTypeVTable;
-
-class ClassLayout;
class BaseClassLayout;
-class LayoutItemBase;
+class ClassLayout;
class UDTLayoutBase;
class LayoutItemBase {
LayoutItemBase(const UDTLayoutBase *Parent, const PDBSymbol *Symbol,
const std::string &Name, uint32_t OffsetInParent,
uint32_t Size, bool IsElided);
- virtual ~LayoutItemBase() {}
+ virtual ~LayoutItemBase() = default;
uint32_t deepPaddingSize() const;
virtual uint32_t immediatePadding() const { return 0; }
VBPtrLayoutItem(const UDTLayoutBase &Parent,
std::unique_ptr<PDBSymbolTypeBuiltin> Sym, uint32_t Offset,
uint32_t Size);
- virtual bool isVBPtr() const { return true; }
+
+ bool isVBPtr() const override { return true; }
private:
std::unique_ptr<PDBSymbolTypeBuiltin> Type;
bool IsElided);
uint32_t tailPadding() const override;
-
ArrayRef<LayoutItemBase *> layout_items() const { return LayoutItems; }
-
ArrayRef<BaseClassLayout *> bases() const { return AllBases; }
ArrayRef<BaseClassLayout *> regular_bases() const { return NonVirtualBases; }
ArrayRef<BaseClassLayout *> virtual_bases() const { return VirtualBases; }
-
uint32_t directVirtualBaseCount() const { return DirectVBaseCount; }
-
ArrayRef<std::unique_ptr<PDBSymbolFunc>> funcs() const { return Funcs; }
-
ArrayRef<std::unique_ptr<PDBSymbol>> other_items() const { return Other; }
protected:
std::unique_ptr<PDBSymbolTypeUDT> OwnedStorage;
const PDBSymbolTypeUDT &UDT;
};
-}
-} // namespace llvm
+
+} // end namespace pdb
+} // end namespace llvm
#endif // LLVM_DEBUGINFO_PDB_UDTLAYOUT_H
-//===- Formatters.cpp -------------------------------------------*- C++ -*-===//
+//===- Formatters.cpp -----------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/CodeView/Formatters.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/Support/raw_ostream.h"
+#include <algorithm>
+#include <cassert>
using namespace llvm;
using namespace llvm::codeview;
GuidAdapter::GuidAdapter(ArrayRef<uint8_t> Guid)
: FormatAdapter(std::move(Guid)) {}
-void GuidAdapter::format(llvm::raw_ostream &Stream, StringRef Style) {
+void GuidAdapter::format(raw_ostream &Stream, StringRef Style) {
static const char *Lookup = "0123456789ABCDEF";
assert(Item.size() == 16 && "Expected 16-byte GUID");
-//===- StringsAndChecksums.cpp ----------------------------------*- C++ -*-===//
+//===- StringsAndChecksums.cpp --------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/CodeView/StringsAndChecksums.h"
+#include "llvm/ADT/STLExtras.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/Error.h"
+#include <cassert>
using namespace llvm;
using namespace llvm::codeview;
-StringsAndChecksumsRef::StringsAndChecksumsRef() {}
+StringsAndChecksumsRef::StringsAndChecksumsRef() = default;
StringsAndChecksumsRef::StringsAndChecksumsRef(
const DebugStringTableSubsectionRef &Strings)
-//===- SymbolSerializer.cpp -------------------------------------*- C++ -*-===//
+//===- SymbolSerializer.cpp -----------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/CodeView/SymbolSerializer.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
+#include "llvm/Support/Endian.h"
+#include "llvm/Support/Error.h"
+#include <cassert>
+#include <cstdint>
+#include <cstring>
using namespace llvm;
using namespace llvm::codeview;
SymbolSerializer::SymbolSerializer(BumpPtrAllocator &Allocator,
CodeViewContainer Container)
: Storage(Allocator), RecordBuffer(MaxRecordLength),
- Stream(RecordBuffer, llvm::support::little), Writer(Stream),
+ Stream(RecordBuffer, support::little), Writer(Stream),
Mapping(Writer, Container) {}
Error SymbolSerializer::visitSymbolBegin(CVSymbol &Record) {
-//===- DbiModuleList.cpp - PDB module information list ----------*- C++ -*-===//
+//===- DbiModuleList.cpp - PDB module information list --------------------===//
//
// The LLVM Compiler Infrastructure
//
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#include "llvm/DebugInfo/PDB/Native/DbiModuleList.h"
+#include "llvm/DebugInfo/PDB/Native/DbiModuleList.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/iterator_range.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
+#include "llvm/Support/BinaryStreamReader.h"
#include "llvm/Support/Error.h"
+#include <algorithm>
+#include <cassert>
+#include <cstddef>
+#include <cstdint>
using namespace llvm;
using namespace llvm::pdb;
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/Native/Hash.h"
-
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/JamCRC.h"
+#include <cstdint>
using namespace llvm;
using namespace llvm::support;
-//===- HashTable.cpp - PDB Hash Table ---------------------------*- C++ -*-===//
+//===- HashTable.cpp - PDB Hash Table -------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/Native/HashTable.h"
-
#include "llvm/ADT/Optional.h"
-#include "llvm/ADT/SparseBitVector.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
-
-#include <assert.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>
+#include <utility>
using namespace llvm;
using namespace llvm::pdb;
}
uint32_t HashTable::capacity() const { return Buckets.size(); }
+
uint32_t HashTable::size() const { return Present.count(); }
HashTableIterator HashTable::begin() const { return HashTableIterator(*this); }
+
HashTableIterator HashTable::end() const {
return HashTableIterator(*this, 0, true);
}
#include "llvm/DebugInfo/PDB/Native/ModuleDebugStream.h"
#include "llvm/ADT/iterator_range.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"
-#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
-#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
#include "llvm/Support/BinaryStreamReader.h"
#include "llvm/Support/BinaryStreamRef.h"
#include "llvm/Support/Error.h"
return make_range(SymbolArray.begin(HadError), SymbolArray.end());
}
-llvm::iterator_range<ModuleDebugStreamRef::DebugSubsectionIterator>
+iterator_range<ModuleDebugStreamRef::DebugSubsectionIterator>
ModuleDebugStreamRef::subsections() const {
return make_range(Subsections.begin(), Subsections.end());
}
-//===- NamedStreamMap.cpp - PDB Named Stream Map ----------------*- C++ -*-===//
+//===- NamedStreamMap.cpp - PDB Named Stream Map --------------------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/Native/NamedStreamMap.h"
-
-#include "llvm/ADT/SparseBitVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/DebugInfo/PDB/Native/HashTable.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/BinaryStreamRef.h"
+#include "llvm/Support/BinaryStreamWriter.h"
+#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include <algorithm>
+#include <cassert>
#include <cstdint>
+#include <tuple>
using namespace llvm;
using namespace llvm::pdb;
-//===- NativeRawSymbol.cpp - Native implementation of IPDBRawSymbol -*- C++ -*-===//
+//===- NativeRawSymbol.cpp - Native implementation of IPDBRawSymbol -------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
-#include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
-#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
-#include "llvm/DebugInfo/PDB/PDBExtras.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTableShape.h"
-#include "llvm/Support/ConvertUTF.h"
-#include "llvm/Support/raw_ostream.h"
using namespace llvm;
using namespace llvm::pdb;
return nullptr;
}
-void NativeRawSymbol::getDataBytes(llvm::SmallVector<uint8_t, 32> &bytes) const {
+void NativeRawSymbol::getDataBytes(SmallVector<uint8_t, 32> &bytes) const {
bytes.clear();
}
}
std::string NativeRawSymbol::getCompilerName() const {
- return 0;
+ return {};
}
uint32_t NativeRawSymbol::getCount() const {
}
std::string NativeRawSymbol::getLibraryName() const {
- return "";
+ return {};
}
uint32_t NativeRawSymbol::getLiveRangeStartAddressOffset() const {
}
std::string NativeRawSymbol::getName() const {
- return 0;
+ return {};
}
uint32_t NativeRawSymbol::getNumberOfAcceleratorPointerTags() const {
}
std::string NativeRawSymbol::getObjectFileName() const {
- return "";
+ return {};
}
uint32_t NativeRawSymbol::getOemId() const {
}
std::string NativeRawSymbol::getSourceFileName() const {
- return 0;
+ return {};
}
uint32_t NativeRawSymbol::getStride() const {
return 0;
}
-std::string NativeRawSymbol::getSymbolsFileName() const { return ""; }
+std::string NativeRawSymbol::getSymbolsFileName() const { return {}; }
uint32_t NativeRawSymbol::getSymIndexId() const { return SymbolId; }
}
std::string NativeRawSymbol::getUndecoratedName() const {
- return 0;
+ return {};
}
uint32_t NativeRawSymbol::getUnmodifiedTypeId() const {
}
std::string NativeRawSymbol::getUnused() const {
- return "";
+ return {};
}
-//===- PDB.cpp - base header file for creating a PDB reader -----*- C++ -*-===//
+//===- PDB.cpp - base header file for creating a PDB reader ---------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/PDB.h"
-
#include "llvm/ADT/StringRef.h"
#include "llvm/Config/config.h"
#include "llvm/DebugInfo/PDB/GenericError.h"
-#include "llvm/DebugInfo/PDB/IPDBSession.h"
-#include "llvm/DebugInfo/PDB/PDB.h"
#if LLVM_ENABLE_DIA_SDK
#include "llvm/DebugInfo/PDB/DIA/DIASession.h"
#endif
#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
-#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/Error.h"
using namespace llvm;
using namespace llvm::pdb;
#if LLVM_ENABLE_DIA_SDK
return DIASession::createFromPdb(Path, Session);
#else
- return llvm::make_error<GenericError>("DIA is not installed on the system");
+ return make_error<GenericError>("DIA is not installed on the system");
#endif
}
#if LLVM_ENABLE_DIA_SDK
return DIASession::createFromExe(Path, Session);
#else
- return llvm::make_error<GenericError>("DIA is not installed on the system");
+ return make_error<GenericError>("DIA is not installed on the system");
#endif
}
-//===- PDBExtras.cpp - helper functions and classes for PDBs -----*- C++-*-===//
+//===- PDBExtras.cpp - helper functions and classes for PDBs --------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/PDBExtras.h"
-
#include "llvm/ADT/ArrayRef.h"
#include "llvm/DebugInfo/CodeView/Formatters.h"
+#include "llvm/Support/raw_ostream.h"
using namespace llvm;
using namespace llvm::pdb;
-//===- UDTLayout.cpp --------------------------------------------*- C++ -*-===//
+//===- UDTLayout.cpp ------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/UDTLayout.h"
-
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
#include "llvm/DebugInfo/PDB/IPDBSession.h"
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h"
-
-#include <utility>
+#include "llvm/DebugInfo/PDB/PDBTypes.h"
+#include "llvm/Support/Casting.h"
+#include <algorithm>
+#include <cassert>
+#include <cstdint>
+#include <memory>
using namespace llvm;
using namespace llvm::pdb;
else
Bases.push_back(std::move(Base));
}
-
else if (auto Data = unique_dyn_cast<PDBSymbolData>(Child)) {
if (Data->getDataKind() == PDB_DataKind::Member)
Members.push_back(std::move(Data));
}
ChildStorage.push_back(std::move(Child));
-}
\ No newline at end of file
+}