Replace a few virtual with override.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217513 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2014-09-10 15:50:08 +00:00
parent ac67a5fd18
commit 5ab6b15c79

View File

@ -54,11 +54,11 @@ namespace llvm {
static char run; static char run;
static char ID; static char ID;
ModuleNDNM() : ModulePass(ID) { } ModuleNDNM() : ModulePass(ID) { }
virtual bool runOnModule(Module &M) { bool runOnModule(Module &M) override {
run++; run++;
return false; return false;
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
} }
}; };
@ -70,7 +70,7 @@ namespace llvm {
static char run; static char run;
static char ID; static char ID;
ModuleNDM() : ModulePass(ID) {} ModuleNDM() : ModulePass(ID) {}
virtual bool runOnModule(Module &M) { bool runOnModule(Module &M) override {
run++; run++;
return true; return true;
} }
@ -83,7 +83,7 @@ namespace llvm {
static char run; static char run;
static char ID; static char ID;
ModuleNDM2() : ModulePass(ID) {} ModuleNDM2() : ModulePass(ID) {}
virtual bool runOnModule(Module &M) { bool runOnModule(Module &M) override {
run++; run++;
return true; return true;
} }
@ -98,12 +98,12 @@ namespace llvm {
ModuleDNM() : ModulePass(ID) { ModuleDNM() : ModulePass(ID) {
initializeModuleNDMPass(*PassRegistry::getPassRegistry()); initializeModuleNDMPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnModule(Module &M) { bool runOnModule(Module &M) override {
EXPECT_TRUE(getAnalysisIfAvailable<DataLayoutPass>()); EXPECT_TRUE(getAnalysisIfAvailable<DataLayoutPass>());
run++; run++;
return false; return false;
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<ModuleNDM>(); AU.addRequired<ModuleNDM>();
AU.setPreservesAll(); AU.setPreservesAll();
} }
@ -139,7 +139,7 @@ namespace llvm {
runc = 0; runc = 0;
} }
virtual void releaseMemory() { void releaseMemory() override {
EXPECT_GT(runc, 0); EXPECT_GT(runc, 0);
EXPECT_GT(allocated, 0); EXPECT_GT(allocated, 0);
allocated--; allocated--;
@ -157,12 +157,12 @@ namespace llvm {
using llvm::Pass::doInitialization; using llvm::Pass::doInitialization;
using llvm::Pass::doFinalization; using llvm::Pass::doFinalization;
#endif #endif
virtual bool doInitialization(T &t) { bool doInitialization(T &t) override {
EXPECT_FALSE(PassTestBase<P>::initialized); EXPECT_FALSE(PassTestBase<P>::initialized);
PassTestBase<P>::initialized = true; PassTestBase<P>::initialized = true;
return false; return false;
} }
virtual bool doFinalization(T &t) { bool doFinalization(T &t) override {
EXPECT_FALSE(PassTestBase<P>::finalized); EXPECT_FALSE(PassTestBase<P>::finalized);
PassTestBase<P>::finalized = true; PassTestBase<P>::finalized = true;
EXPECT_EQ(0, PassTestBase<P>::allocated); EXPECT_EQ(0, PassTestBase<P>::allocated);
@ -175,7 +175,7 @@ namespace llvm {
CGPass() { CGPass() {
initializeCGPassPass(*PassRegistry::getPassRegistry()); initializeCGPassPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnSCC(CallGraphSCC &SCMM) { bool runOnSCC(CallGraphSCC &SCMM) override {
EXPECT_TRUE(getAnalysisIfAvailable<DataLayoutPass>()); EXPECT_TRUE(getAnalysisIfAvailable<DataLayoutPass>());
run(); run();
return false; return false;
@ -184,7 +184,7 @@ namespace llvm {
struct FPass : public PassTest<Module, FunctionPass> { struct FPass : public PassTest<Module, FunctionPass> {
public: public:
virtual bool runOnFunction(Function &F) { bool runOnFunction(Function &F) override {
// FIXME: PR4112 // FIXME: PR4112
// EXPECT_TRUE(getAnalysisIfAvailable<DataLayout>()); // EXPECT_TRUE(getAnalysisIfAvailable<DataLayout>());
run(); run();
@ -209,17 +209,17 @@ namespace llvm {
} }
using llvm::Pass::doInitialization; using llvm::Pass::doInitialization;
using llvm::Pass::doFinalization; using llvm::Pass::doFinalization;
virtual bool doInitialization(Loop* L, LPPassManager &LPM) { bool doInitialization(Loop* L, LPPassManager &LPM) override {
initialized = true; initialized = true;
initcount++; initcount++;
return false; return false;
} }
virtual bool runOnLoop(Loop *L, LPPassManager &LPM) { bool runOnLoop(Loop *L, LPPassManager &LPM) override {
EXPECT_TRUE(getAnalysisIfAvailable<DataLayoutPass>()); EXPECT_TRUE(getAnalysisIfAvailable<DataLayoutPass>());
run(); run();
return false; return false;
} }
virtual bool doFinalization() { bool doFinalization() override {
fincount++; fincount++;
finalized = true; finalized = true;
return false; return false;
@ -242,25 +242,25 @@ namespace llvm {
inited = 0; inited = 0;
fin = 0; fin = 0;
} }
virtual bool doInitialization(Module &M) { bool doInitialization(Module &M) override {
EXPECT_FALSE(initialized); EXPECT_FALSE(initialized);
initialized = true; initialized = true;
return false; return false;
} }
virtual bool doInitialization(Function &F) { bool doInitialization(Function &F) override {
inited++; inited++;
return false; return false;
} }
virtual bool runOnBasicBlock(BasicBlock &BB) { bool runOnBasicBlock(BasicBlock &BB) override {
EXPECT_TRUE(getAnalysisIfAvailable<DataLayoutPass>()); EXPECT_TRUE(getAnalysisIfAvailable<DataLayoutPass>());
run(); run();
return false; return false;
} }
virtual bool doFinalization(Function &F) { bool doFinalization(Function &F) override {
fin++; fin++;
return false; return false;
} }
virtual bool doFinalization(Module &M) { bool doFinalization(Module &M) override {
EXPECT_FALSE(finalized); EXPECT_FALSE(finalized);
finalized = true; finalized = true;
EXPECT_EQ(0, allocated); EXPECT_EQ(0, allocated);
@ -276,7 +276,7 @@ namespace llvm {
OnTheFlyTest() : ModulePass(ID) { OnTheFlyTest() : ModulePass(ID) {
initializeFPassPass(*PassRegistry::getPassRegistry()); initializeFPassPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnModule(Module &M) { bool runOnModule(Module &M) override {
EXPECT_TRUE(getAnalysisIfAvailable<DataLayoutPass>()); EXPECT_TRUE(getAnalysisIfAvailable<DataLayoutPass>());
for (Module::iterator I=M.begin(),E=M.end(); I != E; ++I) { for (Module::iterator I=M.begin(),E=M.end(); I != E; ++I) {
Function &F = *I; Function &F = *I;
@ -287,7 +287,7 @@ namespace llvm {
} }
return false; return false;
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<FPass>(); AU.addRequired<FPass>();
} }
}; };