From f398d7c6bfbf9ea288df9d33a6c919275bc8c042 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Wed, 5 Mar 2014 06:35:38 +0000 Subject: [PATCH] [C++11] Add 'override' keyword to IR library. llvm-svn: 202939 --- llvm/include/llvm/IR/Constant.h | 4 +- llvm/include/llvm/IR/Constants.h | 36 +++--- llvm/include/llvm/IR/DiagnosticInfo.h | 6 +- llvm/include/llvm/IR/DiagnosticPrinter.h | 34 +++--- llvm/include/llvm/IR/Dominators.h | 10 +- llvm/include/llvm/IR/Function.h | 6 +- llvm/include/llvm/IR/GlobalAlias.h | 4 +- llvm/include/llvm/IR/GlobalValue.h | 2 +- llvm/include/llvm/IR/GlobalVariable.h | 8 +- llvm/include/llvm/IR/Instructions.h | 120 ++++++++++---------- llvm/include/llvm/IR/LegacyPassManager.h | 4 +- llvm/include/llvm/IR/LegacyPassManagers.h | 20 ++-- llvm/include/llvm/IR/LegacyPassNameParser.h | 10 +- llvm/include/llvm/Pass.h | 28 ++--- llvm/lib/IR/AttributeImpl.h | 2 +- llvm/lib/IR/ConstantsContext.h | 20 ++-- llvm/lib/IR/IRPrintingPasses.cpp | 12 +- llvm/lib/IR/LLVMContextImpl.h | 6 +- llvm/lib/IR/LegacyPassManager.cpp | 63 +++++----- llvm/lib/IR/Metadata.cpp | 4 +- llvm/lib/IR/Pass.cpp | 2 +- llvm/lib/IR/Verifier.cpp | 6 +- 22 files changed, 206 insertions(+), 201 deletions(-) diff --git a/llvm/include/llvm/IR/Constant.h b/llvm/include/llvm/IR/Constant.h index 26bad1dd1f79..f03e3dd45537 100644 --- a/llvm/include/llvm/IR/Constant.h +++ b/llvm/include/llvm/IR/Constant.h @@ -41,8 +41,8 @@ namespace llvm { class Constant : public User { void operator=(const Constant &) LLVM_DELETED_FUNCTION; Constant(const Constant &) LLVM_DELETED_FUNCTION; - virtual void anchor(); - + void anchor() override; + protected: Constant(Type *ty, ValueTy vty, Use *Ops, unsigned NumOps) : User(ty, vty, Ops, NumOps) {} diff --git a/llvm/include/llvm/IR/Constants.h b/llvm/include/llvm/IR/Constants.h index 448d82931a6e..ed7a70f773ea 100644 --- a/llvm/include/llvm/IR/Constants.h +++ b/llvm/include/llvm/IR/Constants.h @@ -49,7 +49,7 @@ struct ConvertConstantType; /// represents both boolean and integral constants. /// @brief Class for constant integers. class ConstantInt : public Constant { - virtual void anchor(); + void anchor() override; void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION; ConstantInt(const ConstantInt &) LLVM_DELETED_FUNCTION; ConstantInt(IntegerType *Ty, const APInt& V); @@ -231,7 +231,7 @@ public: /// class ConstantFP : public Constant { APFloat Val; - virtual void anchor(); + void anchor() override; void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION; ConstantFP(const ConstantFP &) LLVM_DELETED_FUNCTION; friend class LLVMContextImpl; @@ -308,7 +308,7 @@ protected: public: static ConstantAggregateZero *get(Type *Ty); - virtual void destroyConstant(); + void destroyConstant() override; /// getSequentialElement - If this CAZ has array or vector type, return a zero /// with the right element type. @@ -356,8 +356,8 @@ public: return cast(Value::getType()); } - virtual void destroyConstant(); - virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U); + void destroyConstant() override; + void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) override; /// Methods for support type inquiry through isa, cast, and dyn_cast: static bool classof(const Value *V) { @@ -414,8 +414,8 @@ public: return cast(Value::getType()); } - virtual void destroyConstant(); - virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U); + void destroyConstant() override; + void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) override; /// Methods for support type inquiry through isa, cast, and dyn_cast: static bool classof(const Value *V) { @@ -461,8 +461,8 @@ public: /// elements have the same value, return that value. Otherwise return NULL. Constant *getSplatValue() const; - virtual void destroyConstant(); - virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U); + void destroyConstant() override; + void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) override; /// Methods for support type inquiry through isa, cast, and dyn_cast: static bool classof(const Value *V) { @@ -497,7 +497,7 @@ public: /// get() - Static factory methods - Return objects of the specified value static ConstantPointerNull *get(PointerType *T); - virtual void destroyConstant(); + void destroyConstant() override; /// getType - Specialize the getType() method to always return an PointerType, /// which reduces the amount of casting needed in parts of the compiler. @@ -624,7 +624,7 @@ public: /// host endianness of the data elements. StringRef getRawDataValues() const; - virtual void destroyConstant(); + void destroyConstant() override; /// Methods for support type inquiry through isa, cast, and dyn_cast: /// @@ -645,7 +645,7 @@ private: class ConstantDataArray : public ConstantDataSequential { void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION; ConstantDataArray(const ConstantDataArray &) LLVM_DELETED_FUNCTION; - virtual void anchor(); + void anchor() override; friend class ConstantDataSequential; explicit ConstantDataArray(Type *ty, const char *Data) : ConstantDataSequential(ty, ConstantDataArrayVal, Data) {} @@ -697,7 +697,7 @@ public: class ConstantDataVector : public ConstantDataSequential { void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION; ConstantDataVector(const ConstantDataVector &) LLVM_DELETED_FUNCTION; - virtual void anchor(); + void anchor() override; friend class ConstantDataSequential; explicit ConstantDataVector(Type *ty, const char *Data) : ConstantDataSequential(ty, ConstantDataVectorVal, Data) {} @@ -769,8 +769,8 @@ public: Function *getFunction() const { return (Function*)Op<0>().get(); } BasicBlock *getBasicBlock() const { return (BasicBlock*)Op<1>().get(); } - virtual void destroyConstant(); - virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U); + void destroyConstant() override; + void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) override; /// Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const Value *V) { @@ -1099,8 +1099,8 @@ public: /// would make it harder to remove ConstantExprs altogether. Instruction *getAsInstruction(); - virtual void destroyConstant(); - virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U); + void destroyConstant() override; + void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) override; /// Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const Value *V) { @@ -1164,7 +1164,7 @@ public: /// index. UndefValue *getElementValue(unsigned Idx) const; - virtual void destroyConstant(); + void destroyConstant() override; /// Methods for support type inquiry through isa, cast, and dyn_cast: static bool classof(const Value *V) { diff --git a/llvm/include/llvm/IR/DiagnosticInfo.h b/llvm/include/llvm/IR/DiagnosticInfo.h index 9b99ce6cd783..de2a9d8b1a0c 100644 --- a/llvm/include/llvm/IR/DiagnosticInfo.h +++ b/llvm/include/llvm/IR/DiagnosticInfo.h @@ -128,7 +128,7 @@ public: const Instruction *getInstruction() const { return Instr; } /// \see DiagnosticInfo::print. - virtual void print(DiagnosticPrinter &DP) const; + void print(DiagnosticPrinter &DP) const override; /// Hand rolled RTTI. static bool classof(const DiagnosticInfo *DI) { @@ -156,7 +156,7 @@ public: unsigned getStackSize() const { return StackSize; } /// \see DiagnosticInfo::print. - virtual void print(DiagnosticPrinter &DP) const; + void print(DiagnosticPrinter &DP) const override; /// Hand rolled RTTI. static bool classof(const DiagnosticInfo *DI) { @@ -185,7 +185,7 @@ public: unsigned getMetadataVersion() const { return MetadataVersion; } /// \see DiagnosticInfo::print. - virtual void print(DiagnosticPrinter &DP) const; + void print(DiagnosticPrinter &DP) const override; /// Hand rolled RTTI. static bool classof(const DiagnosticInfo *DI) { diff --git a/llvm/include/llvm/IR/DiagnosticPrinter.h b/llvm/include/llvm/IR/DiagnosticPrinter.h index 6177b7fe10a0..411c781e01c5 100644 --- a/llvm/include/llvm/IR/DiagnosticPrinter.h +++ b/llvm/include/llvm/IR/DiagnosticPrinter.h @@ -62,25 +62,25 @@ public: DiagnosticPrinterRawOStream(raw_ostream &Stream) : Stream(Stream) {}; // Simple types. - virtual DiagnosticPrinter &operator<<(char C); - virtual DiagnosticPrinter &operator<<(unsigned char C); - virtual DiagnosticPrinter &operator<<(signed char C); - virtual DiagnosticPrinter &operator<<(StringRef Str); - virtual DiagnosticPrinter &operator<<(const char *Str); - virtual DiagnosticPrinter &operator<<(const std::string &Str); - virtual DiagnosticPrinter &operator<<(unsigned long N); - virtual DiagnosticPrinter &operator<<(long N); - virtual DiagnosticPrinter &operator<<(unsigned long long N); - virtual DiagnosticPrinter &operator<<(long long N); - virtual DiagnosticPrinter &operator<<(const void *P); - virtual DiagnosticPrinter &operator<<(unsigned int N); - virtual DiagnosticPrinter &operator<<(int N); - virtual DiagnosticPrinter &operator<<(double N); - virtual DiagnosticPrinter &operator<<(const Twine &Str); + DiagnosticPrinter &operator<<(char C) override; + DiagnosticPrinter &operator<<(unsigned char C) override; + DiagnosticPrinter &operator<<(signed char C) override; + DiagnosticPrinter &operator<<(StringRef Str) override; + DiagnosticPrinter &operator<<(const char *Str) override; + DiagnosticPrinter &operator<<(const std::string &Str) override; + DiagnosticPrinter &operator<<(unsigned long N) override; + DiagnosticPrinter &operator<<(long N) override; + DiagnosticPrinter &operator<<(unsigned long long N) override; + DiagnosticPrinter &operator<<(long long N) override; + DiagnosticPrinter &operator<<(const void *P) override; + DiagnosticPrinter &operator<<(unsigned int N) override; + DiagnosticPrinter &operator<<(int N) override; + DiagnosticPrinter &operator<<(double N) override; + DiagnosticPrinter &operator<<(const Twine &Str) override; // IR related types. - virtual DiagnosticPrinter &operator<<(const Value &V); - virtual DiagnosticPrinter &operator<<(const Module &M); + DiagnosticPrinter &operator<<(const Value &V) override; + DiagnosticPrinter &operator<<(const Module &M) override; }; } // End namespace llvm diff --git a/llvm/include/llvm/IR/Dominators.h b/llvm/include/llvm/IR/Dominators.h index 550b634a24fd..987ff1944e33 100644 --- a/llvm/include/llvm/IR/Dominators.h +++ b/llvm/include/llvm/IR/Dominators.h @@ -176,17 +176,17 @@ public: DominatorTree &getDomTree() { return DT; } const DominatorTree &getDomTree() const { return DT; } - virtual bool runOnFunction(Function &F); + bool runOnFunction(Function &F) override; - virtual void verifyAnalysis() const; + void verifyAnalysis() const override; - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); } - virtual void releaseMemory() { DT.releaseMemory(); } + void releaseMemory() override { DT.releaseMemory(); } - virtual void print(raw_ostream &OS, const Module *M = 0) const; + void print(raw_ostream &OS, const Module *M = 0) const override; }; } // End llvm namespace diff --git a/llvm/include/llvm/IR/Function.h b/llvm/include/llvm/IR/Function.h index bba7ecdd2372..11208bb91740 100644 --- a/llvm/include/llvm/IR/Function.h +++ b/llvm/include/llvm/IR/Function.h @@ -335,7 +335,7 @@ public: /// copyAttributesFrom - copy all additional attributes (those not needed to /// create a Function) from the Function Src to this one. - void copyAttributesFrom(const GlobalValue *Src); + void copyAttributesFrom(const GlobalValue *Src) override; /// deleteBody - This method deletes the body of the function, and converts /// the linkage to external. @@ -348,12 +348,12 @@ public: /// removeFromParent - This method unlinks 'this' from the containing module, /// but does not delete it. /// - virtual void removeFromParent(); + void removeFromParent() override; /// eraseFromParent - This method unlinks 'this' from the containing module /// and deletes it. /// - virtual void eraseFromParent(); + void eraseFromParent() override; /// Get the underlying elements of the Function... the basic block list is diff --git a/llvm/include/llvm/IR/GlobalAlias.h b/llvm/include/llvm/IR/GlobalAlias.h index fec61a7ceaf1..81777af38696 100644 --- a/llvm/include/llvm/IR/GlobalAlias.h +++ b/llvm/include/llvm/IR/GlobalAlias.h @@ -49,12 +49,12 @@ public: /// removeFromParent - This method unlinks 'this' from the containing module, /// but does not delete it. /// - virtual void removeFromParent(); + void removeFromParent() override; /// eraseFromParent - This method unlinks 'this' from the containing module /// and deletes it. /// - virtual void eraseFromParent(); + void eraseFromParent() override; /// set/getAliasee - These methods retrive and set alias target. void setAliasee(Constant *GV); diff --git a/llvm/include/llvm/IR/GlobalValue.h b/llvm/include/llvm/IR/GlobalValue.h index 32108b153cd8..e490023db164 100644 --- a/llvm/include/llvm/IR/GlobalValue.h +++ b/llvm/include/llvm/IR/GlobalValue.h @@ -281,7 +281,7 @@ public: /// @} /// Override from Constant class. - virtual void destroyConstant(); + void destroyConstant() override; /// isDeclaration - Return true if the primary definition of this global /// value is outside of the current translation unit. diff --git a/llvm/include/llvm/IR/GlobalVariable.h b/llvm/include/llvm/IR/GlobalVariable.h index 660092df3dee..a82740f71009 100644 --- a/llvm/include/llvm/IR/GlobalVariable.h +++ b/llvm/include/llvm/IR/GlobalVariable.h @@ -174,21 +174,21 @@ public: /// copyAttributesFrom - copy all additional attributes (those not needed to /// create a GlobalVariable) from the GlobalVariable Src to this one. - void copyAttributesFrom(const GlobalValue *Src); + void copyAttributesFrom(const GlobalValue *Src) override; /// removeFromParent - This method unlinks 'this' from the containing module, /// but does not delete it. /// - virtual void removeFromParent(); + void removeFromParent() override; /// eraseFromParent - This method unlinks 'this' from the containing module /// and deletes it. /// - virtual void eraseFromParent(); + void eraseFromParent() override; /// Override Constant's implementation of this method so we can /// replace constant initializers. - virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U); + void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) override; // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const Value *V) { diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h index 24912d7d5c93..c249f878c4c4 100644 --- a/llvm/include/llvm/IR/Instructions.h +++ b/llvm/include/llvm/IR/Instructions.h @@ -57,7 +57,7 @@ enum SynchronizationScope { /// class AllocaInst : public UnaryInstruction { protected: - virtual AllocaInst *clone_impl() const; + AllocaInst *clone_impl() const override; public: explicit AllocaInst(Type *Ty, Value *ArraySize = 0, const Twine &Name = "", Instruction *InsertBefore = 0); @@ -150,7 +150,7 @@ private: class LoadInst : public UnaryInstruction { void AssertOK(); protected: - virtual LoadInst *clone_impl() const; + LoadInst *clone_impl() const override; public: LoadInst(Value *Ptr, const Twine &NameStr, Instruction *InsertBefore); LoadInst(Value *Ptr, const Twine &NameStr, BasicBlock *InsertAtEnd); @@ -270,7 +270,7 @@ class StoreInst : public Instruction { void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION; void AssertOK(); protected: - virtual StoreInst *clone_impl() const; + StoreInst *clone_impl() const override; public: // allocate space for exactly two operands void *operator new(size_t s) { @@ -397,7 +397,7 @@ class FenceInst : public Instruction { void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION; void Init(AtomicOrdering Ordering, SynchronizationScope SynchScope); protected: - virtual FenceInst *clone_impl() const; + FenceInst *clone_impl() const override; public: // allocate space for exactly zero operands void *operator new(size_t s) { @@ -465,7 +465,7 @@ class AtomicCmpXchgInst : public Instruction { void Init(Value *Ptr, Value *Cmp, Value *NewVal, AtomicOrdering Ordering, SynchronizationScope SynchScope); protected: - virtual AtomicCmpXchgInst *clone_impl() const; + AtomicCmpXchgInst *clone_impl() const override; public: // allocate space for exactly three operands void *operator new(size_t s) { @@ -570,7 +570,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(AtomicCmpXchgInst, Value) class AtomicRMWInst : public Instruction { void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION; protected: - virtual AtomicRMWInst *clone_impl() const; + AtomicRMWInst *clone_impl() const override; public: /// This enumeration lists the possible modifications atomicrmw can make. In /// the descriptions, 'p' is the pointer to the instruction's memory location, @@ -735,7 +735,7 @@ class GetElementPtrInst : public Instruction { unsigned Values, const Twine &NameStr, BasicBlock *InsertAtEnd); protected: - virtual GetElementPtrInst *clone_impl() const; + GetElementPtrInst *clone_impl() const override; public: static GetElementPtrInst *Create(Value *Ptr, ArrayRef IdxList, const Twine &NameStr = "", @@ -937,7 +937,7 @@ class ICmpInst: public CmpInst { protected: /// \brief Clone an identical ICmpInst - virtual ICmpInst *clone_impl() const; + ICmpInst *clone_impl() const override; public: /// \brief Constructor with insert-before-instruction semantics. ICmpInst( @@ -1069,7 +1069,7 @@ public: class FCmpInst: public CmpInst { protected: /// \brief Clone an identical FCmpInst - virtual FCmpInst *clone_impl() const; + FCmpInst *clone_impl() const override; public: /// \brief Constructor with insert-before-instruction semantics. FCmpInst( @@ -1192,7 +1192,7 @@ class CallInst : public Instruction { Instruction *InsertBefore); CallInst(Value *F, const Twine &NameStr, BasicBlock *InsertAtEnd); protected: - virtual CallInst *clone_impl() const; + CallInst *clone_impl() const override; public: static CallInst *Create(Value *Func, ArrayRef Args, @@ -1464,7 +1464,7 @@ class SelectInst : public Instruction { setName(NameStr); } protected: - virtual SelectInst *clone_impl() const; + SelectInst *clone_impl() const override; public: static SelectInst *Create(Value *C, Value *S1, Value *S2, const Twine &NameStr = "", @@ -1519,7 +1519,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(SelectInst, Value) /// class VAArgInst : public UnaryInstruction { protected: - virtual VAArgInst *clone_impl() const; + VAArgInst *clone_impl() const override; public: VAArgInst(Value *List, Type *Ty, const Twine &NameStr = "", @@ -1559,7 +1559,7 @@ class ExtractElementInst : public Instruction { ExtractElementInst(Value *Vec, Value *Idx, const Twine &NameStr, BasicBlock *InsertAtEnd); protected: - virtual ExtractElementInst *clone_impl() const; + ExtractElementInst *clone_impl() const override; public: static ExtractElementInst *Create(Value *Vec, Value *Idx, @@ -1620,7 +1620,7 @@ class InsertElementInst : public Instruction { InsertElementInst(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr, BasicBlock *InsertAtEnd); protected: - virtual InsertElementInst *clone_impl() const; + InsertElementInst *clone_impl() const override; public: static InsertElementInst *Create(Value *Vec, Value *NewElt, Value *Idx, @@ -1673,7 +1673,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(InsertElementInst, Value) /// class ShuffleVectorInst : public Instruction { protected: - virtual ShuffleVectorInst *clone_impl() const; + ShuffleVectorInst *clone_impl() const override; public: // allocate space for exactly three operands @@ -1774,7 +1774,7 @@ class ExtractValueInst : public UnaryInstruction { return User::operator new(s, 1); } protected: - virtual ExtractValueInst *clone_impl() const; + ExtractValueInst *clone_impl() const override; public: static ExtractValueInst *Create(Value *Agg, @@ -1885,7 +1885,7 @@ class InsertValueInst : public Instruction { InsertValueInst(Value *Agg, Value *Val, unsigned Idx, const Twine &NameStr, BasicBlock *InsertAtEnd); protected: - virtual InsertValueInst *clone_impl() const; + InsertValueInst *clone_impl() const override; public: // allocate space for exactly two operands void *operator new(size_t s) { @@ -2020,7 +2020,7 @@ protected: // values and pointers to the incoming blocks, all in one allocation. Use *allocHungoffUses(unsigned) const; - virtual PHINode *clone_impl() const; + PHINode *clone_impl() const override; public: /// Constructors - NumReservedValues is a hint for the number of incoming /// edges that this phi node will have (use 0 if you really have no idea). @@ -2211,7 +2211,7 @@ private: unsigned NumReservedValues, const Twine &NameStr, BasicBlock *InsertAtEnd); protected: - virtual LandingPadInst *clone_impl() const; + LandingPadInst *clone_impl() const override; public: /// Constructors - NumReservedClauses is a hint for the number of incoming /// clauses that this landingpad will have (use 0 if you really have no idea). @@ -2309,7 +2309,7 @@ private: ReturnInst(LLVMContext &C, Value *retVal, BasicBlock *InsertAtEnd); explicit ReturnInst(LLVMContext &C, BasicBlock *InsertAtEnd); protected: - virtual ReturnInst *clone_impl() const; + ReturnInst *clone_impl() const override; public: static ReturnInst* Create(LLVMContext &C, Value *retVal = 0, Instruction *InsertBefore = 0) { @@ -2342,9 +2342,9 @@ public: return isa(V) && classof(cast(V)); } private: - virtual BasicBlock *getSuccessorV(unsigned idx) const; - virtual unsigned getNumSuccessorsV() const; - virtual void setSuccessorV(unsigned idx, BasicBlock *B); + BasicBlock *getSuccessorV(unsigned idx) const override; + unsigned getNumSuccessorsV() const override; + void setSuccessorV(unsigned idx, BasicBlock *B) override; }; template <> @@ -2381,7 +2381,7 @@ class BranchInst : public TerminatorInst { BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond, BasicBlock *InsertAtEnd); protected: - virtual BranchInst *clone_impl() const; + BranchInst *clone_impl() const override; public: static BranchInst *Create(BasicBlock *IfTrue, Instruction *InsertBefore = 0) { return new(1) BranchInst(IfTrue, InsertBefore); @@ -2441,9 +2441,9 @@ public: return isa(V) && classof(cast(V)); } private: - virtual BasicBlock *getSuccessorV(unsigned idx) const; - virtual unsigned getNumSuccessorsV() const; - virtual void setSuccessorV(unsigned idx, BasicBlock *B); + BasicBlock *getSuccessorV(unsigned idx) const override; + unsigned getNumSuccessorsV() const override; + void setSuccessorV(unsigned idx, BasicBlock *B) override; }; template <> @@ -2487,7 +2487,7 @@ class SwitchInst : public TerminatorInst { SwitchInst(Value *Value, BasicBlock *Default, unsigned NumCases, BasicBlock *InsertAtEnd); protected: - virtual SwitchInst *clone_impl() const; + SwitchInst *clone_impl() const override; public: // -2 @@ -2734,9 +2734,9 @@ public: return isa(V) && classof(cast(V)); } private: - virtual BasicBlock *getSuccessorV(unsigned idx) const; - virtual unsigned getNumSuccessorsV() const; - virtual void setSuccessorV(unsigned idx, BasicBlock *B); + BasicBlock *getSuccessorV(unsigned idx) const override; + unsigned getNumSuccessorsV() const override; + void setSuccessorV(unsigned idx, BasicBlock *B) override; }; template <> @@ -2779,7 +2779,7 @@ class IndirectBrInst : public TerminatorInst { /// autoinserts at the end of the specified BasicBlock. IndirectBrInst(Value *Address, unsigned NumDests, BasicBlock *InsertAtEnd); protected: - virtual IndirectBrInst *clone_impl() const; + IndirectBrInst *clone_impl() const override; public: static IndirectBrInst *Create(Value *Address, unsigned NumDests, Instruction *InsertBefore = 0) { @@ -2832,9 +2832,9 @@ public: return isa(V) && classof(cast(V)); } private: - virtual BasicBlock *getSuccessorV(unsigned idx) const; - virtual unsigned getNumSuccessorsV() const; - virtual void setSuccessorV(unsigned idx, BasicBlock *B); + BasicBlock *getSuccessorV(unsigned idx) const override; + unsigned getNumSuccessorsV() const override; + void setSuccessorV(unsigned idx, BasicBlock *B) override; }; template <> @@ -2871,7 +2871,7 @@ class InvokeInst : public TerminatorInst { ArrayRef Args, unsigned Values, const Twine &NameStr, BasicBlock *InsertAtEnd); protected: - virtual InvokeInst *clone_impl() const; + InvokeInst *clone_impl() const override; public: static InvokeInst *Create(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, @@ -3055,9 +3055,9 @@ public: } private: - virtual BasicBlock *getSuccessorV(unsigned idx) const; - virtual unsigned getNumSuccessorsV() const; - virtual void setSuccessorV(unsigned idx, BasicBlock *B); + BasicBlock *getSuccessorV(unsigned idx) const override; + unsigned getNumSuccessorsV() const override; + void setSuccessorV(unsigned idx, BasicBlock *B) override; bool hasFnAttrImpl(Attribute::AttrKind A) const; @@ -3110,7 +3110,7 @@ class ResumeInst : public TerminatorInst { explicit ResumeInst(Value *Exn, Instruction *InsertBefore=0); ResumeInst(Value *Exn, BasicBlock *InsertAtEnd); protected: - virtual ResumeInst *clone_impl() const; + ResumeInst *clone_impl() const override; public: static ResumeInst *Create(Value *Exn, Instruction *InsertBefore = 0) { return new(1) ResumeInst(Exn, InsertBefore); @@ -3135,9 +3135,9 @@ public: return isa(V) && classof(cast(V)); } private: - virtual BasicBlock *getSuccessorV(unsigned idx) const; - virtual unsigned getNumSuccessorsV() const; - virtual void setSuccessorV(unsigned idx, BasicBlock *B); + BasicBlock *getSuccessorV(unsigned idx) const override; + unsigned getNumSuccessorsV() const override; + void setSuccessorV(unsigned idx, BasicBlock *B) override; }; template <> @@ -3159,7 +3159,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ResumeInst, Value) class UnreachableInst : public TerminatorInst { void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION; protected: - virtual UnreachableInst *clone_impl() const; + UnreachableInst *clone_impl() const override; public: // allocate space for exactly zero operands @@ -3179,9 +3179,9 @@ public: return isa(V) && classof(cast(V)); } private: - virtual BasicBlock *getSuccessorV(unsigned idx) const; - virtual unsigned getNumSuccessorsV() const; - virtual void setSuccessorV(unsigned idx, BasicBlock *B); + BasicBlock *getSuccessorV(unsigned idx) const override; + unsigned getNumSuccessorsV() const override; + void setSuccessorV(unsigned idx, BasicBlock *B) override; }; //===----------------------------------------------------------------------===// @@ -3192,7 +3192,7 @@ private: class TruncInst : public CastInst { protected: /// \brief Clone an identical TruncInst - virtual TruncInst *clone_impl() const; + TruncInst *clone_impl() const override; public: /// \brief Constructor with insert-before-instruction semantics @@ -3228,7 +3228,7 @@ public: class ZExtInst : public CastInst { protected: /// \brief Clone an identical ZExtInst - virtual ZExtInst *clone_impl() const; + ZExtInst *clone_impl() const override; public: /// \brief Constructor with insert-before-instruction semantics @@ -3264,7 +3264,7 @@ public: class SExtInst : public CastInst { protected: /// \brief Clone an identical SExtInst - virtual SExtInst *clone_impl() const; + SExtInst *clone_impl() const override; public: /// \brief Constructor with insert-before-instruction semantics @@ -3300,7 +3300,7 @@ public: class FPTruncInst : public CastInst { protected: /// \brief Clone an identical FPTruncInst - virtual FPTruncInst *clone_impl() const; + FPTruncInst *clone_impl() const override; public: /// \brief Constructor with insert-before-instruction semantics @@ -3336,7 +3336,7 @@ public: class FPExtInst : public CastInst { protected: /// \brief Clone an identical FPExtInst - virtual FPExtInst *clone_impl() const; + FPExtInst *clone_impl() const override; public: /// \brief Constructor with insert-before-instruction semantics @@ -3372,7 +3372,7 @@ public: class UIToFPInst : public CastInst { protected: /// \brief Clone an identical UIToFPInst - virtual UIToFPInst *clone_impl() const; + UIToFPInst *clone_impl() const override; public: /// \brief Constructor with insert-before-instruction semantics @@ -3408,7 +3408,7 @@ public: class SIToFPInst : public CastInst { protected: /// \brief Clone an identical SIToFPInst - virtual SIToFPInst *clone_impl() const; + SIToFPInst *clone_impl() const override; public: /// \brief Constructor with insert-before-instruction semantics @@ -3444,7 +3444,7 @@ public: class FPToUIInst : public CastInst { protected: /// \brief Clone an identical FPToUIInst - virtual FPToUIInst *clone_impl() const; + FPToUIInst *clone_impl() const override; public: /// \brief Constructor with insert-before-instruction semantics @@ -3480,7 +3480,7 @@ public: class FPToSIInst : public CastInst { protected: /// \brief Clone an identical FPToSIInst - virtual FPToSIInst *clone_impl() const; + FPToSIInst *clone_impl() const override; public: /// \brief Constructor with insert-before-instruction semantics @@ -3532,7 +3532,7 @@ public: ); /// \brief Clone an identical IntToPtrInst - virtual IntToPtrInst *clone_impl() const; + IntToPtrInst *clone_impl() const override; /// \brief Returns the address space of this instruction's pointer type. unsigned getAddressSpace() const { @@ -3556,7 +3556,7 @@ public: class PtrToIntInst : public CastInst { protected: /// \brief Clone an identical PtrToIntInst - virtual PtrToIntInst *clone_impl() const; + PtrToIntInst *clone_impl() const override; public: /// \brief Constructor with insert-before-instruction semantics @@ -3604,7 +3604,7 @@ public: class BitCastInst : public CastInst { protected: /// \brief Clone an identical BitCastInst - virtual BitCastInst *clone_impl() const; + BitCastInst *clone_impl() const override; public: /// \brief Constructor with insert-before-instruction semantics @@ -3641,7 +3641,7 @@ public: class AddrSpaceCastInst : public CastInst { protected: /// \brief Clone an identical AddrSpaceCastInst - virtual AddrSpaceCastInst *clone_impl() const; + AddrSpaceCastInst *clone_impl() const override; public: /// \brief Constructor with insert-before-instruction semantics diff --git a/llvm/include/llvm/IR/LegacyPassManager.h b/llvm/include/llvm/IR/LegacyPassManager.h index fa1436ec6324..c967a6bca8b2 100644 --- a/llvm/include/llvm/IR/LegacyPassManager.h +++ b/llvm/include/llvm/IR/LegacyPassManager.h @@ -55,7 +55,7 @@ public: /// the Pass to the PassManager. When the PassManager is destroyed, the pass /// will be destroyed as well, so there is no need to delete the pass. This /// implies that all passes MUST be allocated with 'new'. - void add(Pass *P); + void add(Pass *P) override; /// run - Execute all of the passes scheduled for execution. Keep track of /// whether any of the passes modifies the module, and if so, return true. @@ -80,7 +80,7 @@ public: /// PassManager_X is destroyed, the pass will be destroyed as well, so /// there is no need to delete the pass. /// This implies that all passes MUST be allocated with 'new'. - void add(Pass *P); + void add(Pass *P) override; /// run - Execute all of the passes scheduled for execution. Keep /// track of whether any of the passes modifies the function, and if diff --git a/llvm/include/llvm/IR/LegacyPassManagers.h b/llvm/include/llvm/IR/LegacyPassManagers.h index 6116132e6118..5c9dccd8b2f1 100644 --- a/llvm/include/llvm/IR/LegacyPassManagers.h +++ b/llvm/include/llvm/IR/LegacyPassManagers.h @@ -127,7 +127,7 @@ public: : P(p), V(0), M(&m) {} // When P is run on M /// print - Emit information about this stack frame to OS. - virtual void print(raw_ostream &OS) const; + void print(raw_ostream &OS) const override; }; @@ -414,7 +414,7 @@ public: /// run - Execute all of the passes scheduled for execution. Keep track of /// whether any of the passes modifies the module, and if so, return true. bool runOnFunction(Function &F); - bool runOnModule(Module &M); + bool runOnModule(Module &M) override; /// cleanup - After running all passes, clean up pass manager cache. void cleanup(); @@ -426,7 +426,7 @@ public: /// doInitialization - Run all of the initializers for the function passes. /// - bool doInitialization(Module &M); + bool doInitialization(Module &M) override; /// doFinalization - Overrides ModulePass doFinalization for global /// finalization tasks @@ -435,20 +435,20 @@ public: /// doFinalization - Run all of the finalizers for the function passes. /// - bool doFinalization(Module &M); + bool doFinalization(Module &M) override; - virtual PMDataManager *getAsPMDataManager() { return this; } - virtual Pass *getAsPass() { return this; } + PMDataManager *getAsPMDataManager() override { return this; } + Pass *getAsPass() override { return this; } /// Pass Manager itself does not invalidate any analysis info. - void getAnalysisUsage(AnalysisUsage &Info) const { + void getAnalysisUsage(AnalysisUsage &Info) const override{ Info.setPreservesAll(); } // Print passes managed by this manager - void dumpPassStructure(unsigned Offset); + void dumpPassStructure(unsigned Offset) override; - virtual const char *getPassName() const { + const char *getPassName() const override { return "Function Pass Manager"; } @@ -458,7 +458,7 @@ public: return FP; } - virtual PassManagerType getPassManagerType() const { + PassManagerType getPassManagerType() const override { return PMT_FunctionPassManager; } }; diff --git a/llvm/include/llvm/IR/LegacyPassNameParser.h b/llvm/include/llvm/IR/LegacyPassNameParser.h index b9c1d8b45c8c..1f6bbbcc0903 100644 --- a/llvm/include/llvm/IR/LegacyPassNameParser.h +++ b/llvm/include/llvm/IR/LegacyPassNameParser.h @@ -68,7 +68,7 @@ public: // Implement the PassRegistrationListener callbacks used to populate our map // - virtual void passRegistered(const PassInfo *P) { + void passRegistered(const PassInfo *P) override { if (ignorablePass(P) || !Opt) return; if (findOption(P->getPassArgument()) != getNumOptions()) { errs() << "Two passes with the same argument (-" @@ -77,11 +77,11 @@ public: } addLiteralOption(P->getPassArgument(), P, P->getPassName()); } - virtual void passEnumerate(const PassInfo *P) { passRegistered(P); } + void passEnumerate(const PassInfo *P) override { passRegistered(P); } // printOptionInfo - Print out information about this option. Override the // default implementation to sort the table before we print... - virtual void printOptionInfo(const cl::Option &O, size_t GlobalWidth) const { + void printOptionInfo(const cl::Option &O, size_t GlobalWidth) const override { PassNameParser *PNP = const_cast(this); array_pod_sort(PNP->Values.begin(), PNP->Values.end(), ValLessThan); cl::parser::printOptionInfo(O, GlobalWidth); @@ -107,7 +107,9 @@ private: Filter filter; public: - bool ignorablePassImpl(const PassInfo *P) const { return !filter(*P); } + bool ignorablePassImpl(const PassInfo *P) const override { + return !filter(*P); + } }; ///===----------------------------------------------------------------------===// diff --git a/llvm/include/llvm/Pass.h b/llvm/include/llvm/Pass.h index bfe57724d7ba..ff700cfe0af1 100644 --- a/llvm/include/llvm/Pass.h +++ b/llvm/include/llvm/Pass.h @@ -235,17 +235,17 @@ public: class ModulePass : public Pass { public: /// createPrinterPass - Get a module printer pass. - Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const; + Pass *createPrinterPass(raw_ostream &O, + const std::string &Banner) const override; /// runOnModule - Virtual method overriden by subclasses to process the module /// being operated on. virtual bool runOnModule(Module &M) = 0; - virtual void assignPassManager(PMStack &PMS, - PassManagerType T); + void assignPassManager(PMStack &PMS, PassManagerType T) override; /// Return what kind of Pass Manager can manage this pass. - virtual PassManagerType getPotentialPassManagerType() const; + PassManagerType getPotentialPassManagerType() const override; explicit ModulePass(char &pid) : Pass(PT_Module, pid) {} // Force out-of-line virtual method. @@ -268,11 +268,11 @@ public: /// virtual void initializePass(); - virtual ImmutablePass *getAsImmutablePass() { return this; } + ImmutablePass *getAsImmutablePass() override { return this; } /// ImmutablePasses are never run. /// - bool runOnModule(Module &) { return false; } + bool runOnModule(Module &) override { return false; } explicit ImmutablePass(char &pid) : ModulePass(pid) {} @@ -295,18 +295,18 @@ public: explicit FunctionPass(char &pid) : Pass(PT_Function, pid) {} /// createPrinterPass - Get a function printer pass. - Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const; + Pass *createPrinterPass(raw_ostream &O, + const std::string &Banner) const override; /// runOnFunction - Virtual method overriden by subclasses to do the /// per-function processing of the pass. /// virtual bool runOnFunction(Function &F) = 0; - virtual void assignPassManager(PMStack &PMS, - PassManagerType T); + void assignPassManager(PMStack &PMS, PassManagerType T) override; /// Return what kind of Pass Manager can manage this pass. - virtual PassManagerType getPotentialPassManagerType() const; + PassManagerType getPotentialPassManagerType() const override; protected: /// skipOptnoneFunction - This function has Attribute::OptimizeNone @@ -331,7 +331,8 @@ public: explicit BasicBlockPass(char &pid) : Pass(PT_BasicBlock, pid) {} /// createPrinterPass - Get a basic block printer pass. - Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const; + Pass *createPrinterPass(raw_ostream &O, + const std::string &Banner) const override; using llvm::Pass::doInitialization; using llvm::Pass::doFinalization; @@ -351,11 +352,10 @@ public: /// virtual bool doFinalization(Function &); - virtual void assignPassManager(PMStack &PMS, - PassManagerType T); + void assignPassManager(PMStack &PMS, PassManagerType T) override; /// Return what kind of Pass Manager can manage this pass. - virtual PassManagerType getPotentialPassManagerType() const; + PassManagerType getPotentialPassManagerType() const override; protected: /// skipOptnoneFunction - Containing function has Attribute::OptimizeNone diff --git a/llvm/lib/IR/AttributeImpl.h b/llvm/lib/IR/AttributeImpl.h index ea954ac20329..9f3fd3e606d3 100644 --- a/llvm/lib/IR/AttributeImpl.h +++ b/llvm/lib/IR/AttributeImpl.h @@ -109,7 +109,7 @@ public: }; class AlignAttributeImpl : public EnumAttributeImpl { - virtual void anchor(); + void anchor() override; unsigned Align; public: diff --git a/llvm/lib/IR/ConstantsContext.h b/llvm/lib/IR/ConstantsContext.h index 64f835b005a7..59b9d4d3c5ed 100644 --- a/llvm/lib/IR/ConstantsContext.h +++ b/llvm/lib/IR/ConstantsContext.h @@ -32,7 +32,7 @@ struct ConstantTraits; /// UnaryConstantExpr - This class is private to Constants.cpp, and is used /// behind the scenes to implement unary constant exprs. class UnaryConstantExpr : public ConstantExpr { - virtual void anchor(); + void anchor() override; void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION; public: // allocate space for exactly one operand @@ -49,7 +49,7 @@ public: /// BinaryConstantExpr - This class is private to Constants.cpp, and is used /// behind the scenes to implement binary constant exprs. class BinaryConstantExpr : public ConstantExpr { - virtual void anchor(); + void anchor() override; void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION; public: // allocate space for exactly two operands @@ -70,7 +70,7 @@ public: /// SelectConstantExpr - This class is private to Constants.cpp, and is used /// behind the scenes to implement select constant exprs. class SelectConstantExpr : public ConstantExpr { - virtual void anchor(); + void anchor() override; void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION; public: // allocate space for exactly three operands @@ -91,7 +91,7 @@ public: /// Constants.cpp, and is used behind the scenes to implement /// extractelement constant exprs. class ExtractElementConstantExpr : public ConstantExpr { - virtual void anchor(); + void anchor() override; void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION; public: // allocate space for exactly two operands @@ -112,7 +112,7 @@ public: /// Constants.cpp, and is used behind the scenes to implement /// insertelement constant exprs. class InsertElementConstantExpr : public ConstantExpr { - virtual void anchor(); + void anchor() override; void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION; public: // allocate space for exactly three operands @@ -134,7 +134,7 @@ public: /// Constants.cpp, and is used behind the scenes to implement /// shufflevector constant exprs. class ShuffleVectorConstantExpr : public ConstantExpr { - virtual void anchor(); + void anchor() override; void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION; public: // allocate space for exactly three operands @@ -159,7 +159,7 @@ public: /// Constants.cpp, and is used behind the scenes to implement /// extractvalue constant exprs. class ExtractValueConstantExpr : public ConstantExpr { - virtual void anchor(); + void anchor() override; void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION; public: // allocate space for exactly one operand @@ -185,7 +185,7 @@ public: /// Constants.cpp, and is used behind the scenes to implement /// insertvalue constant exprs. class InsertValueConstantExpr : public ConstantExpr { - virtual void anchor(); + void anchor() override; void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION; public: // allocate space for exactly one operand @@ -212,7 +212,7 @@ public: /// GetElementPtrConstantExpr - This class is private to Constants.cpp, and is /// used behind the scenes to implement getelementpr constant exprs. class GetElementPtrConstantExpr : public ConstantExpr { - virtual void anchor(); + void anchor() override; GetElementPtrConstantExpr(Constant *C, ArrayRef IdxList, Type *DestTy); public: @@ -233,7 +233,7 @@ public: // behind the scenes to implement ICmp and FCmp constant expressions. This is // needed in order to store the predicate value for these instructions. class CompareConstantExpr : public ConstantExpr { - virtual void anchor(); + void anchor() override; void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION; public: // allocate space for exactly two operands diff --git a/llvm/lib/IR/IRPrintingPasses.cpp b/llvm/lib/IR/IRPrintingPasses.cpp index 13336ba55b3e..099c27cfa5c0 100644 --- a/llvm/lib/IR/IRPrintingPasses.cpp +++ b/llvm/lib/IR/IRPrintingPasses.cpp @@ -49,12 +49,12 @@ public: PrintModulePassWrapper(raw_ostream &OS, const std::string &Banner) : ModulePass(ID), P(OS, Banner) {} - bool runOnModule(Module &M) { + bool runOnModule(Module &M) override { P.run(&M); return false; } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); } }; @@ -69,12 +69,12 @@ public: : FunctionPass(ID), P(OS, Banner) {} // This pass just prints a banner followed by the function as it's processed. - bool runOnFunction(Function &F) { + bool runOnFunction(Function &F) override { P.run(&F); return false; } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); } }; @@ -89,12 +89,12 @@ public: PrintBasicBlockPass(raw_ostream &Out, const std::string &Banner) : BasicBlockPass(ID), Out(Out), Banner(Banner) {} - bool runOnBasicBlock(BasicBlock &BB) { + bool runOnBasicBlock(BasicBlock &BB) override { Out << Banner << BB; return false; } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override{ AU.setPreservesAll(); } }; diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h index 7a3cdb9e9d35..dc77d291f40c 100644 --- a/llvm/lib/IR/LLVMContextImpl.h +++ b/llvm/lib/IR/LLVMContextImpl.h @@ -225,9 +225,9 @@ public: MDNode *get() const { return cast_or_null(getValPtr()); } - - virtual void deleted(); - virtual void allUsesReplacedWith(Value *VNew); + + void deleted() override; + void allUsesReplacedWith(Value *VNew) override; }; class LLVMContextImpl { diff --git a/llvm/lib/IR/LegacyPassManager.cpp b/llvm/lib/IR/LegacyPassManager.cpp index e384e0845710..7c5cc6893bca 100644 --- a/llvm/lib/IR/LegacyPassManager.cpp +++ b/llvm/lib/IR/LegacyPassManager.cpp @@ -164,27 +164,27 @@ public: /// Execute all of the passes scheduled for execution. Keep track of /// whether any of the passes modifies the function, and if so, return true. - bool runOnFunction(Function &F); + bool runOnFunction(Function &F) override; /// Pass Manager itself does not invalidate any analysis info. - void getAnalysisUsage(AnalysisUsage &Info) const { + void getAnalysisUsage(AnalysisUsage &Info) const override { Info.setPreservesAll(); } - bool doInitialization(Module &M); + bool doInitialization(Module &M) override; bool doInitialization(Function &F); - bool doFinalization(Module &M); + bool doFinalization(Module &M) override; bool doFinalization(Function &F); - virtual PMDataManager *getAsPMDataManager() { return this; } - virtual Pass *getAsPass() { return this; } + PMDataManager *getAsPMDataManager() override { return this; } + Pass *getAsPass() override { return this; } - virtual const char *getPassName() const { + const char *getPassName() const override { return "BasicBlock Pass Manager"; } // Print passes managed by this manager - void dumpPassStructure(unsigned Offset) { + void dumpPassStructure(unsigned Offset) override { dbgs().indent(Offset*2) << "BasicBlockPass Manager\n"; for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { BasicBlockPass *BP = getContainedPass(Index); @@ -199,7 +199,7 @@ public: return BP; } - virtual PassManagerType getPassManagerType() const { + PassManagerType getPassManagerType() const override { return PMT_BasicBlockPassManager; } }; @@ -234,7 +234,8 @@ public: } /// createPrinterPass - Get a function printer pass. - Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const { + Pass *createPrinterPass(raw_ostream &O, + const std::string &Banner) const override { return createPrintFunctionPass(O, Banner); } @@ -248,21 +249,21 @@ public: /// doInitialization - Run all of the initializers for the function passes. /// - bool doInitialization(Module &M); + bool doInitialization(Module &M) override; /// doFinalization - Run all of the finalizers for the function passes. /// - bool doFinalization(Module &M); + bool doFinalization(Module &M) override; - virtual PMDataManager *getAsPMDataManager() { return this; } - virtual Pass *getAsPass() { return this; } - virtual PassManagerType getTopLevelPassManagerType() { + PMDataManager *getAsPMDataManager() override { return this; } + Pass *getAsPass() override { return this; } + PassManagerType getTopLevelPassManagerType() override { return PMT_FunctionPassManager; } /// Pass Manager itself does not invalidate any analysis info. - void getAnalysisUsage(AnalysisUsage &Info) const { + void getAnalysisUsage(AnalysisUsage &Info) const override { Info.setPreservesAll(); } @@ -303,7 +304,8 @@ public: } /// createPrinterPass - Get a module printer pass. - Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const { + Pass *createPrinterPass(raw_ostream &O, + const std::string &Banner) const override { return createPrintModulePass(O, Banner); } @@ -323,29 +325,29 @@ public: bool doFinalization(); /// Pass Manager itself does not invalidate any analysis info. - void getAnalysisUsage(AnalysisUsage &Info) const { + void getAnalysisUsage(AnalysisUsage &Info) const override { Info.setPreservesAll(); } /// Add RequiredPass into list of lower level passes required by pass P. /// RequiredPass is run on the fly by Pass Manager when P requests it /// through getAnalysis interface. - virtual void addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass); + void addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass) override; /// Return function pass corresponding to PassInfo PI, that is /// required by module pass MP. Instantiate analysis pass, by using /// its runOnFunction() for function F. - virtual Pass* getOnTheFlyPass(Pass *MP, AnalysisID PI, Function &F); + Pass* getOnTheFlyPass(Pass *MP, AnalysisID PI, Function &F) override; - virtual const char *getPassName() const { + const char *getPassName() const override { return "Module Pass Manager"; } - virtual PMDataManager *getAsPMDataManager() { return this; } - virtual Pass *getAsPass() { return this; } + PMDataManager *getAsPMDataManager() override { return this; } + Pass *getAsPass() override { return this; } // Print passes managed by this manager - void dumpPassStructure(unsigned Offset) { + void dumpPassStructure(unsigned Offset) override { dbgs().indent(Offset*2) << "ModulePass Manager\n"; for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { ModulePass *MP = getContainedPass(Index); @@ -363,7 +365,7 @@ public: return static_cast(PassVector[N]); } - virtual PassManagerType getPassManagerType() const { + PassManagerType getPassManagerType() const override { return PMT_ModulePassManager; } @@ -403,7 +405,8 @@ public: } /// createPrinterPass - Get a module printer pass. - Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const { + Pass *createPrinterPass(raw_ostream &O, + const std::string &Banner) const override { return createPrintModulePass(O, Banner); } @@ -423,13 +426,13 @@ public: bool doFinalization(); /// Pass Manager itself does not invalidate any analysis info. - void getAnalysisUsage(AnalysisUsage &Info) const { + void getAnalysisUsage(AnalysisUsage &Info) const override { Info.setPreservesAll(); } - virtual PMDataManager *getAsPMDataManager() { return this; } - virtual Pass *getAsPass() { return this; } - virtual PassManagerType getTopLevelPassManagerType() { + PMDataManager *getAsPMDataManager() override { return this; } + Pass *getAsPass() override { return this; } + PassManagerType getTopLevelPassManagerType() override { return PMT_ModulePassManager; } diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp index f8a1776599ff..c6107f5d8042 100644 --- a/llvm/lib/IR/Metadata.cpp +++ b/llvm/lib/IR/Metadata.cpp @@ -78,8 +78,8 @@ public: /// the list. void setAsFirstOperand(unsigned V) { this->setValPtrInt(V); } - virtual void deleted(); - virtual void allUsesReplacedWith(Value *NV); + void deleted() override; + void allUsesReplacedWith(Value *NV) override; }; } // end namespace llvm. diff --git a/llvm/lib/IR/Pass.cpp b/llvm/lib/IR/Pass.cpp index 06a5e9e378be..e16c5b7dcb5c 100644 --- a/llvm/lib/IR/Pass.cpp +++ b/llvm/lib/IR/Pass.cpp @@ -252,7 +252,7 @@ namespace { VectorType &CFGOnlyList; GetCFGOnlyPasses(VectorType &L) : CFGOnlyList(L) {} - void passEnumerate(const PassInfo *P) { + void passEnumerate(const PassInfo *P) override { if (P->isCFGOnlyPass()) CFGOnlyList.push_back(P->getTypeInfo()); } diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index 9b297756ceac..03cfc42e332b 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -2403,21 +2403,21 @@ struct VerifierLegacyPass : public FunctionPass { initializeVerifierLegacyPassPass(*PassRegistry::getPassRegistry()); } - bool runOnFunction(Function &F) { + bool runOnFunction(Function &F) override { if (!V.verify(F) && FatalErrors) report_fatal_error("Broken function found, compilation aborted!"); return false; } - bool doFinalization(Module &M) { + bool doFinalization(Module &M) override { if (!V.verify(M) && FatalErrors) report_fatal_error("Broken module found, compilation aborted!"); return false; } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); } };