Index: include/llvm/ADT/CachedHashString.h =================================================================== --- include/llvm/ADT/CachedHashString.h +++ include/llvm/ADT/CachedHashString.h @@ -73,8 +73,8 @@ friend struct DenseMapInfo; char *P; - uint32_t Size; - uint32_t Hash; + uint32_t Size = 0; + uint32_t Hash = 0; static char *getEmptyKeyPtr() { return DenseMapInfo::getEmptyKey(); } static char *getTombstoneKeyPtr() { @@ -88,7 +88,7 @@ struct ConstructEmptyOrTombstoneTy {}; CachedHashString(ConstructEmptyOrTombstoneTy, char *EmptyOrTombstonePtr) - : P(EmptyOrTombstonePtr), Size(0), Hash(0) { + : P(EmptyOrTombstonePtr) { assert(isEmptyOrTombstone()); } Index: include/llvm/ADT/EpochTracker.h =================================================================== --- include/llvm/ADT/EpochTracker.h +++ include/llvm/ADT/EpochTracker.h @@ -57,11 +57,11 @@ /// make an iterator-invalidating modification. /// class HandleBase { - const uint64_t *EpochAddress; - uint64_t EpochAtCreation; + const uint64_t *EpochAddress = nullptr; + uint64_t EpochAtCreation = UINT64_MAX; public: - HandleBase() : EpochAddress(nullptr), EpochAtCreation(UINT64_MAX) {} + HandleBase() = default; explicit HandleBase(const DebugEpochBase *Parent) : EpochAddress(&Parent->Epoch), EpochAtCreation(Parent->Epoch) {} Index: include/llvm/ADT/IntervalMap.h =================================================================== --- include/llvm/ADT/IntervalMap.h +++ include/llvm/ADT/IntervalMap.h @@ -969,10 +969,10 @@ // 0: Leaves in root. // 1: Root points to leaf. // 2: root->branch->leaf ... - unsigned height; + unsigned height = 0; // Number of entries in the root node. - unsigned rootSize; + unsigned rootSize = 0; // Allocator used for creating external nodes. Allocator &allocator; @@ -1043,7 +1043,7 @@ void deleteNode(IntervalMapImpl::NodeRef Node, unsigned Level); public: - explicit IntervalMap(Allocator &a) : height(0), rootSize(0), allocator(a) { + explicit IntervalMap(Allocator &a) : allocator(a) { assert((uintptr_t(data.buffer) & (alignof(RootLeaf) - 1)) == 0 && "Insufficient alignment"); new(&rootLeaf()) RootLeaf(); Index: include/llvm/ADT/SmallPtrSet.h =================================================================== --- include/llvm/ADT/SmallPtrSet.h +++ include/llvm/ADT/SmallPtrSet.h @@ -62,9 +62,9 @@ /// Number of elements in CurArray that contain a value or are a tombstone. /// If small, all these elements are at the beginning of CurArray and the rest /// is uninitialized. - unsigned NumNonEmpty; + unsigned NumNonEmpty = 0; /// Number of tombstones in CurArray. - unsigned NumTombstones; + unsigned NumTombstones = 0; // Helpers to copy and move construct a SmallPtrSet. SmallPtrSetImplBase(const void **SmallStorage, @@ -74,7 +74,7 @@ explicit SmallPtrSetImplBase(const void **SmallStorage, unsigned SmallSize) : SmallArray(SmallStorage), CurArray(SmallStorage), - CurArraySize(SmallSize), NumNonEmpty(0), NumTombstones(0) { + CurArraySize(SmallSize) { assert(SmallSize && (SmallSize & (SmallSize-1)) == 0 && "Initial size must be a power of two!"); } Index: include/llvm/ADT/StringSwitch.h =================================================================== --- include/llvm/ADT/StringSwitch.h +++ include/llvm/ADT/StringSwitch.h @@ -46,12 +46,11 @@ /// \brief The pointer to the result of this switch statement, once known, /// null before that. - const T *Result; + const T *Result = nullptr; public: LLVM_ATTRIBUTE_ALWAYS_INLINE - explicit StringSwitch(StringRef S) - : Str(S), Result(nullptr) { } + explicit StringSwitch(StringRef S) : Str(S) {} // StringSwitch is not copyable. StringSwitch(const StringSwitch &) = delete; Index: include/llvm/Analysis/DependenceAnalysis.h =================================================================== --- include/llvm/Analysis/DependenceAnalysis.h +++ include/llvm/Analysis/DependenceAnalysis.h @@ -74,12 +74,8 @@ Dependence &operator=(Dependence &&) = default; public: - Dependence(Instruction *Source, - Instruction *Destination) : - Src(Source), - Dst(Destination), - NextPredecessor(nullptr), - NextSuccessor(nullptr) {} + Dependence(Instruction *Source, Instruction *Destination) + : Src(Source), Dst(Destination) {} virtual ~Dependence() {} /// Dependence::DVEntry - Each level in the distance/direction vector @@ -99,9 +95,9 @@ bool PeelFirst : 1; // Peeling the first iteration will break dependence. bool PeelLast : 1; // Peeling the last iteration will break the dependence. bool Splitable : 1; // Splitting the loop will break dependence. - const SCEV *Distance; // NULL implies no distance available. + const SCEV *Distance = nullptr; // NULL implies no distance available. DVEntry() : Direction(ALL), Scalar(true), PeelFirst(false), - PeelLast(false), Splitable(false), Distance(nullptr) { } + PeelLast(false), Splitable(false) { } }; /// getSrc - Returns the source instruction for this dependence. @@ -200,7 +196,7 @@ private: Instruction *Src, *Dst; - const Dependence *NextPredecessor, *NextSuccessor; + const Dependence *NextPredecessor = nullptr, *NextSuccessor = nullptr; friend class DependenceInfo; }; Index: include/llvm/Analysis/LazyBlockFrequencyInfo.h =================================================================== --- include/llvm/Analysis/LazyBlockFrequencyInfo.h +++ include/llvm/Analysis/LazyBlockFrequencyInfo.h @@ -35,8 +35,7 @@ typename LoopInfoT, typename BlockFrequencyInfoT> class LazyBlockFrequencyInfo { public: - LazyBlockFrequencyInfo() - : Calculated(false), F(nullptr), BPIPass(nullptr), LI(nullptr) {} + LazyBlockFrequencyInfo() = default; /// Set up the per-function input. void setAnalysis(const FunctionT *F, BranchProbabilityInfoPassT *BPIPass, @@ -69,10 +68,10 @@ private: BlockFrequencyInfoT BFI; - bool Calculated; - const FunctionT *F; - BranchProbabilityInfoPassT *BPIPass; - const LoopInfoT *LI; + bool Calculated = false; + const FunctionT *F = nullptr; + BranchProbabilityInfoPassT *BPIPass = nullptr; + const LoopInfoT *LI = nullptr; }; /// \brief This is an alternative analysis pass to Index: include/llvm/Analysis/LoopAccessAnalysis.h =================================================================== --- include/llvm/Analysis/LoopAccessAnalysis.h +++ include/llvm/Analysis/LoopAccessAnalysis.h @@ -163,9 +163,7 @@ }; MemoryDepChecker(PredicatedScalarEvolution &PSE, const Loop *L) - : PSE(PSE), InnermostLoop(L), AccessIdx(0), MaxSafeRegisterWidth(-1U), - ShouldRetryWithRuntimeCheck(false), SafeForVectorization(true), - RecordDependences(true) {} + : PSE(PSE), InnermostLoop(L) {} /// \brief Register the location (instructions are given increasing numbers) /// of a write access. @@ -254,7 +252,7 @@ SmallVector InstMap; /// \brief The program order index to be used for the next instruction. - unsigned AccessIdx; + unsigned AccessIdx = 0; // We can access this many bytes in parallel safely. uint64_t MaxSafeDepDistBytes; @@ -263,20 +261,20 @@ /// operate on simultaneously, multiplied by the size of the element in bits. /// The size of the element is taken from the memory access that is most /// restrictive. - uint64_t MaxSafeRegisterWidth; + uint64_t MaxSafeRegisterWidth = -1UL; /// \brief If we see a non-constant dependence distance we can still try to /// vectorize this loop with runtime checks. - bool ShouldRetryWithRuntimeCheck; + bool ShouldRetryWithRuntimeCheck = false; /// \brief No memory dependence was encountered that would inhibit /// vectorization. - bool SafeForVectorization; + bool SafeForVectorization = true; //// \brief True if Dependences reflects the dependences in the //// loop. If false we exceeded MaxDependences and //// Dependences is invalid. - bool RecordDependences; + bool RecordDependences = true; /// \brief Memory dependences collected during the analysis. Only valid if /// RecordDependences is true. Index: include/llvm/Analysis/LoopInfo.h =================================================================== --- include/llvm/Analysis/LoopInfo.h +++ include/llvm/Analysis/LoopInfo.h @@ -67,7 +67,7 @@ /// flow graph. /// template class LoopBase { - LoopT *ParentLoop; + LoopT *ParentLoop = nullptr; // Loops contained entirely within this one. std::vector SubLoops; @@ -395,9 +395,9 @@ friend class LoopInfoBase; /// This creates an empty loop. - LoopBase() : ParentLoop(nullptr) {} + LoopBase() {} - explicit LoopBase(BlockT *BB) : ParentLoop(nullptr) { + explicit LoopBase(BlockT *BB) { Blocks.push_back(BB); DenseBlockSet.insert(BB); } Index: include/llvm/Analysis/MemorySSA.h =================================================================== --- include/llvm/Analysis/MemorySSA.h +++ include/llvm/Analysis/MemorySSA.h @@ -1156,7 +1156,7 @@ struct def_chain_iterator : public iterator_facade_base, std::forward_iterator_tag, MemoryAccess *> { - def_chain_iterator() : MA(nullptr) {} + def_chain_iterator() = default; def_chain_iterator(T MA) : MA(MA) {} T operator*() const { return MA; } @@ -1178,7 +1178,7 @@ bool operator==(const def_chain_iterator &O) const { return MA == O.MA; } private: - T MA; + T MA = nullptr; }; template Index: include/llvm/Analysis/PHITransAddr.h =================================================================== --- include/llvm/Analysis/PHITransAddr.h +++ include/llvm/Analysis/PHITransAddr.h @@ -41,7 +41,7 @@ const DataLayout &DL; /// TLI - The target library info if known, otherwise null. - const TargetLibraryInfo *TLI; + const TargetLibraryInfo *TLI = nullptr; /// A cache of @llvm.assume calls used by SimplifyInstruction. AssumptionCache *AC; @@ -51,7 +51,7 @@ public: PHITransAddr(Value *addr, const DataLayout &DL, AssumptionCache *AC) - : Addr(addr), DL(DL), TLI(nullptr), AC(AC) { + : Addr(addr), DL(DL), AC(AC) { // If the address is an instruction, the whole thing is considered an input. if (Instruction *I = dyn_cast(Addr)) InstInputs.push_back(I); Index: include/llvm/Analysis/ScalarEvolutionExpander.h =================================================================== --- include/llvm/Analysis/ScalarEvolutionExpander.h +++ include/llvm/Analysis/ScalarEvolutionExpander.h @@ -69,11 +69,11 @@ /// When this is non-null, addrecs expanded in the loop it indicates should /// be inserted with increments at IVIncInsertPos. - const Loop *IVIncInsertLoop; + const Loop *IVIncInsertLoop = nullptr; /// When expanding addrecs in the IVIncInsertLoop loop, insert the IV /// increment at this position. - Instruction *IVIncInsertPos; + Instruction *IVIncInsertPos = nullptr; /// Phis that complete an IV chain. Reuse DenseSet> ChainedPhis; @@ -81,12 +81,12 @@ /// When true, expressions are expanded in "canonical" form. In particular, /// addrecs are expanded as arithmetic based on a canonical induction /// variable. When false, expression are expanded in a more literal form. - bool CanonicalMode; + bool CanonicalMode = true; /// When invoked from LSR, the expander is in "strength reduction" mode. The /// only difference is that phi's are only reused if they are already in /// "expanded" form. - bool LSRMode; + bool LSRMode = false; typedef IRBuilder BuilderType; BuilderType Builder; @@ -141,8 +141,7 @@ /// Construct a SCEVExpander in "canonical" mode. explicit SCEVExpander(ScalarEvolution &se, const DataLayout &DL, const char *name) - : SE(se), DL(DL), IVName(name), IVIncInsertLoop(nullptr), - IVIncInsertPos(nullptr), CanonicalMode(true), LSRMode(false), + : SE(se), DL(DL), IVName(name), Builder(se.getContext(), TargetFolder(DL)) { #ifndef NDEBUG DebugType = ""; Index: include/llvm/Analysis/ValueLattice.h =================================================================== --- include/llvm/Analysis/ValueLattice.h +++ include/llvm/Analysis/ValueLattice.h @@ -52,11 +52,11 @@ /// Val: This stores the current lattice value along with the Constant* for /// the constant if this is a 'constant' or 'notconstant' value. ValueLatticeElementTy Tag; - Constant *Val; + Constant *Val = nullptr; ConstantRange Range; public: - ValueLatticeElement() : Tag(undefined), Val(nullptr), Range(1, true) {} + ValueLatticeElement() : Tag(undefined), Range(1, true) {} static ValueLatticeElement get(Constant *C) { ValueLatticeElement Res; Index: include/llvm/CodeGen/MachineOperand.h =================================================================== --- include/llvm/CodeGen/MachineOperand.h +++ include/llvm/CodeGen/MachineOperand.h @@ -162,7 +162,7 @@ /// ParentMI - This is the instruction that this operand is embedded into. /// This is valid for all operand types, when the operand is in an instr. - MachineInstr *ParentMI; + MachineInstr *ParentMI = nullptr; /// Contents union - This contains the payload for the various operand types. union { @@ -198,7 +198,7 @@ } Contents; explicit MachineOperand(MachineOperandType K) - : OpKind(K), SubReg_TargetFlags(0), ParentMI(nullptr) {} + : OpKind(K), SubReg_TargetFlags(0) {} public: /// getType - Returns the MachineOperandType for this operand. /// Index: include/llvm/IR/BasicBlock.h =================================================================== --- include/llvm/IR/BasicBlock.h +++ include/llvm/IR/BasicBlock.h @@ -66,7 +66,7 @@ friend class SymbolTableListTraits; InstListType InstList; - Function *Parent; + Function *Parent = nullptr; void setParent(Function *parent); Index: include/llvm/IR/Constants.h =================================================================== --- include/llvm/IR/Constants.h +++ include/llvm/IR/Constants.h @@ -574,13 +574,13 @@ /// the same value but different type. For example, 0,0,0,1 could be a 4 /// element array of i8, or a 1-element array of i32. They'll both end up in /// the same StringMap bucket, linked up. - ConstantDataSequential *Next; + ConstantDataSequential *Next = nullptr; void destroyConstantImpl(); protected: explicit ConstantDataSequential(Type *ty, ValueTy VT, const char *Data) - : ConstantData(ty, VT), DataElements(Data), Next(nullptr) {} + : ConstantData(ty, VT), DataElements(Data) {} ~ConstantDataSequential() { delete Next; } static Constant *getImpl(StringRef Bytes, Type *Ty); Index: include/llvm/IR/GlobalObject.h =================================================================== --- include/llvm/IR/GlobalObject.h +++ include/llvm/IR/GlobalObject.h @@ -32,12 +32,11 @@ GlobalObject(Type *Ty, ValueTy VTy, Use *Ops, unsigned NumOps, LinkageTypes Linkage, const Twine &Name, unsigned AddressSpace = 0) - : GlobalValue(Ty, VTy, Ops, NumOps, Linkage, Name, AddressSpace), - ObjComdat(nullptr) { + : GlobalValue(Ty, VTy, Ops, NumOps, Linkage, Name, AddressSpace) { setGlobalValueSubClassData(0); } - Comdat *ObjComdat; + Comdat *ObjComdat = nullptr; enum { LastAlignmentBit = 4, HasMetadataHashEntryBit, Index: include/llvm/IR/GlobalValue.h =================================================================== --- include/llvm/IR/GlobalValue.h +++ include/llvm/IR/GlobalValue.h @@ -80,8 +80,8 @@ ValueType(Ty), Visibility(DefaultVisibility), UnnamedAddrVal(unsigned(UnnamedAddr::None)), DllStorageClass(DefaultStorageClass), ThreadLocal(NotThreadLocal), - HasLLVMReservedName(false), IsDSOLocal(false), IntID((Intrinsic::ID)0U), - Parent(nullptr) { + HasLLVMReservedName(false), IsDSOLocal(false), + IntID((Intrinsic::ID)0U) { setLinkage(Linkage); setName(Name); } @@ -160,7 +160,7 @@ SubClassData = V; } - Module *Parent; // The containing module. + Module *Parent = nullptr; // The containing module. // Used by SymbolTableListTraits. void setParent(Module *parent) { Index: include/llvm/IR/LegacyPassManagers.h =================================================================== --- include/llvm/IR/LegacyPassManagers.h +++ include/llvm/IR/LegacyPassManagers.h @@ -115,17 +115,17 @@ /// PassManagerPrettyStackEntry - This is used to print informative information /// about what pass is running when/if a stack trace is generated. class PassManagerPrettyStackEntry : public PrettyStackTraceEntry { - Pass *P; - Value *V; - Module *M; + Pass *P = nullptr; + Value *V = nullptr; + Module *M = nullptr; public: explicit PassManagerPrettyStackEntry(Pass *p) - : P(p), V(nullptr), M(nullptr) {} // When P is releaseMemory'd. + : P(p) {} // When P is releaseMemory'd. PassManagerPrettyStackEntry(Pass *p, Value &v) - : P(p), V(&v), M(nullptr) {} // When P is run on V + : P(p), V(&v) {} // When P is run on V PassManagerPrettyStackEntry(Pass *p, Module &m) - : P(p), V(nullptr), M(&m) {} // When P is run on M + : P(p), M(&m) {} // When P is run on M /// print - Emit information about this stack frame to OS. void print(raw_ostream &OS) const override; @@ -302,7 +302,7 @@ /// used by pass managers. class PMDataManager { public: - explicit PMDataManager() : TPM(nullptr), Depth(0) { + explicit PMDataManager() { initializeAnalysisInfo(); } @@ -405,7 +405,7 @@ protected: // Top level manager. - PMTopLevelManager *TPM; + PMTopLevelManager *TPM = nullptr; // Collection of pass that are managed by this manager SmallVector PassVector; @@ -433,7 +433,7 @@ // this manager. SmallVector HigherLevelAnalysis; - unsigned Depth; + unsigned Depth = 0; }; //===----------------------------------------------------------------------===// Index: include/llvm/IR/ValueHandle.h =================================================================== --- include/llvm/IR/ValueHandle.h +++ include/llvm/IR/ValueHandle.h @@ -246,7 +246,7 @@ Value *getRawValPtr() const { return ValueHandleBase::getValPtr(); } void setRawValPtr(Value *P) { ValueHandleBase::operator=(P); } #else - Value *ThePtr; + Value *ThePtr = nullptr; Value *getRawValPtr() const { return ThePtr; } void setRawValPtr(Value *P) { ThePtr = P; } #endif @@ -263,7 +263,7 @@ AssertingVH(ValueTy *P) : ValueHandleBase(Assert, GetAsValue(P)) {} AssertingVH(const AssertingVH &RHS) : ValueHandleBase(Assert, RHS) {} #else - AssertingVH() : ThePtr(nullptr) {} + AssertingVH() = default; AssertingVH(ValueTy *P) : ThePtr(GetAsValue(P)) {} #endif Index: include/llvm/IR/ValueMap.h =================================================================== --- include/llvm/IR/ValueMap.h +++ include/llvm/IR/ValueMap.h @@ -247,14 +247,14 @@ using ValueMapT = ValueMap; using KeySansPointerT = typename std::remove_pointer::type; - ValueMapT *Map; + ValueMapT *Map = nullptr; ValueMapCallbackVH(KeyT Key, ValueMapT *Map) : CallbackVH(const_cast(static_cast(Key))), Map(Map) {} // Private constructor used to create empty/tombstone DenseMap keys. - ValueMapCallbackVH(Value *V) : CallbackVH(V), Map(nullptr) {} + ValueMapCallbackVH(Value *V) : CallbackVH(V) {} public: KeyT Unwrap() const { return cast_or_null(getValPtr()); } Index: include/llvm/MC/MCCodePadder.h =================================================================== --- include/llvm/MC/MCCodePadder.h +++ include/llvm/MC/MCCodePadder.h @@ -42,14 +42,14 @@ void operator=(const MCCodePadder &) = delete; /// Determines if the MCCodePaddingPolicies are active. - bool ArePoliciesActive; + bool ArePoliciesActive = false; /// All the supported MCCodePaddingPolicies. SmallPtrSet CodePaddingPolicies; /// A pointer to the fragment of the instruction whose padding is currently /// done for. - MCPaddingFragment *CurrHandledInstFragment; + MCPaddingFragment *CurrHandledInstFragment = nullptr; /// A map holding the jurisdiction for each padding fragment. Key: padding /// fragment. Value: The fragment's jurisdiction. A jurisdiction is a vector @@ -65,7 +65,7 @@ protected: /// The current streamer, used to stream code padding. - MCObjectStreamer *OS; + MCObjectStreamer *OS = nullptr; bool addPolicy(MCCodePaddingPolicy *Policy); @@ -83,9 +83,7 @@ } public: - MCCodePadder() - : ArePoliciesActive(false), CurrHandledInstFragment(nullptr), - OS(nullptr) {} + MCCodePadder() = default; virtual ~MCCodePadder(); /// Handles all target related code padding when starting to write a new Index: include/llvm/Object/COFF.h =================================================================== --- include/llvm/Object/COFF.h +++ include/llvm/Object/COFF.h @@ -1139,10 +1139,10 @@ ImportedSymbolRef() = default; ImportedSymbolRef(const import_lookup_table_entry32 *Entry, uint32_t I, const COFFObjectFile *Owner) - : Entry32(Entry), Entry64(nullptr), Index(I), OwningObject(Owner) {} + : Entry32(Entry), Index(I), OwningObject(Owner) {} ImportedSymbolRef(const import_lookup_table_entry64 *Entry, uint32_t I, const COFFObjectFile *Owner) - : Entry32(nullptr), Entry64(Entry), Index(I), OwningObject(Owner) {} + : Entry64(Entry), Index(I), OwningObject(Owner) {} bool operator==(const ImportedSymbolRef &Other) const; void moveNext(); @@ -1153,8 +1153,8 @@ std::error_code getHintNameRVA(uint32_t &Result) const; private: - const import_lookup_table_entry32 *Entry32; - const import_lookup_table_entry64 *Entry64; + const import_lookup_table_entry32 *Entry32 = nullptr; + const import_lookup_table_entry64 *Entry64 = nullptr; uint32_t Index; const COFFObjectFile *OwningObject = nullptr; }; Index: include/llvm/ProfileData/Coverage/CoverageMapping.h =================================================================== --- include/llvm/ProfileData/Coverage/CoverageMapping.h +++ include/llvm/ProfileData/Coverage/CoverageMapping.h @@ -383,17 +383,17 @@ /// The column where this segment begins. unsigned Col; /// The execution count, or zero if no count was recorded. - uint64_t Count; + uint64_t Count = 0; /// When false, the segment was uninstrumented or skipped. - bool HasCount; + bool HasCount = false; /// Whether this enters a new region or returns to a previous count. bool IsRegionEntry; /// Whether this enters a gap region. bool IsGapRegion; CoverageSegment(unsigned Line, unsigned Col, bool IsRegionEntry) - : Line(Line), Col(Col), Count(0), HasCount(false), - IsRegionEntry(IsRegionEntry), IsGapRegion(false) {} + : Line(Line), Col(Col), IsRegionEntry(IsRegionEntry), IsGapRegion(false) { + } CoverageSegment(unsigned Line, unsigned Col, uint64_t Count, bool IsRegionEntry, bool IsGapRegion = false) @@ -635,8 +635,7 @@ : LineCoverageIterator(CD, CD.begin()->Line) {} LineCoverageIterator(const CoverageData &CD, unsigned Line) - : CD(CD), WrappedSegment(nullptr), Next(CD.begin()), Ended(false), - Line(Line), Segments(), Stats() { + : CD(CD), Next(CD.begin()), Line(Line), Segments(), Stats() { this->operator++(); } @@ -661,9 +660,9 @@ private: const CoverageData &CD; - const CoverageSegment *WrappedSegment; + const CoverageSegment *WrappedSegment = nullptr; std::vector::const_iterator Next; - bool Ended; + bool Ended = false; unsigned Line; SmallVector Segments; LineCoverageStats Stats; Index: include/llvm/ProfileData/Coverage/CoverageMappingReader.h =================================================================== --- include/llvm/ProfileData/Coverage/CoverageMappingReader.h +++ include/llvm/ProfileData/Coverage/CoverageMappingReader.h @@ -44,18 +44,16 @@ /// \brief A file format agnostic iterator over coverage mapping data. class CoverageMappingIterator : public std::iterator { - CoverageMappingReader *Reader; + CoverageMappingReader *Reader = nullptr; CoverageMappingRecord Record; - coveragemap_error ReadErr; + coveragemap_error ReadErr = coveragemap_error::success; void increment(); public: - CoverageMappingIterator() - : Reader(nullptr), Record(), ReadErr(coveragemap_error::success) {} + CoverageMappingIterator() = default; - CoverageMappingIterator(CoverageMappingReader *Reader) - : Reader(Reader), Record(), ReadErr(coveragemap_error::success) { + CoverageMappingIterator(CoverageMappingReader *Reader) : Reader(Reader) { increment(); } Index: include/llvm/Support/ARMAttributeParser.h =================================================================== --- include/llvm/Support/ARMAttributeParser.h +++ include/llvm/Support/ARMAttributeParser.h @@ -19,7 +19,7 @@ class StringRef; class ARMAttributeParser { - ScopedPrinter *SW; + ScopedPrinter *SW = nullptr; std::map Attributes; @@ -121,7 +121,7 @@ public: ARMAttributeParser(ScopedPrinter *SW) : SW(SW) {} - ARMAttributeParser() : SW(nullptr) { } + ARMAttributeParser() = default; void Parse(ArrayRef Section, bool isLittle); Index: include/llvm/Support/CommandLine.h =================================================================== --- include/llvm/Support/CommandLine.h +++ include/llvm/Support/CommandLine.h @@ -1684,7 +1684,7 @@ // class alias : public Option { - Option *AliasFor; + Option *AliasFor = nullptr; bool handleOccurrence(unsigned pos, StringRef /*ArgName*/, StringRef Arg) override { @@ -1731,8 +1731,7 @@ } template - explicit alias(const Mods &... Ms) - : Option(Optional, Hidden), AliasFor(nullptr) { + explicit alias(const Mods &... Ms) : Option(Optional, Hidden) { apply(this, Ms...); done(); } Index: include/llvm/Support/CrashRecoveryContext.h =================================================================== --- include/llvm/Support/CrashRecoveryContext.h +++ include/llvm/Support/CrashRecoveryContext.h @@ -39,11 +39,11 @@ /// ... no crash was detected ... /// } class CrashRecoveryContext { - void *Impl; - CrashRecoveryContextCleanup *head; + void *Impl = nullptr; + CrashRecoveryContextCleanup *head = nullptr; public: - CrashRecoveryContext() : Impl(nullptr), head(nullptr) {} + CrashRecoveryContext() = default; ~CrashRecoveryContext(); void registerCleanup(CrashRecoveryContextCleanup *cleanup); Index: include/llvm/Support/FormattedStream.h =================================================================== --- include/llvm/Support/FormattedStream.h +++ include/llvm/Support/FormattedStream.h @@ -28,7 +28,7 @@ /// TheStream - The real stream we output to. We set it to be /// unbuffered, since we're already doing our own buffering. /// - raw_ostream *TheStream; + raw_ostream *TheStream = nullptr; /// Position - The current output column and line of the data that's /// been flushed and the portion of the buffer that's been @@ -39,7 +39,7 @@ /// Scanned - This points to one past the last character in the /// buffer we've scanned. /// - const char *Scanned; + const char *Scanned = nullptr; void write_impl(const char *Ptr, size_t Size) override; @@ -86,13 +86,10 @@ /// so it doesn't want another layer of buffering to be happening /// underneath it. /// - formatted_raw_ostream(raw_ostream &Stream) - : TheStream(nullptr), Position(0, 0) { + formatted_raw_ostream(raw_ostream &Stream) : Position(0, 0) { setStream(Stream); } - explicit formatted_raw_ostream() : TheStream(nullptr), Position(0, 0) { - Scanned = nullptr; - } + explicit formatted_raw_ostream() : Position(0, 0) {} ~formatted_raw_ostream() override { flush(); Index: include/llvm/Support/LineIterator.h =================================================================== --- include/llvm/Support/LineIterator.h +++ include/llvm/Support/LineIterator.h @@ -31,7 +31,7 @@ /// Note that this iterator requires the buffer to be nul terminated. class line_iterator : public std::iterator { - const MemoryBuffer *Buffer; + const MemoryBuffer *Buffer = nullptr; char CommentMarker; bool SkipBlanks; @@ -40,7 +40,7 @@ public: /// \brief Default construct an "end" iterator. - line_iterator() : Buffer(nullptr) {} + line_iterator() = default; /// \brief Construct a new iterator around some memory buffer. explicit line_iterator(const MemoryBuffer &Buffer, bool SkipBlanks = true, Index: include/llvm/Support/Memory.h =================================================================== --- include/llvm/Support/Memory.h +++ include/llvm/Support/Memory.h @@ -28,14 +28,14 @@ /// @brief Memory block abstraction. class MemoryBlock { public: - MemoryBlock() : Address(nullptr), Size(0) { } - MemoryBlock(void *addr, size_t size) : Address(addr), Size(size) { } + MemoryBlock() = default; + MemoryBlock(void *addr, size_t size) : Address(addr), Size(size) {} void *base() const { return Address; } size_t size() const { return Size; } private: - void *Address; ///< Address of first byte of memory area - size_t Size; ///< Size, in bytes of the memory area + void *Address = nullptr; ///< Address of first byte of memory area + size_t Size = 0; ///< Size, in bytes of the memory area friend class Memory; }; Index: include/llvm/Support/Mutex.h =================================================================== --- include/llvm/Support/Mutex.h +++ include/llvm/Support/Mutex.h @@ -90,11 +90,11 @@ template class SmartMutex { MutexImpl impl; - unsigned acquired; + unsigned acquired = 0; bool recursive; public: explicit SmartMutex(bool rec = true) : - impl(rec), acquired(0), recursive(rec) { } + impl(rec), recursive(rec) { } bool lock() { if (!mt_only || llvm_is_multithreaded()) { Index: include/llvm/Support/OnDiskHashTable.h =================================================================== --- include/llvm/Support/OnDiskHashTable.h +++ include/llvm/Support/OnDiskHashTable.h @@ -62,12 +62,12 @@ public: typename Info::key_type Key; typename Info::data_type Data; - Item *Next; + Item *Next = nullptr; const typename Info::hash_value_type Hash; Item(typename Info::key_type_ref Key, typename Info::data_type_ref Data, Info &InfoObj) - : Key(Key), Data(Data), Next(nullptr), Hash(InfoObj.ComputeHash(Key)) {} + : Key(Key), Data(Data), Hash(InfoObj.ComputeHash(Key)) {} }; typedef typename Info::offset_type offset_type; @@ -319,12 +319,12 @@ class iterator { internal_key_type Key; - const unsigned char *const Data; - const offset_type Len; - Info *InfoObj; + const unsigned char *const Data = nullptr; + const offset_type Len = 0; + Info *InfoObj = nullptr; public: - iterator() : Key(), Data(nullptr), Len(0), InfoObj(nullptr) {} + iterator() = default; iterator(const internal_key_type K, const unsigned char *D, offset_type L, Info *InfoObj) : Key(K), Data(D), Len(L), InfoObj(InfoObj) {} @@ -441,17 +441,16 @@ private: /// \brief Iterates over all of the keys in the table. class iterator_base { - const unsigned char *Ptr; - offset_type NumItemsInBucketLeft; - offset_type NumEntriesLeft; + const unsigned char *Ptr = nullptr; + offset_type NumItemsInBucketLeft = 0; + offset_type NumEntriesLeft = 0; public: typedef external_key_type value_type; iterator_base(const unsigned char *const Ptr, offset_type NumEntries) - : Ptr(Ptr), NumItemsInBucketLeft(0), NumEntriesLeft(NumEntries) {} - iterator_base() - : Ptr(nullptr), NumItemsInBucketLeft(0), NumEntriesLeft(0) {} + : Ptr(Ptr), NumEntriesLeft(NumEntries) {} + iterator_base() = default; friend bool operator==(const iterator_base &X, const iterator_base &Y) { return X.NumEntriesLeft == Y.NumEntriesLeft; Index: include/llvm/Support/Registry.h =================================================================== --- include/llvm/Support/Registry.h +++ include/llvm/Support/Registry.h @@ -63,11 +63,11 @@ friend class iterator; friend Registry; - node *Next; + node *Next = nullptr; const entry& Val; public: - node(const entry &V) : Next(nullptr), Val(V) {} + node(const entry &V) : Val(V) {} }; /// Add a node to the Registry: this is the interface between the plugin and Index: include/llvm/Support/Timer.h =================================================================== --- include/llvm/Support/Timer.h +++ include/llvm/Support/Timer.h @@ -24,12 +24,12 @@ class raw_ostream; class TimeRecord { - double WallTime; ///< Wall clock time elapsed in seconds. - double UserTime; ///< User time elapsed. - double SystemTime; ///< System time elapsed. - ssize_t MemUsed; ///< Memory allocated (in bytes). + double WallTime = 0; ///< Wall clock time elapsed in seconds. + double UserTime = 0; ///< User time elapsed. + double SystemTime = 0; ///< System time elapsed. + ssize_t MemUsed = 0; ///< Memory allocated (in bytes). public: - TimeRecord() : WallTime(0), UserTime(0), SystemTime(0), MemUsed(0) {} + TimeRecord() = default; /// Get the current time and memory usage. If Start is true we get the memory /// usage before the time, otherwise we get time before memory usage. This Index: include/llvm/Support/YAMLTraits.h =================================================================== --- include/llvm/Support/YAMLTraits.h +++ include/llvm/Support/YAMLTraits.h @@ -1073,7 +1073,7 @@ template struct MappingNormalization { MappingNormalization(IO &i_o, TFinal &Obj) - : io(i_o), BufPtr(nullptr), Result(Obj) { + : io(i_o), Result(Obj) { if ( io.outputting() ) { BufPtr = new (&Buffer) TNorm(io, Obj); } @@ -1096,7 +1096,7 @@ Storage Buffer; IO &io; - TNorm *BufPtr; + TNorm *BufPtr = nullptr; TFinal &Result; }; Index: include/llvm/Support/circular_raw_ostream.h =================================================================== --- include/llvm/Support/circular_raw_ostream.h +++ include/llvm/Support/circular_raw_ostream.h @@ -39,7 +39,7 @@ /// TheStream - The real stream we output to. We set it to be /// unbuffered, since we're already doing our own buffering. /// - raw_ostream *TheStream; + raw_ostream *TheStream = nullptr; /// OwnsStream - Are we responsible for managing the underlying /// stream? @@ -52,7 +52,7 @@ /// BufferArray - The actual buffer storage. /// - char *BufferArray; + char *BufferArray = nullptr; /// Cur - Pointer to the current output point in BufferArray. /// @@ -61,7 +61,7 @@ /// Filled - Indicate whether the buffer has been completely /// filled. This helps avoid garbage output. /// - bool Filled; + bool Filled = false; /// Banner - A pointer to a banner to print before dumping the /// log. @@ -107,9 +107,8 @@ /// circular_raw_ostream(raw_ostream &Stream, const char *Header, size_t BuffSize = 0, bool Owns = REFERENCE_ONLY) - : raw_ostream(/*unbuffered*/ true), TheStream(nullptr), - OwnsStream(Owns), BufferSize(BuffSize), BufferArray(nullptr), - Filled(false), Banner(Header) { + : raw_ostream(/*unbuffered*/ true), OwnsStream(Owns), + BufferSize(BuffSize), Banner(Header) { if (BufferSize != 0) BufferArray = new char[BufferSize]; Cur = BufferArray; Index: include/llvm/Transforms/IPO/WholeProgramDevirt.h =================================================================== --- include/llvm/Transforms/IPO/WholeProgramDevirt.h +++ include/llvm/Transforms/IPO/WholeProgramDevirt.h @@ -118,10 +118,10 @@ // For testing only. VirtualCallTarget(const TypeMemberInfo *TM, bool IsBigEndian) - : Fn(nullptr), TM(TM), IsBigEndian(IsBigEndian), WasDevirt(false) {} + : TM(TM), IsBigEndian(IsBigEndian) {} // The function stored in the vtable. - Function *Fn; + Function *Fn = nullptr; // A pointer to the type identifier member through which the pointer to Fn is // accessed. @@ -135,7 +135,7 @@ bool IsBigEndian; // Whether at least one call site to the target was devirtualized. - bool WasDevirt; + bool WasDevirt = false; // The minimum byte offset before the address point. This covers the bytes in // the vtable object before the address point (e.g. RTTI, access-to-top, Index: include/llvm/Transforms/Utils/EscapeEnumerator.h =================================================================== --- include/llvm/Transforms/Utils/EscapeEnumerator.h +++ include/llvm/Transforms/Utils/EscapeEnumerator.h @@ -31,15 +31,14 @@ Function::iterator StateBB, StateE; IRBuilder<> Builder; - bool Done; + bool Done = false; bool HandleExceptions; public: EscapeEnumerator(Function &F, const char *N = "cleanup", bool HandleExceptions = true) : F(F), CleanupBBName(N), StateBB(F.begin()), StateE(F.end()), - Builder(F.getContext()), Done(false), - HandleExceptions(HandleExceptions) {} + Builder(F.getContext()), HandleExceptions(HandleExceptions) {} IRBuilder<> *Next(); }; Index: lib/Analysis/CostModel.cpp =================================================================== --- lib/Analysis/CostModel.cpp +++ lib/Analysis/CostModel.cpp @@ -45,7 +45,7 @@ public: static char ID; // Class identification, replacement for typeinfo - CostModelAnalysis() : FunctionPass(ID), F(nullptr), TTI(nullptr) { + CostModelAnalysis() : FunctionPass(ID) { initializeCostModelAnalysisPass( *PassRegistry::getPassRegistry()); } @@ -64,9 +64,9 @@ void print(raw_ostream &OS, const Module*) const override; /// The function that we analyze. - Function *F; + Function *F = nullptr; /// Target information. - const TargetTransformInfo *TTI; + const TargetTransformInfo *TTI = nullptr; }; } // End of anonymous namespace Index: lib/ExecutionEngine/MCJIT/MCJIT.h =================================================================== --- lib/ExecutionEngine/MCJIT/MCJIT.h +++ lib/ExecutionEngine/MCJIT/MCJIT.h @@ -177,7 +177,7 @@ }; std::unique_ptr TM; - MCContext *Ctx; + MCContext *Ctx = nullptr; std::shared_ptr MemMgr; LinkingSymbolResolver Resolver; RuntimeDyld Dyld; @@ -192,7 +192,7 @@ // An optional ObjectCache to be notified of compiled objects and used to // perform lookup of pre-compiled code to avoid re-compilation. - ObjectCache *ObjCache; + ObjectCache *ObjCache = nullptr; Function *FindFunctionNamedInModulePtrSet(StringRef FnName, ModulePtrSet::iterator I, Index: lib/ExecutionEngine/MCJIT/MCJIT.cpp =================================================================== --- lib/ExecutionEngine/MCJIT/MCJIT.cpp +++ lib/ExecutionEngine/MCJIT/MCJIT.cpp @@ -66,9 +66,8 @@ std::shared_ptr MemMgr, std::shared_ptr Resolver) : ExecutionEngine(TM->createDataLayout(), std::move(M)), TM(std::move(TM)), - Ctx(nullptr), MemMgr(std::move(MemMgr)), - Resolver(*this, std::move(Resolver)), Dyld(*this->MemMgr, this->Resolver), - ObjCache(nullptr) { + MemMgr(std::move(MemMgr)), Resolver(*this, std::move(Resolver)), + Dyld(*this->MemMgr, this->Resolver) { // FIXME: We are managing our modules, so we do not want the base class // ExecutionEngine to manage them as well. To avoid double destruction // of the first (and only) module added in ExecutionEngine constructor Index: lib/IR/BasicBlock.cpp =================================================================== --- lib/IR/BasicBlock.cpp +++ lib/IR/BasicBlock.cpp @@ -40,7 +40,7 @@ BasicBlock::BasicBlock(LLVMContext &C, const Twine &Name, Function *NewParent, BasicBlock *InsertBefore) - : Value(Type::getLabelTy(C), Value::BasicBlockVal), Parent(nullptr) { + : Value(Type::getLabelTy(C), Value::BasicBlockVal) { if (NewParent) insertInto(NewParent, InsertBefore); Index: lib/MC/MachObjectWriter.cpp =================================================================== --- lib/MC/MachObjectWriter.cpp +++ lib/MC/MachObjectWriter.cpp @@ -350,6 +350,8 @@ // FIXME: Should this update Data as well? } + printf("writeNlist\n"); + // Set the N_TYPE bits. See . // // FIXME: Are the prebound or indirect fields possible here? Index: lib/Transforms/Scalar/RewriteStatepointsForGC.cpp =================================================================== --- lib/Transforms/Scalar/RewriteStatepointsForGC.cpp +++ lib/Transforms/Scalar/RewriteStatepointsForGC.cpp @@ -659,7 +659,7 @@ public: enum Status { Unknown, Base, Conflict }; - BDVState() : BaseValue(nullptr) {} + BDVState() = default; explicit BDVState(Status Status, Value *BaseValue = nullptr) : Status(Status), BaseValue(BaseValue) { @@ -705,7 +705,7 @@ private: Status Status = Unknown; - AssertingVH BaseValue; // Non-null only if Status == Base. + AssertingVH BaseValue = nullptr; // Non-null only if Status == Base. }; } // end anonymous namespace