1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00

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

llvm-svn: 306911
This commit is contained in:
Eugene Zelenko 2017-06-30 23:06:03 +00:00
parent 4501e40a80
commit 146f607502
30 changed files with 260 additions and 219 deletions

View File

@ -14,21 +14,27 @@
#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);
@ -37,11 +43,12 @@ inline detail::GuidAdapter fmt_guid(StringRef 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>";
@ -52,6 +59,7 @@ public:
}
}
};
}
#endif
} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_FORMATTERS_H

View File

@ -7,23 +7,18 @@
//
//===----------------------------------------------------------------------===//
#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.
@ -83,8 +78,9 @@ class StringsAndChecksums {
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; }
@ -100,7 +96,7 @@ private:
ChecksumsPtr Checksums;
};
} // namespace codeview
} // namespace llvm
} // end namespace codeview
} // end namespace llvm
#endif
#endif // LLVM_DEBUGINFO_CODEVIEW_STRINGSANDCHECKSUMS_H

View File

@ -1,4 +1,4 @@
//===- symbolSerializer.h ---------------------------------------*- C++ -*-===//
//===- SymbolSerializer.h ---------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@ -10,21 +10,20 @@
#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 {
@ -45,6 +44,8 @@ class SymbolSerializer : public SymbolVisitorCallbacks {
}
public:
SymbolSerializer(BumpPtrAllocator &Storage, CodeViewContainer Container);
template <typename SymType>
static CVSymbol writeOneSymbol(SymType &Sym, BumpPtrAllocator &Storage,
CodeViewContainer Container) {
@ -57,13 +58,11 @@ public:
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)
@ -75,7 +74,8 @@ private:
return Mapping.visitKnownRecord(CVR, Record);
}
};
}
}
#endif
} // end namespace codeview
} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLSERIALIZER_H

View File

@ -10,16 +10,17 @@
#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
@ -30,7 +31,8 @@ public:
return false;
}
};
}
}
#endif
} // end namespace codeview
} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_TYPESERVERHANDLER_H

View File

@ -1,4 +1,4 @@
//===- IPDBDataStream.h - base interface for child enumerator -*- C++ ---*-===//
//===- IPDBDataStream.h - base interface for child enumerator ---*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@ -10,9 +10,10 @@
#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 {
@ -22,18 +23,19 @@ 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

View File

@ -18,8 +18,8 @@ namespace pdb {
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;

View File

@ -7,22 +7,23 @@
//
//===----------------------------------------------------------------------===//
#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;
@ -31,9 +32,9 @@ struct FileInfoSubstreamHeader;
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,
@ -110,7 +111,8 @@ private:
BinaryStreamRef FileInfoSubstream;
BinaryStreamRef NamesBuffer;
};
}
}
#endif // LLVM_DEBUGINFO_PDB_RAW_DBIMODULELIST_H
} // end namespace pdb
} // end namespace llvm
#endif // LLVM_DEBUGINFO_PDB_NATIVE_DBIMODULELIST_H

View File

@ -7,19 +7,21 @@
//
//===----------------------------------------------------------------------===//
#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

View File

@ -7,36 +7,36 @@
//
//===----------------------------------------------------------------------===//
#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();
@ -63,6 +63,7 @@ public:
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;
@ -81,6 +82,7 @@ class HashTableIterator
: 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:
@ -101,6 +103,7 @@ private:
};
} // end namespace pdb
} // end namespace llvm
#endif // LLVM_DEBUGINFO_PDB_RAW_HASHTABLE_H
#endif // LLVM_DEBUGINFO_PDB_NATIVE_HASHTABLE_H

View File

@ -1,4 +1,4 @@
//===- ModuleDebugStream.h - PDB Module Info Stream Access ----------------===//
//===- ModuleDebugStream.h - PDB Module Info Stream Access ------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@ -7,26 +7,26 @@
//
//===----------------------------------------------------------------------===//
#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,
@ -50,7 +50,7 @@ public:
ModuleDebugStreamRef &operator=(ModuleDebugStreamRef &&Other) = default;
llvm::iterator_range<DebugSubsectionIterator> subsections() const;
iterator_range<DebugSubsectionIterator> subsections() const;
bool hasDebugSubsections() const;
@ -75,7 +75,8 @@ private:
codeview::DebugSubsectionArray Subsections;
};
}
}
#endif
} // end namespace pdb
} // end namespace llvm
#endif // LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H

View File

@ -7,27 +7,31 @@
//
//===----------------------------------------------------------------------===//
#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();
@ -50,6 +54,7 @@ private:
};
} // end namespace pdb
} // end namespace llvm
#endif // LLVM_DEBUGINFO_PDB_RAW_PDBNAMEDSTREAMMAP_H
#endif // LLVM_DEBUGINFO_PDB_NATIVE_NAMEDSTREAMMAP_H

View File

@ -1,4 +1,4 @@
//===- NativeRawSymbol.h - Native implementation of IPDBRawSymbol - C++ -*-===//
//==- NativeRawSymbol.h - Native implementation of IPDBRawSymbol -*- C++ -*-==//
//
// The LLVM Compiler Infrastructure
//
@ -11,6 +11,8 @@
#define LLVM_DEBUGINFO_PDB_NATIVE_NATIVERAWSYMBOL_H
#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
#include <cstdint>
#include <memory>
namespace llvm {
namespace pdb {
@ -36,7 +38,7 @@ public:
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;
@ -206,7 +208,7 @@ protected:
uint32_t SymbolId;
};
}
}
} // end namespace pdb
} // end namespace llvm
#endif
#endif // LLVM_DEBUGINFO_PDB_NATIVE_NATIVERAWSYMBOL_H

View File

@ -10,21 +10,23 @@
#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

View File

@ -1,4 +1,4 @@
//===- PDBExtras.h - helper functions and classes for PDBs -------*- C++-*-===//
//===- PDBExtras.h - helper functions and classes for PDBs ------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@ -10,15 +10,17 @@
#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);
@ -37,7 +39,9 @@ raw_ostream &operator<<(raw_ostream &OS, const PDB_Machine &Machine);
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

View File

@ -1,4 +1,4 @@
//===- PDBTypes.h - Defines enums for various fields contained in PDB ---*-===//
//===- PDBTypes.h - Defines enums for various fields contained in PDB ----====//
//
// The LLVM Compiler Infrastructure
//
@ -10,9 +10,10 @@
#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>
@ -20,21 +21,11 @@
namespace llvm {
namespace pdb {
class IPDBDataStream;
class IPDBLineNumber;
class IPDBSourceFile;
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 PDBSymbolExe;
class PDBSymbolCompiland;
class PDBSymbolCompilandDetails;
@ -67,6 +58,11 @@ class PDBSymbolTypeManaged;
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 {
@ -104,7 +100,7 @@ enum class PDB_Checksum { None = 0, MD5 = 1, SHA1 = 2 };
/// 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,
@ -135,12 +131,11 @@ enum class PDB_Machine {
/// 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
@ -273,9 +268,9 @@ enum PDB_VariantType {
};
struct Variant {
Variant() : Type(PDB_VariantType::Empty) {}
Variant() = default;
Variant(const Variant &Other) : Type(PDB_VariantType::Empty) {
Variant(const Variant &Other) {
*this = Other;
}
@ -284,7 +279,7 @@ struct Variant {
delete[] Value.String;
}
PDB_VariantType Type;
PDB_VariantType Type = PDB_VariantType::Empty;
union {
bool Bool;
int8_t Int8;
@ -344,18 +339,20 @@ struct Variant {
}
};
} // 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

View File

@ -10,30 +10,26 @@
#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 {
@ -41,7 +37,7 @@ public:
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; }
@ -79,7 +75,8 @@ public:
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;
@ -120,17 +117,12 @@ public:
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:
@ -183,7 +175,8 @@ private:
std::unique_ptr<PDBSymbolTypeUDT> OwnedStorage;
const PDBSymbolTypeUDT &UDT;
};
}
} // namespace llvm
} // end namespace pdb
} // end namespace llvm
#endif // LLVM_DEBUGINFO_PDB_UDTLAYOUT_H

View File

@ -1,4 +1,4 @@
//===- Formatters.cpp -------------------------------------------*- C++ -*-===//
//===- Formatters.cpp -----------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
@ -8,6 +8,10 @@
//===----------------------------------------------------------------------===//
#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;
@ -19,7 +23,7 @@ GuidAdapter::GuidAdapter(StringRef Guid)
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");

View File

@ -1,4 +1,4 @@
//===- StringsAndChecksums.cpp ----------------------------------*- C++ -*-===//
//===- StringsAndChecksums.cpp --------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
@ -8,14 +8,18 @@
//===----------------------------------------------------------------------===//
#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)

View File

@ -1,4 +1,4 @@
//===- SymbolSerializer.cpp -------------------------------------*- C++ -*-===//
//===- SymbolSerializer.cpp -----------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
@ -8,6 +8,13 @@
//===----------------------------------------------------------------------===//
#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;
@ -15,7 +22,7 @@ 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) {

View File

@ -1,4 +1,4 @@
//===- DbiModuleList.cpp - PDB module information list ----------*- C++ -*-===//
//===- DbiModuleList.cpp - PDB module information list --------------------===//
//
// The LLVM Compiler Infrastructure
//
@ -6,10 +6,17 @@
// 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;

View File

@ -8,10 +8,10 @@
//===----------------------------------------------------------------------===//
#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;

View File

@ -1,4 +1,4 @@
//===- HashTable.cpp - PDB Hash Table ---------------------------*- C++ -*-===//
//===- HashTable.cpp - PDB Hash Table -------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
@ -8,12 +8,16 @@
//===----------------------------------------------------------------------===//
#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;
@ -106,9 +110,11 @@ void HashTable::clear() {
}
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);
}

View File

@ -9,11 +9,11 @@
#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"
@ -97,7 +97,7 @@ ModuleDebugStreamRef::symbols(bool *HadError) const {
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());
}

View File

@ -1,4 +1,4 @@
//===- NamedStreamMap.cpp - PDB Named Stream Map ----------------*- C++ -*-===//
//===- NamedStreamMap.cpp - PDB Named Stream Map --------------------------===//
//
// The LLVM Compiler Infrastructure
//
@ -8,17 +8,20 @@
//===----------------------------------------------------------------------===//
#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;

View File

@ -1,4 +1,4 @@
//===- NativeRawSymbol.cpp - Native implementation of IPDBRawSymbol -*- C++ -*-===//
//===- NativeRawSymbol.cpp - Native implementation of IPDBRawSymbol -------===//
//
// The LLVM Compiler Infrastructure
//
@ -8,16 +8,7 @@
//===----------------------------------------------------------------------===//
#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;
@ -49,7 +40,7 @@ NativeRawSymbol::findInlineFramesByRVA(uint32_t RVA) const {
return nullptr;
}
void NativeRawSymbol::getDataBytes(llvm::SmallVector<uint8_t, 32> &bytes) const {
void NativeRawSymbol::getDataBytes(SmallVector<uint8_t, 32> &bytes) const {
bytes.clear();
}
@ -109,7 +100,7 @@ uint32_t NativeRawSymbol::getClassParentId() const {
}
std::string NativeRawSymbol::getCompilerName() const {
return 0;
return {};
}
uint32_t NativeRawSymbol::getCount() const {
@ -136,7 +127,7 @@ uint32_t NativeRawSymbol::getLexicalParentId() const {
}
std::string NativeRawSymbol::getLibraryName() const {
return "";
return {};
}
uint32_t NativeRawSymbol::getLiveRangeStartAddressOffset() const {
@ -164,7 +155,7 @@ uint32_t NativeRawSymbol::getMemorySpaceKind() const {
}
std::string NativeRawSymbol::getName() const {
return 0;
return {};
}
uint32_t NativeRawSymbol::getNumberOfAcceleratorPointerTags() const {
@ -188,7 +179,7 @@ uint32_t NativeRawSymbol::getNumberOfRows() const {
}
std::string NativeRawSymbol::getObjectFileName() const {
return "";
return {};
}
uint32_t NativeRawSymbol::getOemId() const {
@ -240,7 +231,7 @@ uint32_t NativeRawSymbol::getSlot() const {
}
std::string NativeRawSymbol::getSourceFileName() const {
return 0;
return {};
}
uint32_t NativeRawSymbol::getStride() const {
@ -251,7 +242,7 @@ uint32_t NativeRawSymbol::getSubTypeId() const {
return 0;
}
std::string NativeRawSymbol::getSymbolsFileName() const { return ""; }
std::string NativeRawSymbol::getSymbolsFileName() const { return {}; }
uint32_t NativeRawSymbol::getSymIndexId() const { return SymbolId; }
@ -292,7 +283,7 @@ uint32_t NativeRawSymbol::getUavSlot() const {
}
std::string NativeRawSymbol::getUndecoratedName() const {
return 0;
return {};
}
uint32_t NativeRawSymbol::getUnmodifiedTypeId() const {
@ -701,5 +692,5 @@ bool NativeRawSymbol::wasInlined() const {
}
std::string NativeRawSymbol::getUnused() const {
return "";
return {};
}

View File

@ -1,4 +1,4 @@
//===- 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
//
@ -8,18 +8,14 @@
//===----------------------------------------------------------------------===//
#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;
@ -33,7 +29,7 @@ Error llvm::pdb::loadDataForPDB(PDB_ReaderType Type, StringRef Path,
#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
}
@ -46,6 +42,6 @@ Error llvm::pdb::loadDataForEXE(PDB_ReaderType Type, StringRef Path,
#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
}

View File

@ -1,4 +1,4 @@
//===- PDBExtras.cpp - helper functions and classes for PDBs -----*- C++-*-===//
//===- PDBExtras.cpp - helper functions and classes for PDBs --------------===//
//
// The LLVM Compiler Infrastructure
//
@ -8,9 +8,9 @@
//===----------------------------------------------------------------------===//
#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;

View File

@ -1,4 +1,4 @@
//===- UDTLayout.cpp --------------------------------------------*- C++ -*-===//
//===- UDTLayout.cpp ------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
@ -8,20 +8,25 @@
//===----------------------------------------------------------------------===//
#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;
@ -176,7 +181,6 @@ void UDTLayoutBase::initializeChildren(const PDBSymbol &Sym) {
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));