diff --git a/include/llvm/IR/Dominators.h b/include/llvm/IR/Dominators.h index db512e10108..88c8456cb46 100644 --- a/include/llvm/IR/Dominators.h +++ b/include/llvm/IR/Dominators.h @@ -16,17 +16,21 @@ #define LLVM_IR_DOMINATORS_H #include "llvm/ADT/DenseMapInfo.h" +#include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/GraphTraits.h" -#include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/Hashing.h" +#include "llvm/IR/BasicBlock.h" #include "llvm/IR/CFG.h" #include "llvm/IR/PassManager.h" #include "llvm/Pass.h" #include "llvm/Support/GenericDomTree.h" +#include namespace llvm { class Function; -class BasicBlock; +class Instruction; +class Module; class raw_ostream; extern template class DomTreeNodeBase; @@ -43,28 +47,37 @@ typedef DomTreeNodeBase DomTreeNode; class BasicBlockEdge { const BasicBlock *Start; const BasicBlock *End; + public: BasicBlockEdge(const BasicBlock *Start_, const BasicBlock *End_) : - Start(Start_), End(End_) { } + Start(Start_), End(End_) {} + BasicBlockEdge(const std::pair &Pair) : Start(Pair.first), End(Pair.second) {} + BasicBlockEdge(const std::pair &Pair) : Start(Pair.first), End(Pair.second) {} + const BasicBlock *getStart() const { return Start; } + const BasicBlock *getEnd() const { return End; } + bool isSingleEdge() const; }; template <> struct DenseMapInfo { - static unsigned getHashValue(const BasicBlockEdge *V); typedef DenseMapInfo BBInfo; + + static unsigned getHashValue(const BasicBlockEdge *V); + static inline BasicBlockEdge getEmptyKey() { return BasicBlockEdge(BBInfo::getEmptyKey(), BBInfo::getEmptyKey()); } + static inline BasicBlockEdge getTombstoneKey() { return BasicBlockEdge(BBInfo::getTombstoneKey(), BBInfo::getTombstoneKey()); } @@ -73,6 +86,7 @@ template <> struct DenseMapInfo { return hash_combine(BBInfo::getHashValue(Edge.getStart()), BBInfo::getHashValue(Edge.getEnd())); } + static bool isEqual(const BasicBlockEdge &LHS, const BasicBlockEdge &RHS) { return BBInfo::isEqual(LHS.getStart(), RHS.getStart()) && BBInfo::isEqual(LHS.getEnd(), RHS.getEnd()); @@ -213,6 +227,7 @@ class DominatorTreePrinterPass public: explicit DominatorTreePrinterPass(raw_ostream &OS); + PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); }; @@ -248,6 +263,6 @@ public: void print(raw_ostream &OS, const Module *M = nullptr) const override; }; -} // End llvm namespace +} // end namespace llvm -#endif +#endif // LLVM_IR_DOMINATORS_H diff --git a/include/llvm/Support/Allocator.h b/include/llvm/Support/Allocator.h index 6a65f61fbfa..7622b5d0a63 100644 --- a/include/llvm/Support/Allocator.h +++ b/include/llvm/Support/Allocator.h @@ -1,4 +1,4 @@ -//===--- Allocator.h - Simple memory allocation abstraction -----*- C++ -*-===// +//===- Allocator.h - Simple memory allocation abstraction -------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -144,12 +144,11 @@ public: "that objects larger than a slab go into their own memory " "allocation."); - BumpPtrAllocatorImpl() - : CurPtr(nullptr), End(nullptr), BytesAllocated(0), Allocator() {} + BumpPtrAllocatorImpl() = default; + template BumpPtrAllocatorImpl(T &&Allocator) - : CurPtr(nullptr), End(nullptr), BytesAllocated(0), - Allocator(std::forward(Allocator)) {} + : Allocator(std::forward(Allocator)) {} // Manually implement a move constructor as we must clear the old allocator's // slabs as a matter of correctness. @@ -292,10 +291,10 @@ private: /// \brief The current pointer into the current slab. /// /// This points to the next free byte in the slab. - char *CurPtr; + char *CurPtr = nullptr; /// \brief The end of the current slab. - char *End; + char *End = nullptr; /// \brief The slabs allocated so far. SmallVector Slabs; @@ -306,7 +305,7 @@ private: /// \brief How many bytes we've allocated. /// /// Used so that we can compute how much space was wasted. - size_t BytesAllocated; + size_t BytesAllocated = 0; /// \brief The allocator instance we use to get slabs of memory. AllocatorT Allocator; diff --git a/include/llvm/Support/FileSystem.h b/include/llvm/Support/FileSystem.h index aff4329fe4a..f2a17b6bf83 100644 --- a/include/llvm/Support/FileSystem.h +++ b/include/llvm/Support/FileSystem.h @@ -141,40 +141,35 @@ public: /// a platform-specific member to store the result. class file_status { - #if defined(LLVM_ON_UNIX) - dev_t fs_st_dev; - ino_t fs_st_ino; - time_t fs_st_atime; - time_t fs_st_mtime; - uid_t fs_st_uid; - gid_t fs_st_gid; - off_t fs_st_size; - #elif defined (LLVM_ON_WIN32) - uint32_t LastAccessedTimeHigh; - uint32_t LastAccessedTimeLow; - uint32_t LastWriteTimeHigh; - uint32_t LastWriteTimeLow; - uint32_t VolumeSerialNumber; - uint32_t FileSizeHigh; - uint32_t FileSizeLow; - uint32_t FileIndexHigh; - uint32_t FileIndexLow; - #endif friend bool equivalent(file_status A, file_status B); - file_type Type; - perms Perms; + + #if defined(LLVM_ON_UNIX) + dev_t fs_st_dev = 0; + ino_t fs_st_ino = 0; + time_t fs_st_atime = 0; + time_t fs_st_mtime = 0; + uid_t fs_st_uid = 0; + gid_t fs_st_gid = 0; + off_t fs_st_size = 0; + #elif defined (LLVM_ON_WIN32) + uint32_t LastAccessedTimeHigh = 0; + uint32_t LastAccessedTimeLow = 0; + uint32_t LastWriteTimeHigh = 0; + uint32_t LastWriteTimeLow = 0; + uint32_t VolumeSerialNumber = 0; + uint32_t FileSizeHigh = 0; + uint32_t FileSizeLow = 0; + uint32_t FileIndexHigh = 0; + uint32_t FileIndexLow = 0; + #endif + file_type Type = file_type::status_error; + perms Perms = perms_not_known; public: #if defined(LLVM_ON_UNIX) - file_status() - : fs_st_dev(0), fs_st_ino(0), fs_st_atime(0), fs_st_mtime(0), - fs_st_uid(0), fs_st_gid(0), fs_st_size(0), - Type(file_type::status_error), Perms(perms_not_known) {} + file_status() = default; - file_status(file_type Type) - : fs_st_dev(0), fs_st_ino(0), fs_st_atime(0), fs_st_mtime(0), - fs_st_uid(0), fs_st_gid(0), fs_st_size(0), Type(Type), - Perms(perms_not_known) {} + file_status(file_type Type) : Type(Type) {} file_status(file_type Type, perms Perms, dev_t Dev, ino_t Ino, time_t ATime, time_t MTime, uid_t UID, gid_t GID, off_t Size) @@ -182,17 +177,9 @@ public: fs_st_uid(UID), fs_st_gid(GID), fs_st_size(Size), Type(Type), Perms(Perms) {} #elif defined(LLVM_ON_WIN32) - file_status() - : LastAccessedTimeHigh(0), LastAccessedTimeLow(0), LastWriteTimeHigh(0), - LastWriteTimeLow(0), VolumeSerialNumber(0), FileSizeHigh(0), - FileSizeLow(0), FileIndexHigh(0), FileIndexLow(0), - Type(file_type::status_error), Perms(perms_not_known) {} + file_status() = default; - file_status(file_type Type) - : LastAccessedTimeHigh(0), LastAccessedTimeLow(0), LastWriteTimeHigh(0), - LastWriteTimeLow(0), VolumeSerialNumber(0), FileSizeHigh(0), - FileSizeLow(0), FileIndexHigh(0), FileIndexLow(0), Type(Type), - Perms(perms_not_known) {} + file_status(file_type Type) : Type(Type) {} file_status(file_type Type, uint32_t LastAccessTimeHigh, uint32_t LastAccessTimeLow, uint32_t LastWriteTimeHigh, @@ -204,7 +191,7 @@ public: LastWriteTimeLow(LastWriteTimeLow), VolumeSerialNumber(VolumeSerialNumber), FileSizeHigh(FileSizeHigh), FileSizeLow(FileSizeLow), FileIndexHigh(FileIndexHigh), - FileIndexLow(FileIndexLow), Type(Type), Perms(perms_not_known) {} + FileIndexLow(FileIndexLow), Type(Type) {} #endif // getters @@ -222,9 +209,11 @@ public: uint32_t getUser() const { return 9999; // Not applicable to Windows, so... } + uint32_t getGroup() const { return 9999; // Not applicable to Windows, so... } + uint64_t getSize() const { return (uint64_t(FileSizeHigh) << 32) + FileSizeLow; } @@ -271,12 +260,12 @@ struct file_magic { return V != unknown; } - file_magic() : V(unknown) {} + file_magic() = default; file_magic(Impl V) : V(V) {} operator Impl() const { return V; } private: - Impl V; + Impl V = unknown; }; /// @} @@ -796,6 +785,7 @@ public: }; namespace detail { + struct DirIterState; std::error_code directory_iterator_construct(DirIterState &, StringRef); @@ -811,6 +801,7 @@ namespace detail { intptr_t IterationHandle = 0; directory_entry CurrentEntry; }; + } // end namespace detail /// directory_iterator - Iterates through the entries in path. There is no @@ -862,12 +853,14 @@ public: }; namespace detail { + /// Keeps state for the recursive_directory_iterator. struct RecDirIterState { std::stack> Stack; uint16_t Level = 0; bool HasNoPushRequest = false; }; + } // end namespace detail /// recursive_directory_iterator - Same as directory_iterator except for it diff --git a/include/llvm/Support/GCOV.h b/include/llvm/Support/GCOV.h index 9a0fb38bd82..73fddca8e35 100644 --- a/include/llvm/Support/GCOV.h +++ b/include/llvm/Support/GCOV.h @@ -63,7 +63,7 @@ struct Options { /// read operations. class GCOVBuffer { public: - GCOVBuffer(MemoryBuffer *B) : Buffer(B), Cursor(0) {} + GCOVBuffer(MemoryBuffer *B) : Buffer(B) {} /// readGCNOFormat - Check GCNO signature is valid at the beginning of buffer. bool readGCNOFormat() { @@ -234,16 +234,14 @@ public: private: MemoryBuffer *Buffer; - uint64_t Cursor; + uint64_t Cursor = 0; }; /// GCOVFile - Collects coverage information for one pair of coverage file /// (.gcno and .gcda). class GCOVFile { public: - GCOVFile() - : GCNOInitialized(false), Checksum(0), RunCount(0), - ProgramCount(0) {} + GCOVFile() = default; bool readGCNO(GCOVBuffer &Buffer); bool readGCDA(GCOVBuffer &Buffer); @@ -253,21 +251,21 @@ public: void collectLineCounts(FileInfo &FI); private: - bool GCNOInitialized; + bool GCNOInitialized = false; GCOV::GCOVVersion Version; - uint32_t Checksum; + uint32_t Checksum = 0; SmallVector, 16> Functions; - uint32_t RunCount; - uint32_t ProgramCount; + uint32_t RunCount = 0; + uint32_t ProgramCount = 0; }; /// GCOVEdge - Collects edge information. struct GCOVEdge { - GCOVEdge(GCOVBlock &S, GCOVBlock &D) : Src(S), Dst(D), Count(0) {} + GCOVEdge(GCOVBlock &S, GCOVBlock &D) : Src(S), Dst(D) {} GCOVBlock &Src; GCOVBlock &Dst; - uint64_t Count; + uint64_t Count = 0; }; /// GCOVFunction - Collects function information. @@ -276,7 +274,8 @@ public: typedef pointee_iterator>::const_iterator> BlockIterator; - GCOVFunction(GCOVFile &P) : Parent(P), Ident(0), LineNumber(0) {} + GCOVFunction(GCOVFile &P) : Parent(P) {} + bool readGCNO(GCOVBuffer &Buffer, GCOV::GCOVVersion Version); bool readGCDA(GCOVBuffer &Buffer, GCOV::GCOVVersion Version); StringRef getName() const { return Name; } @@ -297,9 +296,9 @@ public: private: GCOVFile &Parent; - uint32_t Ident; + uint32_t Ident = 0; uint32_t Checksum; - uint32_t LineNumber; + uint32_t LineNumber = 0; StringRef Name; StringRef Filename; SmallVector, 16> Blocks; @@ -309,10 +308,10 @@ private: /// GCOVBlock - Collects block information. class GCOVBlock { struct EdgeWeight { - EdgeWeight(GCOVBlock *D) : Dst(D), Count(0) {} + EdgeWeight(GCOVBlock *D) : Dst(D) {} GCOVBlock *Dst; - uint64_t Count; + uint64_t Count = 0; }; struct SortDstEdgesFunctor { @@ -324,8 +323,7 @@ class GCOVBlock { public: typedef SmallVectorImpl::const_iterator EdgeIterator; - GCOVBlock(GCOVFunction &P, uint32_t N) - : Parent(P), Number(N), Counter(0), DstEdgesAreSorted(true) {} + GCOVBlock(GCOVFunction &P, uint32_t N) : Parent(P), Number(N) {} ~GCOVBlock(); const GCOVFunction &getParent() const { return Parent; } @@ -370,8 +368,8 @@ public: private: GCOVFunction &Parent; uint32_t Number; - uint64_t Counter; - bool DstEdgesAreSorted; + uint64_t Counter = 0; + bool DstEdgesAreSorted = true; SmallVector SrcEdges; SmallVector DstEdges; SmallVector Lines; @@ -389,30 +387,28 @@ class FileInfo { typedef DenseMap BlockLines; struct LineData { - LineData() : LastLine(0) {} + LineData() = default; + BlockLines Blocks; FunctionLines Functions; - uint32_t LastLine; + uint32_t LastLine = 0; }; struct GCOVCoverage { - GCOVCoverage(StringRef Name) - : Name(Name), LogicalLines(0), LinesExec(0), Branches(0), - BranchesExec(0), BranchesTaken(0) {} + GCOVCoverage(StringRef Name) : Name(Name) {} StringRef Name; - uint32_t LogicalLines; - uint32_t LinesExec; + uint32_t LogicalLines = 0; + uint32_t LinesExec = 0; - uint32_t Branches; - uint32_t BranchesExec; - uint32_t BranchesTaken; + uint32_t Branches = 0; + uint32_t BranchesExec = 0; + uint32_t BranchesTaken = 0; }; public: - FileInfo(const GCOV::Options &Options) - : Options(Options), RunCount(0), ProgramCount(0) {} + FileInfo(const GCOV::Options &Options) : Options(Options) {} void addBlockLine(StringRef Filename, uint32_t Line, const GCOVBlock *Block) { if (Line > LineInfo[Filename].LastLine) @@ -449,8 +445,8 @@ private: const GCOV::Options &Options; StringMap LineInfo; - uint32_t RunCount; - uint32_t ProgramCount; + uint32_t RunCount = 0; + uint32_t ProgramCount = 0; typedef SmallVector, 4> FileCoverageList; typedef MapVector FuncCoverageMap; diff --git a/include/llvm/Support/GenericDomTree.h b/include/llvm/Support/GenericDomTree.h index acad850f220..d297324dcea 100644 --- a/include/llvm/Support/GenericDomTree.h +++ b/include/llvm/Support/GenericDomTree.h @@ -25,14 +25,19 @@ #define LLVM_SUPPORT_GENERICDOMTREE_H #include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/GraphTraits.h" -#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" -#include "llvm/Support/Compiler.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/Support/raw_ostream.h" #include +#include +#include +#include +#include +#include +#include +#include namespace llvm { @@ -47,7 +52,7 @@ template struct DominatorTreeBaseTraits { typename std::remove_pointer::type>; }; -} // End namespace detail +} // end namespace detail template using DominatorTreeBaseByGraphTraits = @@ -59,13 +64,16 @@ template class DominatorBase { protected: std::vector Roots; bool IsPostDominators; + explicit DominatorBase(bool isPostDom) : Roots(), IsPostDominators(isPostDom) {} + DominatorBase(DominatorBase &&Arg) : Roots(std::move(Arg.Roots)), IsPostDominators(std::move(Arg.IsPostDominators)) { Arg.Roots.clear(); } + DominatorBase &operator=(DominatorBase &&RHS) { Roots = std::move(RHS.Roots); IsPostDominators = std::move(RHS.IsPostDominators); @@ -85,19 +93,21 @@ public: bool isPostDominator() const { return IsPostDominators; } }; -struct PostDominatorTree; - /// \brief Base class for the actual dominator tree node. template class DomTreeNodeBase { + friend struct PostDominatorTree; + template friend class DominatorTreeBase; + NodeT *TheBB; DomTreeNodeBase *IDom; std::vector *> Children; - mutable int DFSNumIn, DFSNumOut; - - template friend class DominatorTreeBase; - friend struct PostDominatorTree; + mutable int DFSNumIn = -1; + mutable int DFSNumOut = -1; public: + DomTreeNodeBase(NodeT *BB, DomTreeNodeBase *iDom) + : TheBB(BB), IDom(iDom) {} + typedef typename std::vector *>::iterator iterator; typedef typename std::vector *>::const_iterator const_iterator; @@ -109,13 +119,11 @@ public: NodeT *getBlock() const { return TheBB; } DomTreeNodeBase *getIDom() const { return IDom; } + const std::vector *> &getChildren() const { return Children; } - DomTreeNodeBase(NodeT *BB, DomTreeNodeBase *iDom) - : TheBB(BB), IDom(iDom), DFSNumIn(-1), DFSNumOut(-1) {} - std::unique_ptr> addChild(std::unique_ptr> C) { Children.push_back(C.get()); @@ -206,9 +214,6 @@ void Calculate(DominatorTreeBaseByGraphTraits> &DT, FuncT &F); /// This class is a generic template over graph nodes. It is instantiated for /// various graphs in the LLVM IR or in the code generator. template class DominatorTreeBase : public DominatorBase { - DominatorTreeBase(const DominatorTreeBase &) = delete; - DominatorTreeBase &operator=(const DominatorTreeBase &) = delete; - bool dominatedBySlowTreeWalk(const DomTreeNodeBase *A, const DomTreeNodeBase *B) const { assert(A != B); @@ -239,16 +244,16 @@ protected: DomTreeNodeMapType DomTreeNodes; DomTreeNodeBase *RootNode; - mutable bool DFSInfoValid; - mutable unsigned int SlowQueries; + mutable bool DFSInfoValid = false; + mutable unsigned int SlowQueries = 0; // Information record used during immediate dominators computation. struct InfoRec { - unsigned DFSNum; - unsigned Parent; - unsigned Semi; - NodeT *Label; + unsigned DFSNum = 0; + unsigned Parent = 0; + unsigned Semi = 0; + NodeT *Label = nullptr; - InfoRec() : DFSNum(0), Parent(0), Semi(0), Label(nullptr) {} + InfoRec() = default; }; DenseMap IDoms; @@ -336,7 +341,7 @@ protected: public: explicit DominatorTreeBase(bool isPostDom) - : DominatorBase(isPostDom), DFSInfoValid(false), SlowQueries(0) {} + : DominatorBase(isPostDom) {} DominatorTreeBase(DominatorTreeBase &&Arg) : DominatorBase( @@ -348,6 +353,7 @@ public: Vertex(std::move(Arg.Vertex)), Info(std::move(Arg.Info)) { Arg.wipe(); } + DominatorTreeBase &operator=(DominatorTreeBase &&RHS) { DominatorBase::operator=( std::move(static_cast &>(RHS))); @@ -362,6 +368,9 @@ public: return *this; } + DominatorTreeBase(const DominatorTreeBase &) = delete; + DominatorTreeBase &operator=(const DominatorTreeBase &) = delete; + /// compare - Return false if the other dominator tree base matches this /// dominator tree base. Otherwise return true. bool compare(const DominatorTreeBase &Other) const { @@ -720,7 +729,6 @@ public: /// updateDFSNumbers - Assign In and Out numbers to the nodes while walking /// dominator tree in dfs order. void updateDFSNumbers() const { - if (DFSInfoValid) { SlowQueries = 0; return; @@ -807,6 +815,6 @@ bool DominatorTreeBase::properlyDominates(const NodeT *A, getNode(const_cast(B))); } -} +} // end namespace llvm -#endif +#endif // LLVM_SUPPORT_GENERICDOMTREE_H diff --git a/include/llvm/Support/TargetRegistry.h b/include/llvm/Support/TargetRegistry.h index 318a0b10e06..bd68d241448 100644 --- a/include/llvm/Support/TargetRegistry.h +++ b/include/llvm/Support/TargetRegistry.h @@ -1,4 +1,4 @@ -//===-- Support/TargetRegistry.h - Target Registration ----------*- C++ -*-===// +//===- Support/TargetRegistry.h - Target Registration -----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -20,15 +20,22 @@ #define LLVM_SUPPORT_TARGETREGISTRY_H #include "llvm-c/Disassembler.h" +#include "llvm/ADT/iterator_range.h" #include "llvm/ADT/Optional.h" +#include "llvm/ADT/StringRef.h" #include "llvm/ADT/Triple.h" #include "llvm/Support/CodeGen.h" +#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormattedStream.h" +#include #include +#include +#include #include #include namespace llvm { + class AsmPrinter; class MCAsmBackend; class MCAsmInfo; @@ -36,22 +43,20 @@ class MCAsmParser; class MCCodeEmitter; class MCContext; class MCDisassembler; -class MCInstrAnalysis; class MCInstPrinter; +class MCInstrAnalysis; class MCInstrInfo; class MCRegisterInfo; +class MCRelocationInfo; class MCStreamer; class MCSubtargetInfo; class MCSymbolizer; -class MCRelocationInfo; class MCTargetAsmParser; class MCTargetOptions; class MCTargetStreamer; +class raw_pwrite_stream; class TargetMachine; class TargetOptions; -class raw_ostream; -class raw_pwrite_stream; -class formatted_raw_ostream; MCStreamer *createNullStreamer(MCContext &Ctx); MCStreamer *createAsmStreamer(MCContext &Ctx, @@ -232,38 +237,33 @@ private: MCCodeEmitterCtorTy MCCodeEmitterCtorFn; // Construction functions for the various object formats, if registered. - COFFStreamerCtorTy COFFStreamerCtorFn; - MachOStreamerCtorTy MachOStreamerCtorFn; - ELFStreamerCtorTy ELFStreamerCtorFn; - WasmStreamerCtorTy WasmStreamerCtorFn; + COFFStreamerCtorTy COFFStreamerCtorFn = nullptr; + MachOStreamerCtorTy MachOStreamerCtorFn = nullptr; + ELFStreamerCtorTy ELFStreamerCtorFn = nullptr; + WasmStreamerCtorTy WasmStreamerCtorFn = nullptr; /// Construction function for this target's null TargetStreamer, if /// registered (default = nullptr). - NullTargetStreamerCtorTy NullTargetStreamerCtorFn; + NullTargetStreamerCtorTy NullTargetStreamerCtorFn = nullptr; /// Construction function for this target's asm TargetStreamer, if /// registered (default = nullptr). - AsmTargetStreamerCtorTy AsmTargetStreamerCtorFn; + AsmTargetStreamerCtorTy AsmTargetStreamerCtorFn = nullptr; /// Construction function for this target's obj TargetStreamer, if /// registered (default = nullptr). - ObjectTargetStreamerCtorTy ObjectTargetStreamerCtorFn; + ObjectTargetStreamerCtorTy ObjectTargetStreamerCtorFn = nullptr; /// MCRelocationInfoCtorFn - Construction function for this target's /// MCRelocationInfo, if registered (default = llvm::createMCRelocationInfo) - MCRelocationInfoCtorTy MCRelocationInfoCtorFn; + MCRelocationInfoCtorTy MCRelocationInfoCtorFn = nullptr; /// MCSymbolizerCtorFn - Construction function for this target's /// MCSymbolizer, if registered (default = llvm::createMCSymbolizer) - MCSymbolizerCtorTy MCSymbolizerCtorFn; + MCSymbolizerCtorTy MCSymbolizerCtorFn = nullptr; public: - Target() - : COFFStreamerCtorFn(nullptr), MachOStreamerCtorFn(nullptr), - ELFStreamerCtorFn(nullptr), WasmStreamerCtorFn(nullptr), - NullTargetStreamerCtorFn(nullptr), - AsmTargetStreamerCtorFn(nullptr), ObjectTargetStreamerCtorFn(nullptr), - MCRelocationInfoCtorFn(nullptr), MCSymbolizerCtorFn(nullptr) {} + Target() = default; /// @name Target Information /// @{ @@ -564,12 +564,14 @@ struct TargetRegistry { class iterator : public std::iterator { - const Target *Current; - explicit iterator(Target *T) : Current(T) {} friend struct TargetRegistry; + const Target *Current = nullptr; + + explicit iterator(Target *T) : Current(T) {} + public: - iterator() : Current(nullptr) {} + iterator() = default; bool operator==(const iterator &x) const { return Current == x.Current; } bool operator!=(const iterator &x) const { return !operator==(x); } @@ -1167,6 +1169,7 @@ private: return new MCCodeEmitterImpl(); } }; -} -#endif +} // end namespace llvm + +#endif // LLVM_SUPPORT_TARGETREGISTRY_H