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

Per Zachary Turner and Mehdi Amini suggestion to make only post-commit reviews.

llvm-svn: 287243
This commit is contained in:
Eugene Zelenko 2016-11-17 18:11:21 +00:00
parent 31d97a5c8a
commit 35a5fe9f07
12 changed files with 153 additions and 93 deletions

View File

@ -12,27 +12,31 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
#include "llvm/DebugInfo/MSF/StreamReader.h"
#include "llvm/DebugInfo/MSF/StreamRef.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include <cstdint>
namespace llvm {
namespace codeview {
template <typename Kind> class CVRecord {
public:
CVRecord() {}
CVRecord() = default;
CVRecord(Kind K, ArrayRef<uint8_t> Data) : Type(K), RecordData(Data) {}
uint32_t length() const { return RecordData.size(); }
Kind kind() const { return Type; }
ArrayRef<uint8_t> data() const { return RecordData; }
ArrayRef<uint8_t> content() const {
return RecordData.drop_front(sizeof(RecordPrefix));
}
Optional<uint32_t> hash() const { return Hash; }
void setHash(uint32_t Value) { Hash = Value; }
@ -41,7 +45,8 @@ public:
ArrayRef<uint8_t> RecordData;
Optional<uint32_t> Hash;
};
}
} // end namespace codeview
namespace msf {
@ -70,7 +75,9 @@ struct VarStreamArrayExtractor<codeview::CVRecord<Kind>> {
return Error::success();
}
};
}
}
#endif
} // end namespace msf
} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_RECORDITERATOR_H

View File

@ -11,20 +11,19 @@
#define LLVM_DEBUGINFO_CODEVIEW_CODEVIEWRECORDIO_H
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/MSF/StreamReader.h"
#include "llvm/DebugInfo/MSF/StreamWriter.h"
#include "llvm/Support/Error.h"
#include <cassert>
#include <cstdint>
#include <type_traits>
#include <stdint.h>
namespace llvm {
namespace codeview {
@ -150,7 +149,8 @@ private:
msf::StreamReader *Reader = nullptr;
msf::StreamWriter *Writer = nullptr;
};
}
}
#endif
} // end namespace codeview
} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_CODEVIEWRECORDIO_H

View File

@ -10,15 +10,22 @@
#ifndef LLVM_DEBUGINFO_CODEVIEW_MODULESUBSTREAMVISITOR_H
#define LLVM_DEBUGINFO_CODEVIEW_MODULESUBSTREAMVISITOR_H
#include "llvm/ADT/ArrayRef.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
#include "llvm/DebugInfo/CodeView/Line.h"
#include "llvm/DebugInfo/CodeView/ModuleSubstream.h"
#include "llvm/DebugInfo/MSF/StreamArray.h"
#include "llvm/DebugInfo/MSF/StreamReader.h"
#include "llvm/DebugInfo/MSF/StreamRef.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include <cstdint>
namespace llvm {
namespace codeview {
struct LineColumnEntry {
support::ulittle32_t NameIndex;
msf::FixedStreamArray<LineNumberEntry> LineNumbers;
@ -36,7 +43,7 @@ typedef msf::VarStreamArray<FileChecksumEntry> FileChecksumArray;
class IModuleSubstreamVisitor {
public:
virtual ~IModuleSubstreamVisitor() {}
virtual ~IModuleSubstreamVisitor() = default;
virtual Error visitUnknown(ModuleSubstreamKind Kind,
msf::ReadableStreamRef Data) = 0;
@ -60,9 +67,10 @@ public:
Error visitModuleSubstream(const ModuleSubstream &R,
IModuleSubstreamVisitor &V);
} // namespace codeview
} // end namespace codeview
namespace msf {
template <> class VarStreamArrayExtractor<codeview::LineColumnEntry> {
public:
VarStreamArrayExtractor(const codeview::LineSubstreamHeader *Header)
@ -121,7 +129,8 @@ public:
}
};
} // namespace msf
} // namespace llvm
} // end namespace msf
} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_MODULESUBSTREAMVISITOR_H

View File

@ -10,20 +10,17 @@
#ifndef LLVM_DEBUGINFO_CODEVIEW_SYMBOLDUMPDELEGATE_H
#define LLVM_DEBUGINFO_CODEVIEW_SYMBOLDUMPDELEGATE_H
#include "SymbolVisitorDelegate.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
#include <stdint.h>
#include "llvm/DebugInfo/CodeView/SymbolVisitorDelegate.h"
#include <cstdint>
namespace llvm {
namespace codeview {
class SymbolDumpDelegate : public SymbolVisitorDelegate {
public:
virtual ~SymbolDumpDelegate() {}
~SymbolDumpDelegate() override = default;
virtual void printRelocatedField(StringRef Label, uint32_t RelocOffset,
uint32_t Offset,
@ -31,6 +28,7 @@ public:
virtual void printBinaryBlockWithRelocs(StringRef Label,
ArrayRef<uint8_t> Block) = 0;
};
} // end namespace codeview
} // end namespace llvm

View File

@ -11,7 +11,10 @@
#define LLVM_DEBUGINFO_CODEVIEW_SYMBOLRECORD_H
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/CodeView/CVRecord.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
@ -19,6 +22,9 @@
#include "llvm/DebugInfo/MSF/StreamArray.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include <cstddef>
#include <cstdint>
#include <vector>
namespace llvm {
namespace codeview {
@ -270,7 +276,7 @@ struct BinaryAnnotationIterator {
};
BinaryAnnotationIterator(ArrayRef<uint8_t> Annotations) : Data(Annotations) {}
BinaryAnnotationIterator() {}
BinaryAnnotationIterator() = default;
BinaryAnnotationIterator(const BinaryAnnotationIterator &Other)
: Data(Other.Data) {}
@ -1490,7 +1496,7 @@ public:
typedef CVRecord<SymbolKind> CVSymbol;
typedef msf::VarStreamArray<CVSymbol> CVSymbolArray;
} // namespace codeview
} // namespace llvm
} // end namespace codeview
} // end namespace llvm
#endif
#endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLRECORD_H

View File

@ -1,4 +1,4 @@
//===- SymbolVisitorCallbackPipeline.h ------------------------ *- C++ --*-===//
//===- SymbolVisitorCallbackPipeline.h --------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@ -10,19 +10,19 @@
#ifndef LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKPIPELINE_H
#define LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKPIPELINE_H
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h"
#include "llvm/Support/Error.h"
#include <vector>
namespace llvm {
namespace codeview {
class SymbolVisitorCallbackPipeline : public SymbolVisitorCallbacks {
public:
SymbolVisitorCallbackPipeline() {}
SymbolVisitorCallbackPipeline() = default;
virtual Error visitUnknownSymbol(CVSymbol &Record) override {
Error visitUnknownSymbol(CVSymbol &Record) override {
for (auto Visitor : Pipeline) {
if (auto EC = Visitor->visitUnknownSymbol(Record))
return EC;
@ -30,14 +30,15 @@ public:
return Error::success();
}
virtual Error visitSymbolBegin(CVSymbol &Record) override {
Error visitSymbolBegin(CVSymbol &Record) override {
for (auto Visitor : Pipeline) {
if (auto EC = Visitor->visitSymbolBegin(Record))
return EC;
}
return Error::success();
}
virtual Error visitSymbolEnd(CVSymbol &Record) override {
Error visitSymbolEnd(CVSymbol &Record) override {
for (auto Visitor : Pipeline) {
if (auto EC = Visitor->visitSymbolEnd(Record))
return EC;
@ -63,7 +64,8 @@ public:
private:
std::vector<SymbolVisitorCallbacks *> Pipeline;
};
}
}
#endif
} // end namespace codeview
} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKPIPELINE_H

View File

@ -10,19 +10,17 @@
#ifndef LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKS_H
#define LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKS_H
#include "llvm/ADT/ArrayRef.h"
#include "llvm/DebugInfo/CodeView/CVRecord.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/Support/Error.h"
namespace llvm {
namespace codeview {
class SymbolVisitorCallbacks {
friend class CVSymbolVisitor;
public:
virtual ~SymbolVisitorCallbacks() {}
virtual ~SymbolVisitorCallbacks() = default;
/// Action to take on unknown symbols. By default, they are ignored.
virtual Error visitUnknownSymbol(CVSymbol &Record) {
@ -43,7 +41,8 @@ public:
#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
#include "CVSymbolTypes.def"
};
}
}
#endif
} // end namespace codeview
} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKS_H

View File

@ -10,28 +10,28 @@
#ifndef LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORDELEGATE_H
#define LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORDELEGATE_H
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
#include <stdint.h>
#include <cstdint>
namespace llvm {
namespace msf {
class StreamReader;
}
} // end namespace msf
namespace codeview {
class SymbolVisitorDelegate {
public:
virtual ~SymbolVisitorDelegate() {}
virtual ~SymbolVisitorDelegate() = default;
virtual uint32_t getRecordOffset(msf::StreamReader Reader) = 0;
virtual StringRef getFileNameForFileOffset(uint32_t FileOffset) = 0;
virtual StringRef getStringTable() = 0;
};
} // end namespace codeview
} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORDELEGATE_H

View File

@ -10,14 +10,18 @@
#ifndef LLVM_DEBUGINFO_CODEVIEW_TYPEDESERIALIZER_H
#define LLVM_DEBUGINFO_CODEVIEW_TYPEDESERIALIZER_H
#include "llvm/ADT/Optional.h"
#include "llvm/DebugInfo/CodeView/CodeViewRecordIO.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/CodeView/TypeRecordMapping.h"
#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
#include "llvm/DebugInfo/MSF/ByteStream.h"
#include "llvm/DebugInfo/MSF/StreamReader.h"
#include "llvm/DebugInfo/MSF/StreamWriter.h"
#include "llvm/Support/Error.h"
#include <cassert>
#include <cstdint>
#include <memory>
namespace llvm {
namespace codeview {
@ -33,13 +37,14 @@ class TypeDeserializer : public TypeVisitorCallbacks {
};
public:
TypeDeserializer() {}
TypeDeserializer() = default;
Error visitTypeBegin(CVType &Record) override {
assert(!Mapping && "Already in a type mapping!");
Mapping = llvm::make_unique<MappingInfo>(Record.content());
return Mapping->Mapping.visitTypeBegin(Record);
}
Error visitTypeEnd(CVType &Record) override {
assert(Mapping && "Not in a type mapping!");
auto EC = Mapping->Mapping.visitTypeEnd(Record);
@ -82,7 +87,7 @@ public:
consumeError(Mapping.Mapping.visitTypeBegin(FieldList));
}
~FieldListDeserializer() {
~FieldListDeserializer() override {
CVType FieldList;
FieldList.Type = TypeLeafKind::LF_FIELDLIST;
consumeError(Mapping.Mapping.visitTypeEnd(FieldList));
@ -92,6 +97,7 @@ public:
Mapping.StartOffset = Mapping.Reader.getOffset();
return Mapping.Mapping.visitMemberBegin(Record);
}
Error visitMemberEnd(CVMemberRecord &Record) override {
if (auto EC = Mapping.Mapping.visitMemberEnd(Record))
return EC;
@ -123,7 +129,8 @@ private:
}
MappingInfo Mapping;
};
}
}
#endif
} // end namespace codeview
} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_TYPEDESERIALIZER_H

View File

@ -13,25 +13,28 @@
#include "llvm/ADT/APSInt.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/CVRecord.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/Support/Error.h"
#include <cinttypes>
#include <utility>
#include "llvm/DebugInfo/MSF/StreamArray.h"
#include "llvm/Support/Endian.h"
#include <algorithm>
#include <cstdint>
#include <vector>
namespace llvm {
namespace msf {
class StreamReader;
}
} // end namespace msf
namespace codeview {
using llvm::support::little32_t;
using llvm::support::ulittle16_t;
using llvm::support::ulittle32_t;
using support::little32_t;
using support::ulittle16_t;
using support::ulittle32_t;
typedef CVRecord<TypeLeafKind> CVType;
@ -43,11 +46,11 @@ typedef msf::VarStreamArray<CVType> CVTypeArray;
/// Equvalent to CV_fldattr_t in cvinfo.h.
struct MemberAttributes {
uint16_t Attrs;
uint16_t Attrs = 0;
enum {
MethodKindShift = 2,
};
MemberAttributes() : Attrs(0) {}
MemberAttributes() = default;
explicit MemberAttributes(MemberAccess Access)
: Attrs(static_cast<uint16_t>(Access)) {}
@ -97,7 +100,7 @@ struct MemberAttributes {
// if it represents a member pointer.
class MemberPointerInfo {
public:
MemberPointerInfo() {}
MemberPointerInfo() = default;
MemberPointerInfo(TypeIndex ContainingType,
PointerToMemberRepresentation Representation)
@ -118,7 +121,7 @@ public:
class TypeRecord {
protected:
TypeRecord() {}
TypeRecord() = default;
explicit TypeRecord(TypeRecordKind Kind) : Kind(Kind) {}
public:
@ -292,31 +295,39 @@ public:
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
TypeIndex getReferentType() const { return ReferentType; }
PointerKind getPointerKind() const {
return static_cast<PointerKind>((Attrs >> PointerKindShift) &
PointerKindMask);
}
PointerMode getMode() const {
return static_cast<PointerMode>((Attrs >> PointerModeShift) &
PointerModeMask);
}
PointerOptions getOptions() const {
return static_cast<PointerOptions>(Attrs);
}
uint8_t getSize() const {
return (Attrs >> PointerSizeShift) & PointerSizeMask;
}
MemberPointerInfo getMemberInfo() const { return *MemberInfo; }
bool isPointerToMember() const {
return getMode() == PointerMode::PointerToDataMember ||
getMode() == PointerMode::PointerToMemberFunction;
}
bool isFlat() const { return !!(Attrs & uint32_t(PointerOptions::Flat32)); }
bool isConst() const { return !!(Attrs & uint32_t(PointerOptions::Const)); }
bool isVolatile() const {
return !!(Attrs & uint32_t(PointerOptions::Volatile));
}
bool isUnaligned() const {
return !!(Attrs & uint32_t(PointerOptions::Unaligned));
}
@ -386,12 +397,12 @@ public:
TypeIndex getElementType() const { return ElementType; }
TypeIndex getIndexType() const { return IndexType; }
uint64_t getSize() const { return Size; }
llvm::StringRef getName() const { return Name; }
StringRef getName() const { return Name; }
TypeIndex ElementType;
TypeIndex IndexType;
uint64_t Size;
llvm::StringRef Name;
StringRef Name;
};
class TagRecord : public TypeRecord {
@ -449,11 +460,13 @@ public:
Value = (Value & HfaKindMask) >> HfaKindShift;
return static_cast<HfaKind>(Value);
}
WindowsRTClassKind getWinRTKind() const {
uint16_t Value = static_cast<uint16_t>(Options);
Value = (Value & WinRTKindMask) >> WinRTKindShift;
return static_cast<WindowsRTClassKind>(Value);
}
TypeIndex getDerivationList() const { return DerivationList; }
TypeIndex getVTableShape() const { return VTableShape; }
uint64_t getSize() const { return Size; }
@ -477,6 +490,7 @@ struct UnionRecord : public TagRecord {
Value = (Value & HfaKindMask) >> HfaKindShift;
return static_cast<HfaKind>(Value);
}
uint64_t getSize() const { return Size; }
uint64_t Size;
@ -537,6 +551,7 @@ public:
return SlotsRef;
return Slots;
}
uint32_t getEntryCount() const { return getSlots().size(); }
ArrayRef<VFTableSlotKind> SlotsRef;
std::vector<VFTableSlotKind> Slots;
@ -559,6 +574,7 @@ public:
uint32_t getAge() const { return Age; }
StringRef getName() const { return Name; }
StringRef Guid;
uint32_t Age;
StringRef Name;
@ -599,6 +615,7 @@ public:
TypeIndex getFunctionType() const { return FunctionType; }
StringRef getName() const { return Name; }
TypeIndex ParentScope;
TypeIndex FunctionType;
StringRef Name;
@ -619,6 +636,7 @@ public:
TypeIndex getUDT() const { return UDT; }
TypeIndex getSourceFile() const { return SourceFile; }
uint32_t getLineNumber() const { return LineNumber; }
TypeIndex UDT;
TypeIndex SourceFile;
uint32_t LineNumber;
@ -639,6 +657,7 @@ public:
TypeIndex getSourceFile() const { return SourceFile; }
uint32_t getLineNumber() const { return LineNumber; }
uint16_t getModule() const { return Module; }
TypeIndex UDT;
TypeIndex SourceFile;
uint32_t LineNumber;
@ -721,6 +740,7 @@ public:
return getMethodKind() == MethodKind::IntroducingVirtual ||
getMethodKind() == MethodKind::PureIntroducingVirtual;
}
TypeIndex Type;
MemberAttributes Attrs;
int32_t VFTableOffset;
@ -784,6 +804,7 @@ public:
TypeIndex getType() const { return Type; }
uint64_t getFieldOffset() const { return FieldOffset; }
StringRef getName() const { return Name; }
MemberAttributes Attrs;
TypeIndex Type;
uint64_t FieldOffset;
@ -808,6 +829,7 @@ public:
MemberAccess getAccess() const { return Attrs.getAccess(); }
TypeIndex getType() const { return Type; }
StringRef getName() const { return Name; }
MemberAttributes Attrs;
TypeIndex Type;
StringRef Name;
@ -831,6 +853,7 @@ public:
MemberAccess getAccess() const { return Attrs.getAccess(); }
APSInt getValue() const { return Value; }
StringRef getName() const { return Name; }
MemberAttributes Attrs;
APSInt Value;
StringRef Name;
@ -848,6 +871,7 @@ public:
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
TypeIndex getType() const { return Type; }
TypeIndex Type;
};
@ -869,6 +893,7 @@ public:
MemberAccess getAccess() const { return Attrs.getAccess(); }
TypeIndex getBaseType() const { return Type; }
uint64_t getBaseOffset() const { return Offset; }
MemberAttributes Attrs;
TypeIndex Type;
uint64_t Offset;
@ -898,6 +923,7 @@ public:
TypeIndex getVBPtrType() const { return VBPtrType; }
uint64_t getVBPtrOffset() const { return VBPtrOffset; }
uint64_t getVTableIndex() const { return VTableIndex; }
MemberAttributes Attrs;
TypeIndex BaseType;
TypeIndex VBPtrType;
@ -921,7 +947,8 @@ public:
TypeIndex ContinuationIndex;
};
}
}
} // end namespace codeview
#endif
} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_TYPERECORD_H

View File

@ -1,4 +1,4 @@
//===- TypeVisitorCallbackPipeline.h -------------------------- *- C++ --*-===//
//===- TypeVisitorCallbackPipeline.h ----------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@ -13,16 +13,17 @@
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
#include "llvm/Support/Error.h"
#include <vector>
namespace llvm {
namespace codeview {
class TypeVisitorCallbackPipeline : public TypeVisitorCallbacks {
public:
TypeVisitorCallbackPipeline() {}
TypeVisitorCallbackPipeline() = default;
virtual Error visitUnknownType(CVRecord<TypeLeafKind> &Record) override {
Error visitUnknownType(CVRecord<TypeLeafKind> &Record) override {
for (auto Visitor : Pipeline) {
if (auto EC = Visitor->visitUnknownType(Record))
return EC;
@ -30,7 +31,7 @@ public:
return Error::success();
}
virtual Error visitUnknownMember(CVMemberRecord &Record) override {
Error visitUnknownMember(CVMemberRecord &Record) override {
for (auto Visitor : Pipeline) {
if (auto EC = Visitor->visitUnknownMember(Record))
return EC;
@ -38,14 +39,15 @@ public:
return Error::success();
}
virtual Error visitTypeBegin(CVType &Record) override {
Error visitTypeBegin(CVType &Record) override {
for (auto Visitor : Pipeline) {
if (auto EC = Visitor->visitTypeBegin(Record))
return EC;
}
return Error::success();
}
virtual Error visitTypeEnd(CVType &Record) override {
Error visitTypeEnd(CVType &Record) override {
for (auto Visitor : Pipeline) {
if (auto EC = Visitor->visitTypeEnd(Record))
return EC;
@ -53,14 +55,15 @@ public:
return Error::success();
}
virtual Error visitMemberBegin(CVMemberRecord &Record) override {
Error visitMemberBegin(CVMemberRecord &Record) override {
for (auto Visitor : Pipeline) {
if (auto EC = Visitor->visitMemberBegin(Record))
return EC;
}
return Error::success();
}
virtual Error visitMemberEnd(CVMemberRecord &Record) override {
Error visitMemberEnd(CVMemberRecord &Record) override {
for (auto Visitor : Pipeline) {
if (auto EC = Visitor->visitMemberEnd(Record))
return EC;
@ -104,7 +107,8 @@ private:
}
std::vector<TypeVisitorCallbacks *> Pipeline;
};
}
}
#endif
} // end namespace codeview
} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_TYPEVISITORCALLBACKPIPELINE_H

View File

@ -10,19 +10,17 @@
#ifndef LLVM_DEBUGINFO_CODEVIEW_TYPEVISITORCALLBACKS_H
#define LLVM_DEBUGINFO_CODEVIEW_TYPEVISITORCALLBACKS_H
#include "llvm/ADT/ArrayRef.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/CVRecord.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/Support/Error.h"
namespace llvm {
namespace codeview {
class TypeVisitorCallbacks {
friend class CVTypeVisitor;
public:
virtual ~TypeVisitorCallbacks() {}
virtual ~TypeVisitorCallbacks() = default;
/// Action to take on unknown types. By default, they are ignored.
virtual Error visitUnknownType(CVType &Record) { return Error::success(); }
@ -35,9 +33,11 @@ public:
virtual Error visitUnknownMember(CVMemberRecord &Record) {
return Error::success();
}
virtual Error visitMemberBegin(CVMemberRecord &Record) {
return Error::success();
}
virtual Error visitMemberEnd(CVMemberRecord &Record) {
return Error::success();
}
@ -55,7 +55,8 @@ public:
#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
#include "TypeRecords.def"
};
}
}
#endif
} // end namespace codeview
} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_TYPEVISITORCALLBACKS_H