From: Eugene Zelenko Date: Thu, 17 Nov 2016 18:11:21 +0000 (+0000) Subject: [CodeView] Fix some Clang-tidy modernize-use-default, modernize-use-override and... X-Git-Tag: llvmorg-4.0.0-rc1~4287 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=35a5fe9f07a69415bb13278287d951768646fa61;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/llvm/include/llvm/DebugInfo/CodeView/CVRecord.h b/llvm/include/llvm/DebugInfo/CodeView/CVRecord.h index b784e4f..a327d45 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/CVRecord.h +++ b/llvm/include/llvm/DebugInfo/CodeView/CVRecord.h @@ -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 namespace llvm { + namespace codeview { template class CVRecord { public: - CVRecord() {} + CVRecord() = default; CVRecord(Kind K, ArrayRef Data) : Type(K), RecordData(Data) {} uint32_t length() const { return RecordData.size(); } Kind kind() const { return Type; } ArrayRef data() const { return RecordData; } + ArrayRef content() const { return RecordData.drop_front(sizeof(RecordPrefix)); } + Optional hash() const { return Hash; } void setHash(uint32_t Value) { Hash = Value; } @@ -41,7 +45,8 @@ public: ArrayRef RecordData; Optional Hash; }; -} + +} // end namespace codeview namespace msf { @@ -70,7 +75,9 @@ struct VarStreamArrayExtractor> { return Error::success(); } }; -} -} -#endif +} // end namespace msf + +} // end namespace llvm + +#endif // LLVM_DEBUGINFO_CODEVIEW_RECORDITERATOR_H diff --git a/llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h b/llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h index cee26a1..6c95f63 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h +++ b/llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h @@ -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 +#include #include -#include - 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 diff --git a/llvm/include/llvm/DebugInfo/CodeView/ModuleSubstreamVisitor.h b/llvm/include/llvm/DebugInfo/CodeView/ModuleSubstreamVisitor.h index bbdf820..f9927d6 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/ModuleSubstreamVisitor.h +++ b/llvm/include/llvm/DebugInfo/CodeView/ModuleSubstreamVisitor.h @@ -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 namespace llvm { + namespace codeview { + struct LineColumnEntry { support::ulittle32_t NameIndex; msf::FixedStreamArray LineNumbers; @@ -36,7 +43,7 @@ typedef msf::VarStreamArray 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 { 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 diff --git a/llvm/include/llvm/DebugInfo/CodeView/SymbolDumpDelegate.h b/llvm/include/llvm/DebugInfo/CodeView/SymbolDumpDelegate.h index 30b0a40..823636c 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/SymbolDumpDelegate.h +++ b/llvm/include/llvm/DebugInfo/CodeView/SymbolDumpDelegate.h @@ -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 +#include "llvm/DebugInfo/CodeView/SymbolVisitorDelegate.h" +#include 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 Block) = 0; }; + } // end namespace codeview } // end namespace llvm diff --git a/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h b/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h index 117c63b..1e0973d 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h +++ b/llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h @@ -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 +#include +#include namespace llvm { namespace codeview { @@ -270,7 +276,7 @@ struct BinaryAnnotationIterator { }; BinaryAnnotationIterator(ArrayRef Annotations) : Data(Annotations) {} - BinaryAnnotationIterator() {} + BinaryAnnotationIterator() = default; BinaryAnnotationIterator(const BinaryAnnotationIterator &Other) : Data(Other.Data) {} @@ -1490,7 +1496,7 @@ public: typedef CVRecord CVSymbol; typedef msf::VarStreamArray CVSymbolArray; -} // namespace codeview -} // namespace llvm +} // end namespace codeview +} // end namespace llvm -#endif +#endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLRECORD_H diff --git a/llvm/include/llvm/DebugInfo/CodeView/SymbolVisitorCallbackPipeline.h b/llvm/include/llvm/DebugInfo/CodeView/SymbolVisitorCallbackPipeline.h index ef34bcf..96a93bf 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/SymbolVisitorCallbackPipeline.h +++ b/llvm/include/llvm/DebugInfo/CodeView/SymbolVisitorCallbackPipeline.h @@ -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 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 Pipeline; }; -} -} -#endif +} // end namespace codeview +} // end namespace llvm + +#endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKPIPELINE_H diff --git a/llvm/include/llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h b/llvm/include/llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h index 9c0df11..aaa9d2e 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h +++ b/llvm/include/llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h @@ -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 diff --git a/llvm/include/llvm/DebugInfo/CodeView/SymbolVisitorDelegate.h b/llvm/include/llvm/DebugInfo/CodeView/SymbolVisitorDelegate.h index f4449ba..2b468a2 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/SymbolVisitorDelegate.h +++ b/llvm/include/llvm/DebugInfo/CodeView/SymbolVisitorDelegate.h @@ -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 +#include 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 diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeDeserializer.h b/llvm/include/llvm/DebugInfo/CodeView/TypeDeserializer.h index 07ab464..dc5eaf82 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/TypeDeserializer.h +++ b/llvm/include/llvm/DebugInfo/CodeView/TypeDeserializer.h @@ -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 +#include +#include 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(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 diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h index e24a273..4f1c047 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h +++ b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h @@ -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 -#include +#include "llvm/DebugInfo/MSF/StreamArray.h" +#include "llvm/Support/Endian.h" +#include +#include +#include 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 CVType; @@ -43,11 +46,11 @@ typedef msf::VarStreamArray 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(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 IndexMap); TypeIndex getReferentType() const { return ReferentType; } + PointerKind getPointerKind() const { return static_cast((Attrs >> PointerKindShift) & PointerKindMask); } + PointerMode getMode() const { return static_cast((Attrs >> PointerModeShift) & PointerModeMask); } + PointerOptions getOptions() const { return static_cast(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(Value); } + WindowsRTClassKind getWinRTKind() const { uint16_t Value = static_cast(Options); Value = (Value & WinRTKindMask) >> WinRTKindShift; return static_cast(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(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 SlotsRef; std::vector 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 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 + +} // end namespace llvm -#endif +#endif // LLVM_DEBUGINFO_CODEVIEW_TYPERECORD_H diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeVisitorCallbackPipeline.h b/llvm/include/llvm/DebugInfo/CodeView/TypeVisitorCallbackPipeline.h index 4f43b22..f251296 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/TypeVisitorCallbackPipeline.h +++ b/llvm/include/llvm/DebugInfo/CodeView/TypeVisitorCallbackPipeline.h @@ -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 namespace llvm { namespace codeview { + class TypeVisitorCallbackPipeline : public TypeVisitorCallbacks { public: - TypeVisitorCallbackPipeline() {} + TypeVisitorCallbackPipeline() = default; - virtual Error visitUnknownType(CVRecord &Record) override { + Error visitUnknownType(CVRecord &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 Pipeline; }; -} -} -#endif +} // end namespace codeview +} // end namespace llvm + +#endif // LLVM_DEBUGINFO_CODEVIEW_TYPEVISITORCALLBACKPIPELINE_H diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h b/llvm/include/llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h index aa514e0..5e27df3 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h +++ b/llvm/include/llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h @@ -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