diff options
author | Craig Topper <craig.topper@gmail.com> | 2014-03-05 06:35:38 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2014-03-05 06:35:38 +0000 |
commit | 98f54c09d086f76fa0ec81fc2c01d45bfe5a3739 (patch) | |
tree | 90539ede4e5a33ce3675f437ba062c76cc867d47 /lib | |
parent | 0bfd526b6b5b3173bfabf6fd5a5b02369fb8b132 (diff) | |
download | llvm-98f54c09d086f76fa0ec81fc2c01d45bfe5a3739.tar.gz llvm-98f54c09d086f76fa0ec81fc2c01d45bfe5a3739.tar.bz2 llvm-98f54c09d086f76fa0ec81fc2c01d45bfe5a3739.tar.xz |
[C++11] Add 'override' keyword to IR library.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202939 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/IR/AttributeImpl.h | 2 | ||||
-rw-r--r-- | lib/IR/ConstantsContext.h | 20 | ||||
-rw-r--r-- | lib/IR/IRPrintingPasses.cpp | 12 | ||||
-rw-r--r-- | lib/IR/LLVMContextImpl.h | 6 | ||||
-rw-r--r-- | lib/IR/LegacyPassManager.cpp | 63 | ||||
-rw-r--r-- | lib/IR/Metadata.cpp | 4 | ||||
-rw-r--r-- | lib/IR/Pass.cpp | 2 | ||||
-rw-r--r-- | lib/IR/Verifier.cpp | 6 |
8 files changed, 59 insertions, 56 deletions
diff --git a/lib/IR/AttributeImpl.h b/lib/IR/AttributeImpl.h index ea954ac203..9f3fd3e606 100644 --- a/lib/IR/AttributeImpl.h +++ b/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/lib/IR/ConstantsContext.h b/lib/IR/ConstantsContext.h index 64f835b005..59b9d4d3c5 100644 --- a/lib/IR/ConstantsContext.h +++ b/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<Constant*> 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/lib/IR/IRPrintingPasses.cpp b/lib/IR/IRPrintingPasses.cpp index 13336ba55b..099c27cfa5 100644 --- a/lib/IR/IRPrintingPasses.cpp +++ b/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/lib/IR/LLVMContextImpl.h b/lib/IR/LLVMContextImpl.h index 7a3cdb9e9d..dc77d291f4 100644 --- a/lib/IR/LLVMContextImpl.h +++ b/lib/IR/LLVMContextImpl.h @@ -225,9 +225,9 @@ public: MDNode *get() const { return cast_or_null<MDNode>(getValPtr()); } - - virtual void deleted(); - virtual void allUsesReplacedWith(Value *VNew); + + void deleted() override; + void allUsesReplacedWith(Value *VNew) override; }; class LLVMContextImpl { diff --git a/lib/IR/LegacyPassManager.cpp b/lib/IR/LegacyPassManager.cpp index e384e08457..7c5cc6893b 100644 --- a/lib/IR/LegacyPassManager.cpp +++ b/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<ModulePass *>(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/lib/IR/Metadata.cpp b/lib/IR/Metadata.cpp index f8a1776599..c6107f5d80 100644 --- a/lib/IR/Metadata.cpp +++ b/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/lib/IR/Pass.cpp b/lib/IR/Pass.cpp index 06a5e9e378..e16c5b7dcb 100644 --- a/lib/IR/Pass.cpp +++ b/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/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp index 9b297756ce..03cfc42e33 100644 --- a/lib/IR/Verifier.cpp +++ b/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(); } }; |