From c83e68f7326f424876198514eb2ad89110f52c45 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sat, 8 Mar 2014 08:27:28 +0000 Subject: [C++11] Add 'override' keyword to virtual methods that override their base class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203345 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/opt/AnalysisWrappers.cpp | 8 ++++---- tools/opt/BreakpointPrinter.cpp | 4 ++-- tools/opt/GraphPrinters.cpp | 4 ++-- tools/opt/PassPrinters.cpp | 36 ++++++++++++++++++------------------ tools/opt/PrintSCC.cpp | 12 ++++++------ 5 files changed, 32 insertions(+), 32 deletions(-) (limited to 'tools/opt') diff --git a/tools/opt/AnalysisWrappers.cpp b/tools/opt/AnalysisWrappers.cpp index b9c627d8f5..1774ea0295 100644 --- a/tools/opt/AnalysisWrappers.cpp +++ b/tools/opt/AnalysisWrappers.cpp @@ -32,7 +32,7 @@ namespace { struct ExternalFunctionsPassedConstants : public ModulePass { static char ID; // Pass ID, replacement for typeid ExternalFunctionsPassedConstants() : ModulePass(ID) {} - virtual bool runOnModule(Module &M) { + bool runOnModule(Module &M) override { for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { if (!I->isDeclaration()) continue; @@ -62,7 +62,7 @@ namespace { return false; } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); } }; @@ -78,11 +78,11 @@ namespace { static char ID; // Pass ID, replacement for typeid CallGraphPrinter() : ModulePass(ID) {} - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); AU.addRequiredTransitive(); } - virtual bool runOnModule(Module &M) { + bool runOnModule(Module &M) override { getAnalysis().print(errs(), &M); return false; } diff --git a/tools/opt/BreakpointPrinter.cpp b/tools/opt/BreakpointPrinter.cpp index 66e93fde38..44f4a11773 100644 --- a/tools/opt/BreakpointPrinter.cpp +++ b/tools/opt/BreakpointPrinter.cpp @@ -45,7 +45,7 @@ struct BreakpointPrinter : public ModulePass { } } - virtual bool runOnModule(Module &M) { + bool runOnModule(Module &M) override { TypeIdentifierMap.clear(); NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu"); if (CU_Nodes) @@ -69,7 +69,7 @@ struct BreakpointPrinter : public ModulePass { return false; } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); } }; diff --git a/tools/opt/GraphPrinters.cpp b/tools/opt/GraphPrinters.cpp index b299f4c362..640edfee41 100644 --- a/tools/opt/GraphPrinters.cpp +++ b/tools/opt/GraphPrinters.cpp @@ -29,12 +29,12 @@ namespace { static char ID; // Pass identification, replacement for typeid DomInfoPrinter() : FunctionPass(ID) {} - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); AU.addRequired(); } - virtual bool runOnFunction(Function &F) { + bool runOnFunction(Function &F) override { getAnalysis().dump(); return false; } diff --git a/tools/opt/PassPrinters.cpp b/tools/opt/PassPrinters.cpp index b809d1d405..d6994894ca 100644 --- a/tools/opt/PassPrinters.cpp +++ b/tools/opt/PassPrinters.cpp @@ -36,7 +36,7 @@ struct FunctionPassPrinter : public FunctionPass { PassName = "FunctionPass Printer: " + PassToPrintName; } - virtual bool runOnFunction(Function &F) { + bool runOnFunction(Function &F) override { if (!QuietPass) Out << "Printing analysis '" << PassToPrint->getPassName() << "' for function '" << F.getName() << "':\n"; @@ -46,9 +46,9 @@ struct FunctionPassPrinter : public FunctionPass { return false; } - virtual const char *getPassName() const { return PassName.c_str(); } + const char *getPassName() const override { return PassName.c_str(); } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } @@ -69,7 +69,7 @@ struct CallGraphSCCPassPrinter : public CallGraphSCCPass { PassName = "CallGraphSCCPass Printer: " + PassToPrintName; } - virtual bool runOnSCC(CallGraphSCC &SCC) { + bool runOnSCC(CallGraphSCC &SCC) override { if (!QuietPass) Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n"; @@ -83,9 +83,9 @@ struct CallGraphSCCPassPrinter : public CallGraphSCCPass { return false; } - virtual const char *getPassName() const { return PassName.c_str(); } + const char *getPassName() const override { return PassName.c_str(); } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } @@ -106,7 +106,7 @@ struct ModulePassPrinter : public ModulePass { PassName = "ModulePass Printer: " + PassToPrintName; } - virtual bool runOnModule(Module &M) { + bool runOnModule(Module &M) override { if (!QuietPass) Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n"; @@ -115,9 +115,9 @@ struct ModulePassPrinter : public ModulePass { return false; } - virtual const char *getPassName() const { return PassName.c_str(); } + const char *getPassName() const override { return PassName.c_str(); } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } @@ -138,7 +138,7 @@ struct LoopPassPrinter : public LoopPass { PassName = "LoopPass Printer: " + PassToPrintName; } - virtual bool runOnLoop(Loop *L, LPPassManager &LPM) { + bool runOnLoop(Loop *L, LPPassManager &LPM) override { if (!QuietPass) Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n"; @@ -148,9 +148,9 @@ struct LoopPassPrinter : public LoopPass { return false; } - virtual const char *getPassName() const { return PassName.c_str(); } + const char *getPassName() const override { return PassName.c_str(); } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } @@ -171,7 +171,7 @@ struct RegionPassPrinter : public RegionPass { PassName = "RegionPass Printer: " + PassToPrintName; } - virtual bool runOnRegion(Region *R, RGPassManager &RGM) { + bool runOnRegion(Region *R, RGPassManager &RGM) override { if (!QuietPass) { Out << "Printing analysis '" << PassToPrint->getPassName() << "' for " << "region: '" << R->getNameStr() << "' in function '" @@ -183,9 +183,9 @@ struct RegionPassPrinter : public RegionPass { return false; } - virtual const char *getPassName() const { return PassName.c_str(); } + const char *getPassName() const override { return PassName.c_str(); } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } @@ -206,7 +206,7 @@ struct BasicBlockPassPrinter : public BasicBlockPass { PassName = "BasicBlockPass Printer: " + PassToPrintName; } - virtual bool runOnBasicBlock(BasicBlock &BB) { + bool runOnBasicBlock(BasicBlock &BB) override { if (!QuietPass) Out << "Printing Analysis info for BasicBlock '" << BB.getName() << "': Pass " << PassToPrint->getPassName() << ":\n"; @@ -217,9 +217,9 @@ struct BasicBlockPassPrinter : public BasicBlockPass { return false; } - virtual const char *getPassName() const { return PassName.c_str(); } + const char *getPassName() const override { return PassName.c_str(); } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } diff --git a/tools/opt/PrintSCC.cpp b/tools/opt/PrintSCC.cpp index f2e77f0cef..cbc0a55996 100644 --- a/tools/opt/PrintSCC.cpp +++ b/tools/opt/PrintSCC.cpp @@ -37,11 +37,11 @@ namespace { struct CFGSCC : public FunctionPass { static char ID; // Pass identification, replacement for typeid CFGSCC() : FunctionPass(ID) {} - bool runOnFunction(Function& func); + bool runOnFunction(Function& func) override; - void print(raw_ostream &O, const Module* = 0) const { } + void print(raw_ostream &O, const Module* = 0) const override { } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); } }; @@ -51,12 +51,12 @@ namespace { CallGraphSCC() : ModulePass(ID) {} // run - Print out SCCs in the call graph for the specified module. - bool runOnModule(Module &M); + bool runOnModule(Module &M) override; - void print(raw_ostream &O, const Module* = 0) const { } + void print(raw_ostream &O, const Module* = 0) const override { } // getAnalysisUsage - This pass requires the CallGraph. - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); AU.addRequired(); } -- cgit v1.2.3