[C++11] Add 'override' keyword to virtual methods that override their base class.

llvm-svn: 202945
This commit is contained in:
Craig Topper 2014-03-05 07:30:04 +00:00
parent 2759a7c9c0
commit e9ba759c81
45 changed files with 252 additions and 254 deletions

View File

@ -282,8 +282,8 @@ class AliasSetTracker {
/// notified whenever a Value is deleted. /// notified whenever a Value is deleted.
class ASTCallbackVH : public CallbackVH { class ASTCallbackVH : public CallbackVH {
AliasSetTracker *AST; AliasSetTracker *AST;
virtual void deleted(); void deleted() override;
virtual void allUsesReplacedWith(Value *); void allUsesReplacedWith(Value *) override;
public: public:
ASTCallbackVH(Value *V, AliasSetTracker *AST = 0); ASTCallbackVH(Value *V, AliasSetTracker *AST = 0);
ASTCallbackVH &operator=(Value *V); ASTCallbackVH &operator=(Value *V);

View File

@ -37,10 +37,10 @@ public:
~BlockFrequencyInfo(); ~BlockFrequencyInfo();
void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
void print(raw_ostream &O, const Module *M) const; void print(raw_ostream &O, const Module *M) const override;
const Function *getFunction() const; const Function *getFunction() const;
void view() const; void view() const;

View File

@ -45,9 +45,9 @@ public:
initializeBranchProbabilityInfoPass(*PassRegistry::getPassRegistry()); initializeBranchProbabilityInfoPass(*PassRegistry::getPassRegistry());
} }
void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
void print(raw_ostream &OS, const Module *M = 0) const; void print(raw_ostream &OS, const Module *M = 0) const override;
/// \brief Get an edge's probability, relative to other out-edges of the Src. /// \brief Get an edge's probability, relative to other out-edges of the Src.
/// ///

View File

@ -381,11 +381,11 @@ public:
// Implementation of the ModulePass interface needed here. // Implementation of the ModulePass interface needed here.
// //
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
virtual bool runOnModule(Module &M); bool runOnModule(Module &M) override;
virtual void releaseMemory(); void releaseMemory() override;
void print(raw_ostream &o, const Module *) const; void print(raw_ostream &o, const Module *) const override;
void dump() const; void dump() const;
}; };

View File

@ -37,7 +37,8 @@ public:
/// createPrinterPass - Get a pass that prints the Module /// createPrinterPass - Get a pass that prints the Module
/// corresponding to a CallGraph. /// corresponding to a CallGraph.
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::doInitialization;
using llvm::Pass::doFinalization; using llvm::Pass::doFinalization;
@ -65,18 +66,17 @@ public:
} }
/// Assign pass manager to manager this pass /// Assign pass manager to manager this pass
virtual void assignPassManager(PMStack &PMS, void assignPassManager(PMStack &PMS, PassManagerType PMT) override;
PassManagerType PMT);
/// Return what kind of Pass Manager can manage this pass. /// Return what kind of Pass Manager can manage this pass.
virtual PassManagerType getPotentialPassManagerType() const { PassManagerType getPotentialPassManagerType() const override {
return PMT_CallGraphPassManager; return PMT_CallGraphPassManager;
} }
/// getAnalysisUsage - For this class, we declare that we require and preserve /// getAnalysisUsage - For this class, we declare that we require and preserve
/// the call graph. If the derived class implements this method, it should /// the call graph. If the derived class implements this method, it should
/// always explicitly call the implementation here. /// always explicitly call the implementation here.
virtual void getAnalysisUsage(AnalysisUsage &Info) const; void getAnalysisUsage(AnalysisUsage &Info) const override;
}; };
/// CallGraphSCC - This is a single SCC that a CallGraphSCCPass is run on. /// CallGraphSCC - This is a single SCC that a CallGraphSCCPass is run on.

View File

@ -35,7 +35,7 @@ public:
DOTGraphTraitsViewer(StringRef GraphName, char &ID) DOTGraphTraitsViewer(StringRef GraphName, char &ID)
: FunctionPass(ID), Name(GraphName) {} : FunctionPass(ID), Name(GraphName) {}
virtual bool runOnFunction(Function &F) { bool runOnFunction(Function &F) override {
GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis<AnalysisT>()); GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis<AnalysisT>());
std::string GraphName = DOTGraphTraits<GraphT>::getGraphName(Graph); std::string GraphName = DOTGraphTraits<GraphT>::getGraphName(Graph);
std::string Title = GraphName + " for '" + F.getName().str() + "' function"; std::string Title = GraphName + " for '" + F.getName().str() + "' function";
@ -45,7 +45,7 @@ public:
return false; return false;
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addRequired<AnalysisT>(); AU.addRequired<AnalysisT>();
} }
@ -62,7 +62,7 @@ public:
DOTGraphTraitsPrinter(StringRef GraphName, char &ID) DOTGraphTraitsPrinter(StringRef GraphName, char &ID)
: FunctionPass(ID), Name(GraphName) {} : FunctionPass(ID), Name(GraphName) {}
virtual bool runOnFunction(Function &F) { bool runOnFunction(Function &F) override {
GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis<AnalysisT>()); GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis<AnalysisT>());
std::string Filename = Name + "." + F.getName().str() + ".dot"; std::string Filename = Name + "." + F.getName().str() + ".dot";
std::string ErrorInfo; std::string ErrorInfo;
@ -82,7 +82,7 @@ public:
return false; return false;
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addRequired<AnalysisT>(); AU.addRequired<AnalysisT>();
} }
@ -99,7 +99,7 @@ public:
DOTGraphTraitsModuleViewer(StringRef GraphName, char &ID) DOTGraphTraitsModuleViewer(StringRef GraphName, char &ID)
: ModulePass(ID), Name(GraphName) {} : ModulePass(ID), Name(GraphName) {}
virtual bool runOnModule(Module &M) { bool runOnModule(Module &M) override {
GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis<AnalysisT>()); GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis<AnalysisT>());
std::string Title = DOTGraphTraits<GraphT>::getGraphName(Graph); std::string Title = DOTGraphTraits<GraphT>::getGraphName(Graph);
@ -108,7 +108,7 @@ public:
return false; return false;
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addRequired<AnalysisT>(); AU.addRequired<AnalysisT>();
} }
@ -125,7 +125,7 @@ public:
DOTGraphTraitsModulePrinter(StringRef GraphName, char &ID) DOTGraphTraitsModulePrinter(StringRef GraphName, char &ID)
: ModulePass(ID), Name(GraphName) {} : ModulePass(ID), Name(GraphName) {}
virtual bool runOnModule(Module &M) { bool runOnModule(Module &M) override {
GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis<AnalysisT>()); GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis<AnalysisT>());
std::string Filename = Name + ".dot"; std::string Filename = Name + ".dot";
std::string ErrorInfo; std::string ErrorInfo;
@ -144,7 +144,7 @@ public:
return false; return false;
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addRequired<AnalysisT>(); AU.addRequired<AnalysisT>();
} }

View File

@ -227,45 +227,45 @@ namespace llvm {
/// isLoopIndependent - Returns true if this is a loop-independent /// isLoopIndependent - Returns true if this is a loop-independent
/// dependence. /// dependence.
bool isLoopIndependent() const { return LoopIndependent; } bool isLoopIndependent() const override { return LoopIndependent; }
/// isConfused - Returns true if this dependence is confused /// isConfused - Returns true if this dependence is confused
/// (the compiler understands nothing and makes worst-case /// (the compiler understands nothing and makes worst-case
/// assumptions). /// assumptions).
bool isConfused() const { return false; } bool isConfused() const override { return false; }
/// isConsistent - Returns true if this dependence is consistent /// isConsistent - Returns true if this dependence is consistent
/// (occurs every time the source and destination are executed). /// (occurs every time the source and destination are executed).
bool isConsistent() const { return Consistent; } bool isConsistent() const override { return Consistent; }
/// getLevels - Returns the number of common loops surrounding the /// getLevels - Returns the number of common loops surrounding the
/// source and destination of the dependence. /// source and destination of the dependence.
unsigned getLevels() const { return Levels; } unsigned getLevels() const override { return Levels; }
/// getDirection - Returns the direction associated with a particular /// getDirection - Returns the direction associated with a particular
/// level. /// level.
unsigned getDirection(unsigned Level) const; unsigned getDirection(unsigned Level) const override;
/// getDistance - Returns the distance (or NULL) associated with a /// getDistance - Returns the distance (or NULL) associated with a
/// particular level. /// particular level.
const SCEV *getDistance(unsigned Level) const; const SCEV *getDistance(unsigned Level) const override;
/// isPeelFirst - Returns true if peeling the first iteration from /// isPeelFirst - Returns true if peeling the first iteration from
/// this loop will break this dependence. /// this loop will break this dependence.
bool isPeelFirst(unsigned Level) const; bool isPeelFirst(unsigned Level) const override;
/// isPeelLast - Returns true if peeling the last iteration from /// isPeelLast - Returns true if peeling the last iteration from
/// this loop will break this dependence. /// this loop will break this dependence.
bool isPeelLast(unsigned Level) const; bool isPeelLast(unsigned Level) const override;
/// isSplitable - Returns true if splitting the loop will break /// isSplitable - Returns true if splitting the loop will break
/// the dependence. /// the dependence.
bool isSplitable(unsigned Level) const; bool isSplitable(unsigned Level) const override;
/// isScalar - Returns true if a particular level is scalar; that is, /// isScalar - Returns true if a particular level is scalar; that is,
/// if no subscript in the source or destination mention the induction /// if no subscript in the source or destination mention the induction
/// variable associated with the loop at this level. /// variable associated with the loop at this level.
bool isScalar(unsigned Level) const; bool isScalar(unsigned Level) const override;
private: private:
unsigned short Levels; unsigned short Levels;
bool LoopIndependent; bool LoopIndependent;
@ -918,10 +918,10 @@ namespace llvm {
initializeDependenceAnalysisPass(*PassRegistry::getPassRegistry()); initializeDependenceAnalysisPass(*PassRegistry::getPassRegistry());
} }
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
void releaseMemory(); void releaseMemory() override;
void getAnalysisUsage(AnalysisUsage &) const; void getAnalysisUsage(AnalysisUsage &) const override;
void print(raw_ostream &, const Module * = 0) const; void print(raw_ostream &, const Module * = 0) const override;
}; // class DependenceAnalysis }; // class DependenceAnalysis
/// createDependenceAnalysisPass - This creates an instance of the /// createDependenceAnalysisPass - This creates an instance of the

View File

@ -51,7 +51,7 @@ public:
/// ///
bool isPostDominator() const { return IsPostDominators; } bool isPostDominator() const { return IsPostDominators; }
virtual void releaseMemory() { Frontiers.clear(); } void releaseMemory() override { Frontiers.clear(); }
// Accessor interface: // Accessor interface:
typedef DomSetMapType::iterator iterator; typedef DomSetMapType::iterator iterator;
@ -142,7 +142,7 @@ public:
/// print - Convert to human readable form /// print - Convert to human readable form
/// ///
virtual void print(raw_ostream &OS, const Module* = 0) const; void print(raw_ostream &OS, const Module* = 0) const override;
/// dump - Dump the dominance frontier to dbgs(). /// dump - Dump the dominance frontier to dbgs().
void dump() const; void dump() const;
@ -167,7 +167,7 @@ public:
return Roots[0]; return Roots[0];
} }
virtual bool runOnFunction(Function &) { bool runOnFunction(Function &) override {
Frontiers.clear(); Frontiers.clear();
DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree(); DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
Roots = DT.getRoots(); Roots = DT.getRoots();
@ -176,7 +176,7 @@ public:
return false; return false;
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<DominatorTreeWrapperPass>();
} }

View File

@ -39,7 +39,7 @@ public:
/// passed in, then the types are printed symbolically if possible, using the /// passed in, then the types are printed symbolically if possible, using the
/// symbol table from the module. /// symbol table from the module.
/// ///
void print(raw_ostream &o, const Module *M) const; void print(raw_ostream &o, const Module *M) const override;
private: private:
/// IncorporateType - Incorporate one type and all of its subtypes into the /// IncorporateType - Incorporate one type and all of its subtypes into the
@ -53,10 +53,10 @@ private:
public: public:
/// run - This incorporates all types used by the specified module /// run - This incorporates all types used by the specified module
bool runOnModule(Module &M); bool runOnModule(Module &M) override;
/// getAnalysisUsage - We do not modify anything. /// getAnalysisUsage - We do not modify anything.
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
} }
}; };

View File

@ -86,7 +86,7 @@ private:
/// Deleted - Implementation of CallbackVH virtual function to /// Deleted - Implementation of CallbackVH virtual function to
/// receive notification when the User is deleted. /// receive notification when the User is deleted.
virtual void deleted(); void deleted() override;
}; };
template<> struct ilist_traits<IVStrideUse> template<> struct ilist_traits<IVStrideUse>
@ -129,11 +129,11 @@ class IVUsers : public LoopPass {
/// we are interested in. /// we are interested in.
ilist<IVStrideUse> IVUses; ilist<IVStrideUse> IVUses;
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
virtual bool runOnLoop(Loop *L, LPPassManager &LPM); bool runOnLoop(Loop *L, LPPassManager &LPM) override;
virtual void releaseMemory(); void releaseMemory() override;
public: public:
static char ID; // Pass ID, replacement for typeid static char ID; // Pass ID, replacement for typeid
@ -169,7 +169,7 @@ public:
return Processed.count(Inst); return Processed.count(Inst);
} }
void print(raw_ostream &OS, const Module* = 0) const; void print(raw_ostream &OS, const Module* = 0) const override;
/// dump - This method is used for debugging. /// dump - This method is used for debugging.
void dump() const; void dump() const;

View File

@ -108,8 +108,8 @@ public:
~InlineCostAnalysis(); ~InlineCostAnalysis();
// Pass interface implementation. // Pass interface implementation.
void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
bool runOnSCC(CallGraphSCC &SCC); bool runOnSCC(CallGraphSCC &SCC) override;
/// \brief Get an InlineCost object representing the cost of inlining this /// \brief Get an InlineCost object representing the cost of inlining this
/// callsite. /// callsite.

View File

@ -53,7 +53,7 @@ public:
} }
// run - Calculate the interval partition for this function // run - Calculate the interval partition for this function
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
// IntervalPartition ctor - Build a reduced interval partition from an // IntervalPartition ctor - Build a reduced interval partition from an
// existing interval graph. This takes an additional boolean parameter to // existing interval graph. This takes an additional boolean parameter to
@ -62,7 +62,7 @@ public:
IntervalPartition(IntervalPartition &I, bool); IntervalPartition(IntervalPartition &I, bool);
// print - Show contents in human readable format... // print - Show contents in human readable format...
virtual void print(raw_ostream &O, const Module* = 0) const; void print(raw_ostream &O, const Module* = 0) const override;
// getRootInterval() - Return the root interval that contains the starting // getRootInterval() - Return the root interval that contains the starting
// block of the function. // block of the function.
@ -81,7 +81,7 @@ public:
} }
// getAnalysisUsage - Implement the Pass API // getAnalysisUsage - Implement the Pass API
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
} }
@ -89,7 +89,7 @@ public:
const std::vector<Interval*> &getIntervals() const { return Intervals; } const std::vector<Interval*> &getIntervals() const { return Intervals; }
// releaseMemory - Reset state back to before function was analyzed // releaseMemory - Reset state back to before function was analyzed
void releaseMemory(); void releaseMemory() override;
private: private:
// addIntervalToPartition - Add an interval to the internal list of intervals, // addIntervalToPartition - Add an interval to the internal list of intervals,

View File

@ -69,10 +69,10 @@ public:
void eraseBlock(BasicBlock *BB); void eraseBlock(BasicBlock *BB);
// Implementation boilerplate. // Implementation boilerplate.
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
virtual void releaseMemory(); void releaseMemory() override;
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
}; };
} // end namespace llvm } // end namespace llvm

View File

@ -38,17 +38,17 @@ namespace llvm {
~LibCallAliasAnalysis(); ~LibCallAliasAnalysis();
ModRefResult getModRefInfo(ImmutableCallSite CS, ModRefResult getModRefInfo(ImmutableCallSite CS,
const Location &Loc); const Location &Loc) override;
ModRefResult getModRefInfo(ImmutableCallSite CS1, ModRefResult getModRefInfo(ImmutableCallSite CS1,
ImmutableCallSite CS2) { ImmutableCallSite CS2) override {
// TODO: Could compare two direct calls against each other if we cared to. // TODO: Could compare two direct calls against each other if we cared to.
return AliasAnalysis::getModRefInfo(CS1, CS2); return AliasAnalysis::getModRefInfo(CS1, CS2);
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
virtual bool runOnFunction(Function &F) { bool runOnFunction(Function &F) override {
InitializeAliasAnalysis(this); // set up super class InitializeAliasAnalysis(this); // set up super class
return false; return false;
} }
@ -57,7 +57,7 @@ namespace llvm {
/// an analysis interface through multiple inheritance. If needed, it /// an analysis interface through multiple inheritance. If needed, it
/// should override this to adjust the this pointer as needed for the /// should override this to adjust the this pointer as needed for the
/// specified pass info. /// specified pass info.
virtual void *getAdjustedAnalysisPointer(const void *PI) { void *getAdjustedAnalysisPointer(const void *PI) override {
if (PI == &AliasAnalysis::ID) if (PI == &AliasAnalysis::ID)
return (AliasAnalysis*)this; return (AliasAnalysis*)this;
return this; return this;

View File

@ -654,15 +654,15 @@ public:
/// runOnFunction - Calculate the natural loop information. /// runOnFunction - Calculate the natural loop information.
/// ///
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void verifyAnalysis() const; void verifyAnalysis() const override;
virtual void releaseMemory() { LI.releaseMemory(); } void releaseMemory() override { LI.releaseMemory(); }
virtual void print(raw_ostream &O, const Module* M = 0) const; void print(raw_ostream &O, const Module* M = 0) const override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
/// removeLoop - This removes the specified top-level loop from this loop info /// removeLoop - This removes the specified top-level loop from this loop info
/// object. The loop is not deleted, as it will presumably be inserted into /// object. The loop is not deleted, as it will presumably be inserted into

View File

@ -32,7 +32,8 @@ public:
/// getPrinterPass - Get a pass to print the function corresponding /// getPrinterPass - Get a pass to print the function corresponding
/// to a Loop. /// to a Loop.
Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const; Pass *createPrinterPass(raw_ostream &O,
const std::string &Banner) const override;
// runOnLoop - This method should be implemented by the subclass to perform // runOnLoop - This method should be implemented by the subclass to perform
// whatever action is necessary for the specified Loop. // whatever action is necessary for the specified Loop.
@ -56,14 +57,13 @@ public:
// LPPassManager passes. In such case, pop LPPassManager from the // LPPassManager passes. In such case, pop LPPassManager from the
// stack. This will force assignPassManager() to create new // stack. This will force assignPassManager() to create new
// LPPassManger as expected. // LPPassManger as expected.
void preparePassManager(PMStack &PMS); void preparePassManager(PMStack &PMS) override;
/// Assign pass manager to manage this pass /// Assign pass manager to manage this pass
virtual void assignPassManager(PMStack &PMS, void assignPassManager(PMStack &PMS, PassManagerType PMT) override;
PassManagerType PMT);
/// Return what kind of Pass Manager can manage this pass. /// Return what kind of Pass Manager can manage this pass.
virtual PassManagerType getPotentialPassManagerType() const { PassManagerType getPotentialPassManagerType() const override {
return PMT_LoopPassManager; return PMT_LoopPassManager;
} }
@ -95,21 +95,21 @@ public:
/// run - Execute all of the passes scheduled for execution. Keep track of /// 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. /// whether any of the passes modifies the module, and if so, return true.
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
/// Pass Manager itself does not invalidate any analysis info. /// Pass Manager itself does not invalidate any analysis info.
// LPPassManager needs LoopInfo. // LPPassManager needs LoopInfo.
void getAnalysisUsage(AnalysisUsage &Info) const; void getAnalysisUsage(AnalysisUsage &Info) const override;
virtual const char *getPassName() const { const char *getPassName() const override {
return "Loop Pass Manager"; return "Loop Pass Manager";
} }
virtual PMDataManager *getAsPMDataManager() { return this; } PMDataManager *getAsPMDataManager() override { return this; }
virtual Pass *getAsPass() { return this; } Pass *getAsPass() override { return this; }
/// Print passes managed by this manager /// Print passes managed by this manager
void dumpPassStructure(unsigned Offset); void dumpPassStructure(unsigned Offset) override;
LoopPass *getContainedPass(unsigned N) { LoopPass *getContainedPass(unsigned N) {
assert(N < PassVector.size() && "Pass number out of range!"); assert(N < PassVector.size() && "Pass number out of range!");
@ -117,7 +117,7 @@ public:
return LP; return LP;
} }
virtual PassManagerType getPassManagerType() const { PassManagerType getPassManagerType() const override {
return PMT_LoopPassManager; return PMT_LoopPassManager;
} }

View File

@ -332,15 +332,15 @@ namespace llvm {
static char ID; static char ID;
/// Pass Implementation stuff. This doesn't do any analysis eagerly. /// Pass Implementation stuff. This doesn't do any analysis eagerly.
bool runOnFunction(Function &); bool runOnFunction(Function &) override;
/// Clean up memory in between runs /// Clean up memory in between runs
void releaseMemory(); void releaseMemory() override;
/// getAnalysisUsage - Does not modify anything. It uses Value Numbering /// getAnalysisUsage - Does not modify anything. It uses Value Numbering
/// and Alias Analysis. /// and Alias Analysis.
/// ///
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
/// getDependency - Return the instruction on which a memory operation /// getDependency - Return the instruction on which a memory operation
/// depends. See the class comment for more details. It is illegal to call /// depends. See the class comment for more details. It is illegal to call

View File

@ -32,9 +32,9 @@ struct PostDominatorTree : public FunctionPass {
~PostDominatorTree(); ~PostDominatorTree();
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
} }
@ -85,11 +85,11 @@ struct PostDominatorTree : public FunctionPass {
DT->getDescendants(R, Result); DT->getDescendants(R, Result);
} }
virtual void releaseMemory() { void releaseMemory() override {
DT->releaseMemory(); DT->releaseMemory();
} }
virtual void print(raw_ostream &OS, const Module*) const; void print(raw_ostream &OS, const Module*) const override;
}; };
FunctionPass* createPostDomTree(); FunctionPass* createPostDomTree();

View File

@ -648,7 +648,7 @@ class RegionInfo : public FunctionPass {
// Calculate - detecte all regions in function and build the region tree. // Calculate - detecte all regions in function and build the region tree.
void Calculate(Function& F); void Calculate(Function& F);
void releaseMemory(); void releaseMemory() override;
// updateStatistics - Update statistic about created regions. // updateStatistics - Update statistic about created regions.
void updateStatistics(Region *R); void updateStatistics(Region *R);
@ -665,10 +665,10 @@ public:
/// @name FunctionPass interface /// @name FunctionPass interface
//@{ //@{
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
virtual void print(raw_ostream &OS, const Module *) const; void print(raw_ostream &OS, const Module *) const override;
virtual void verifyAnalysis() const; void verifyAnalysis() const override;
//@} //@}
/// @brief Get the smallest region that contains a BasicBlock. /// @brief Get the smallest region that contains a BasicBlock.

View File

@ -55,7 +55,8 @@ public:
/// @param Banner The banner to separate different printed passes. /// @param Banner The banner to separate different printed passes.
/// ///
/// @return The pass to print the LLVM IR in the region. /// @return The pass to print the LLVM IR in the region.
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::doInitialization;
using llvm::Pass::doFinalization; using llvm::Pass::doFinalization;
@ -68,12 +69,12 @@ public:
/// @name PassManager API /// @name PassManager API
/// ///
//@{ //@{
void preparePassManager(PMStack &PMS); void preparePassManager(PMStack &PMS) override;
virtual void assignPassManager(PMStack &PMS, void assignPassManager(PMStack &PMS,
PassManagerType PMT = PMT_RegionPassManager); PassManagerType PMT = PMT_RegionPassManager) override;
virtual PassManagerType getPotentialPassManagerType() const { PassManagerType getPotentialPassManagerType() const override {
return PMT_RegionPassManager; return PMT_RegionPassManager;
} }
//@} //@}
@ -94,21 +95,21 @@ public:
/// @brief Execute all of the passes scheduled for execution. /// @brief Execute all of the passes scheduled for execution.
/// ///
/// @return True if any of the passes modifies the function. /// @return True if any of the passes modifies the function.
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
/// Pass Manager itself does not invalidate any analysis info. /// Pass Manager itself does not invalidate any analysis info.
/// RGPassManager needs RegionInfo. /// RGPassManager needs RegionInfo.
void getAnalysisUsage(AnalysisUsage &Info) const; void getAnalysisUsage(AnalysisUsage &Info) const override;
virtual const char *getPassName() const { const char *getPassName() const override {
return "Region Pass Manager"; return "Region Pass Manager";
} }
virtual PMDataManager *getAsPMDataManager() { return this; } PMDataManager *getAsPMDataManager() override { return this; }
virtual Pass *getAsPass() { return this; } Pass *getAsPass() override { return this; }
/// @brief Print passes managed by this manager. /// @brief Print passes managed by this manager.
void dumpPassStructure(unsigned Offset); void dumpPassStructure(unsigned Offset) override;
/// @brief Get passes contained by this manager. /// @brief Get passes contained by this manager.
Pass *getContainedPass(unsigned N) { Pass *getContainedPass(unsigned N) {
@ -117,7 +118,7 @@ public:
return FP; return FP;
} }
virtual PassManagerType getPassManagerType() const { PassManagerType getPassManagerType() const override {
return PMT_RegionPassManager; return PMT_RegionPassManager;
} }
}; };

View File

@ -207,8 +207,8 @@ namespace llvm {
/// notified whenever a Value is deleted. /// notified whenever a Value is deleted.
class SCEVCallbackVH : public CallbackVH { class SCEVCallbackVH : public CallbackVH {
ScalarEvolution *SE; ScalarEvolution *SE;
virtual void deleted(); void deleted() override;
virtual void allUsesReplacedWith(Value *New); void allUsesReplacedWith(Value *New) override;
public: public:
SCEVCallbackVH(Value *V, ScalarEvolution *SE = 0); SCEVCallbackVH(Value *V, ScalarEvolution *SE = 0);
}; };
@ -894,11 +894,11 @@ namespace llvm {
/// indirect operand. /// indirect operand.
bool hasOperand(const SCEV *S, const SCEV *Op) const; bool hasOperand(const SCEV *S, const SCEV *Op) const;
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void releaseMemory(); void releaseMemory() override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
virtual void print(raw_ostream &OS, const Module* = 0) const; void print(raw_ostream &OS, const Module* = 0) const override;
virtual void verifyAnalysis() const; void verifyAnalysis() const override;
private: private:
/// Compute the backedge taken count knowing the interval difference, the /// Compute the backedge taken count knowing the interval difference, the

View File

@ -410,8 +410,8 @@ namespace llvm {
friend class ScalarEvolution; friend class ScalarEvolution;
// Implement CallbackVH. // Implement CallbackVH.
virtual void deleted(); void deleted() override;
virtual void allUsesReplacedWith(Value *New); void allUsesReplacedWith(Value *New) override;
/// SE - The parent ScalarEvolution value. This is used to update /// SE - The parent ScalarEvolution value. This is used to update
/// the parent's maps when the value associated with a SCEVUnknown /// the parent's maps when the value associated with a SCEVUnknown

View File

@ -281,7 +281,7 @@ template <typename IRUnitT, typename PassT, typename ResultT>
struct AnalysisResultModel<IRUnitT, PassT, ResultT, struct AnalysisResultModel<IRUnitT, PassT, ResultT,
false> : AnalysisResultConcept<IRUnitT> { false> : AnalysisResultConcept<IRUnitT> {
AnalysisResultModel(ResultT Result) : Result(std::move(Result)) {} AnalysisResultModel(ResultT Result) : Result(std::move(Result)) {}
virtual AnalysisResultModel *clone() { AnalysisResultModel *clone() override {
return new AnalysisResultModel(Result); return new AnalysisResultModel(Result);
} }
@ -290,7 +290,7 @@ struct AnalysisResultModel<IRUnitT, PassT, ResultT,
// FIXME: We should actually use two different concepts for analysis results // FIXME: We should actually use two different concepts for analysis results
// rather than two different models, and avoid the indirect function call for // rather than two different models, and avoid the indirect function call for
// ones that use the trivial behavior. // ones that use the trivial behavior.
virtual bool invalidate(IRUnitT, const PreservedAnalyses &PA) { bool invalidate(IRUnitT, const PreservedAnalyses &PA) override {
return !PA.preserved(PassT::ID()); return !PA.preserved(PassT::ID());
} }

View File

@ -370,9 +370,9 @@ namespace {
CapturesBefore(const Instruction *I, DominatorTree *DT) CapturesBefore(const Instruction *I, DominatorTree *DT)
: BeforeHere(I), DT(DT), Captured(false) {} : BeforeHere(I), DT(DT), Captured(false) {}
void tooManyUses() { Captured = true; } void tooManyUses() override { Captured = true; }
bool shouldExplore(Use *U) { bool shouldExplore(Use *U) override {
Instruction *I = cast<Instruction>(U->getUser()); Instruction *I = cast<Instruction>(U->getUser());
BasicBlock *BB = I->getParent(); BasicBlock *BB = I->getParent();
// We explore this usage only if the usage can reach "BeforeHere". // We explore this usage only if the usage can reach "BeforeHere".
@ -388,7 +388,7 @@ namespace {
return true; return true;
} }
bool captured(Use *U) { bool captured(Use *U) override {
Instruction *I = cast<Instruction>(U->getUser()); Instruction *I = cast<Instruction>(U->getUser());
BasicBlock *BB = I->getParent(); BasicBlock *BB = I->getParent();
// Same logic as in shouldExplore. // Same logic as in shouldExplore.

View File

@ -74,13 +74,13 @@ namespace {
} }
} }
bool runOnModule(Module &M) { bool runOnModule(Module &M) override {
this->M = &M; this->M = &M;
InitializeAliasAnalysis(this); InitializeAliasAnalysis(this);
return false; return false;
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AliasAnalysis::getAnalysisUsage(AU); AliasAnalysis::getAnalysisUsage(AU);
AU.addRequired<AliasAnalysis>(); AU.addRequired<AliasAnalysis>();
AU.setPreservesAll(); AU.setPreservesAll();
@ -90,25 +90,25 @@ namespace {
/// an analysis interface through multiple inheritance. If needed, it /// an analysis interface through multiple inheritance. If needed, it
/// should override this to adjust the this pointer as needed for the /// should override this to adjust the this pointer as needed for the
/// specified pass info. /// specified pass info.
virtual void *getAdjustedAnalysisPointer(AnalysisID PI) { void *getAdjustedAnalysisPointer(AnalysisID PI) override {
if (PI == &AliasAnalysis::ID) if (PI == &AliasAnalysis::ID)
return (AliasAnalysis*)this; return (AliasAnalysis*)this;
return this; return this;
} }
// FIXME: We could count these too... // FIXME: We could count these too...
bool pointsToConstantMemory(const Location &Loc, bool OrLocal) { bool pointsToConstantMemory(const Location &Loc, bool OrLocal) override {
return getAnalysis<AliasAnalysis>().pointsToConstantMemory(Loc, OrLocal); return getAnalysis<AliasAnalysis>().pointsToConstantMemory(Loc, OrLocal);
} }
// Forwarding functions: just delegate to a real AA implementation, counting // Forwarding functions: just delegate to a real AA implementation, counting
// the number of responses... // the number of responses...
AliasResult alias(const Location &LocA, const Location &LocB); AliasResult alias(const Location &LocA, const Location &LocB) override;
ModRefResult getModRefInfo(ImmutableCallSite CS, ModRefResult getModRefInfo(ImmutableCallSite CS,
const Location &Loc); const Location &Loc) override;
ModRefResult getModRefInfo(ImmutableCallSite CS1, ModRefResult getModRefInfo(ImmutableCallSite CS1,
ImmutableCallSite CS2) { ImmutableCallSite CS2) override {
return AliasAnalysis::getModRefInfo(CS1,CS2); return AliasAnalysis::getModRefInfo(CS1,CS2);
} }
}; };

View File

@ -56,12 +56,12 @@ namespace {
initializeAAEvalPass(*PassRegistry::getPassRegistry()); initializeAAEvalPass(*PassRegistry::getPassRegistry());
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<AliasAnalysis>(); AU.addRequired<AliasAnalysis>();
AU.setPreservesAll(); AU.setPreservesAll();
} }
bool doInitialization(Module &M) { bool doInitialization(Module &M) override {
NoAlias = MayAlias = PartialAlias = MustAlias = 0; NoAlias = MayAlias = PartialAlias = MustAlias = 0;
NoModRef = Mod = Ref = ModRef = 0; NoModRef = Mod = Ref = ModRef = 0;
@ -73,8 +73,8 @@ namespace {
return false; return false;
} }
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
bool doFinalization(Module &M); bool doFinalization(Module &M) override;
}; };
} }

View File

@ -43,7 +43,7 @@ namespace {
initializeAliasDebuggerPass(*PassRegistry::getPassRegistry()); initializeAliasDebuggerPass(*PassRegistry::getPassRegistry());
} }
bool runOnModule(Module &M) { bool runOnModule(Module &M) override {
InitializeAliasAnalysis(this); // set up super class InitializeAliasAnalysis(this); // set up super class
for(Module::global_iterator I = M.global_begin(), for(Module::global_iterator I = M.global_begin(),
@ -76,7 +76,7 @@ namespace {
return false; return false;
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AliasAnalysis::getAnalysisUsage(AU); AliasAnalysis::getAnalysisUsage(AU);
AU.setPreservesAll(); // Does not transform code AU.setPreservesAll(); // Does not transform code
} }
@ -85,7 +85,7 @@ namespace {
/// an analysis interface through multiple inheritance. If needed, it /// an analysis interface through multiple inheritance. If needed, it
/// should override this to adjust the this pointer as needed for the /// should override this to adjust the this pointer as needed for the
/// specified pass info. /// specified pass info.
virtual void *getAdjustedAnalysisPointer(AnalysisID PI) { void *getAdjustedAnalysisPointer(AnalysisID PI) override {
if (PI == &AliasAnalysis::ID) if (PI == &AliasAnalysis::ID)
return (AliasAnalysis*)this; return (AliasAnalysis*)this;
return this; return this;
@ -94,7 +94,7 @@ namespace {
//------------------------------------------------ //------------------------------------------------
// Implement the AliasAnalysis API // Implement the AliasAnalysis API
// //
AliasResult alias(const Location &LocA, const Location &LocB) { AliasResult alias(const Location &LocA, const Location &LocB) override {
assert(Vals.find(LocA.Ptr) != Vals.end() && assert(Vals.find(LocA.Ptr) != Vals.end() &&
"Never seen value in AA before"); "Never seen value in AA before");
assert(Vals.find(LocB.Ptr) != Vals.end() && assert(Vals.find(LocB.Ptr) != Vals.end() &&
@ -103,26 +103,26 @@ namespace {
} }
ModRefResult getModRefInfo(ImmutableCallSite CS, ModRefResult getModRefInfo(ImmutableCallSite CS,
const Location &Loc) { const Location &Loc) override {
assert(Vals.find(Loc.Ptr) != Vals.end() && "Never seen value in AA before"); assert(Vals.find(Loc.Ptr) != Vals.end() && "Never seen value in AA before");
return AliasAnalysis::getModRefInfo(CS, Loc); return AliasAnalysis::getModRefInfo(CS, Loc);
} }
ModRefResult getModRefInfo(ImmutableCallSite CS1, ModRefResult getModRefInfo(ImmutableCallSite CS1,
ImmutableCallSite CS2) { ImmutableCallSite CS2) override {
return AliasAnalysis::getModRefInfo(CS1,CS2); return AliasAnalysis::getModRefInfo(CS1,CS2);
} }
bool pointsToConstantMemory(const Location &Loc, bool OrLocal) { bool pointsToConstantMemory(const Location &Loc, bool OrLocal) override {
assert(Vals.find(Loc.Ptr) != Vals.end() && "Never seen value in AA before"); assert(Vals.find(Loc.Ptr) != Vals.end() && "Never seen value in AA before");
return AliasAnalysis::pointsToConstantMemory(Loc, OrLocal); return AliasAnalysis::pointsToConstantMemory(Loc, OrLocal);
} }
virtual void deleteValue(Value *V) { void deleteValue(Value *V) override {
assert(Vals.find(V) != Vals.end() && "Never seen value in AA before"); assert(Vals.find(V) != Vals.end() && "Never seen value in AA before");
AliasAnalysis::deleteValue(V); AliasAnalysis::deleteValue(V);
} }
virtual void copyValue(Value *From, Value *To) { void copyValue(Value *From, Value *To) override {
Vals.insert(To); Vals.insert(To);
AliasAnalysis::copyValue(From, To); AliasAnalysis::copyValue(From, To);
} }

View File

@ -627,12 +627,12 @@ namespace {
initializeAliasSetPrinterPass(*PassRegistry::getPassRegistry()); initializeAliasSetPrinterPass(*PassRegistry::getPassRegistry());
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addRequired<AliasAnalysis>(); AU.addRequired<AliasAnalysis>();
} }
virtual bool runOnFunction(Function &F) { bool runOnFunction(Function &F) override {
Tracker = new AliasSetTracker(getAnalysis<AliasAnalysis>()); Tracker = new AliasSetTracker(getAnalysis<AliasAnalysis>());
for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I)

View File

@ -444,17 +444,16 @@ namespace {
initializeBasicAliasAnalysisPass(*PassRegistry::getPassRegistry()); initializeBasicAliasAnalysisPass(*PassRegistry::getPassRegistry());
} }
virtual void initializePass() { void initializePass() override {
InitializeAliasAnalysis(this); InitializeAliasAnalysis(this);
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<AliasAnalysis>(); AU.addRequired<AliasAnalysis>();
AU.addRequired<TargetLibraryInfo>(); AU.addRequired<TargetLibraryInfo>();
} }
virtual AliasResult alias(const Location &LocA, AliasResult alias(const Location &LocA, const Location &LocB) override {
const Location &LocB) {
assert(AliasCache.empty() && "AliasCache must be cleared after use!"); assert(AliasCache.empty() && "AliasCache must be cleared after use!");
assert(notDifferentParent(LocA.Ptr, LocB.Ptr) && assert(notDifferentParent(LocA.Ptr, LocB.Ptr) &&
"BasicAliasAnalysis doesn't support interprocedural queries."); "BasicAliasAnalysis doesn't support interprocedural queries.");
@ -469,32 +468,32 @@ namespace {
return Alias; return Alias;
} }
virtual ModRefResult getModRefInfo(ImmutableCallSite CS, ModRefResult getModRefInfo(ImmutableCallSite CS,
const Location &Loc); const Location &Loc) override;
virtual ModRefResult getModRefInfo(ImmutableCallSite CS1, ModRefResult getModRefInfo(ImmutableCallSite CS1,
ImmutableCallSite CS2) { ImmutableCallSite CS2) override {
// The AliasAnalysis base class has some smarts, lets use them. // The AliasAnalysis base class has some smarts, lets use them.
return AliasAnalysis::getModRefInfo(CS1, CS2); return AliasAnalysis::getModRefInfo(CS1, CS2);
} }
/// pointsToConstantMemory - Chase pointers until we find a (constant /// pointsToConstantMemory - Chase pointers until we find a (constant
/// global) or not. /// global) or not.
virtual bool pointsToConstantMemory(const Location &Loc, bool OrLocal); bool pointsToConstantMemory(const Location &Loc, bool OrLocal) override;
/// getModRefBehavior - Return the behavior when calling the given /// getModRefBehavior - Return the behavior when calling the given
/// call site. /// call site.
virtual ModRefBehavior getModRefBehavior(ImmutableCallSite CS); ModRefBehavior getModRefBehavior(ImmutableCallSite CS) override;
/// getModRefBehavior - Return the behavior when calling the given function. /// getModRefBehavior - Return the behavior when calling the given function.
/// For use when the call site is not known. /// For use when the call site is not known.
virtual ModRefBehavior getModRefBehavior(const Function *F); ModRefBehavior getModRefBehavior(const Function *F) override;
/// getAdjustedAnalysisPointer - This method is used when a pass implements /// getAdjustedAnalysisPointer - This method is used when a pass implements
/// an analysis interface through multiple inheritance. If needed, it /// an analysis interface through multiple inheritance. If needed, it
/// should override this to adjust the this pointer as needed for the /// should override this to adjust the this pointer as needed for the
/// specified pass info. /// specified pass info.
virtual void *getAdjustedAnalysisPointer(const void *ID) { void *getAdjustedAnalysisPointer(const void *ID) override {
if (ID == &AliasAnalysis::ID) if (ID == &AliasAnalysis::ID)
return (AliasAnalysis*)this; return (AliasAnalysis*)this;
return this; return this;

View File

@ -28,14 +28,14 @@ namespace {
initializeCFGOnlyViewerPass(*PassRegistry::getPassRegistry()); initializeCFGOnlyViewerPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnFunction(Function &F) { bool runOnFunction(Function &F) override {
F.viewCFG(); F.viewCFG();
return false; return false;
} }
void print(raw_ostream &OS, const Module* = 0) const {} void print(raw_ostream &OS, const Module* = 0) const override {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
} }
}; };
@ -51,14 +51,14 @@ namespace {
initializeCFGOnlyViewerPass(*PassRegistry::getPassRegistry()); initializeCFGOnlyViewerPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnFunction(Function &F) { bool runOnFunction(Function &F) override {
F.viewCFGOnly(); F.viewCFGOnly();
return false; return false;
} }
void print(raw_ostream &OS, const Module* = 0) const {} void print(raw_ostream &OS, const Module* = 0) const override {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
} }
}; };
@ -75,7 +75,7 @@ namespace {
initializeCFGPrinterPass(*PassRegistry::getPassRegistry()); initializeCFGPrinterPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnFunction(Function &F) { bool runOnFunction(Function &F) override {
std::string Filename = "cfg." + F.getName().str() + ".dot"; std::string Filename = "cfg." + F.getName().str() + ".dot";
errs() << "Writing '" << Filename << "'..."; errs() << "Writing '" << Filename << "'...";
@ -90,9 +90,9 @@ namespace {
return false; return false;
} }
void print(raw_ostream &OS, const Module* = 0) const {} void print(raw_ostream &OS, const Module* = 0) const override {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
} }
}; };
@ -108,8 +108,8 @@ namespace {
CFGOnlyPrinter() : FunctionPass(ID) { CFGOnlyPrinter() : FunctionPass(ID) {
initializeCFGOnlyPrinterPass(*PassRegistry::getPassRegistry()); initializeCFGOnlyPrinterPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnFunction(Function &F) { bool runOnFunction(Function &F) override {
std::string Filename = "cfg." + F.getName().str() + ".dot"; std::string Filename = "cfg." + F.getName().str() + ".dot";
errs() << "Writing '" << Filename << "'..."; errs() << "Writing '" << Filename << "'...";
@ -123,9 +123,9 @@ namespace {
errs() << "\n"; errs() << "\n";
return false; return false;
} }
void print(raw_ostream &OS, const Module* = 0) const {} void print(raw_ostream &OS, const Module* = 0) const override {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
} }
}; };

View File

@ -35,9 +35,9 @@ namespace {
explicit SimpleCaptureTracker(bool ReturnCaptures) explicit SimpleCaptureTracker(bool ReturnCaptures)
: ReturnCaptures(ReturnCaptures), Captured(false) {} : ReturnCaptures(ReturnCaptures), Captured(false) {}
void tooManyUses() { Captured = true; } void tooManyUses() override { Captured = true; }
bool captured(Use *U) { bool captured(Use *U) override {
if (isa<ReturnInst>(U->getUser()) && !ReturnCaptures) if (isa<ReturnInst>(U->getUser()) && !ReturnCaptures)
return false; return false;

View File

@ -53,9 +53,9 @@ namespace {
unsigned getInstructionCost(const Instruction *I) const; unsigned getInstructionCost(const Instruction *I) const;
private: private:
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void print(raw_ostream &OS, const Module*) const; void print(raw_ostream &OS, const Module*) const override;
/// The function that we analyze. /// The function that we analyze.
Function *F; Function *F;

View File

@ -49,9 +49,9 @@ public:
Delinearization() : FunctionPass(ID) { Delinearization() : FunctionPass(ID) {
initializeDelinearizationPass(*PassRegistry::getPassRegistry()); initializeDelinearizationPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
virtual void print(raw_ostream &O, const Module *M = 0) const; void print(raw_ostream &O, const Module *M = 0) const override;
}; };
} // end anonymous namespace } // end anonymous namespace

View File

@ -49,7 +49,7 @@ public:
/// run - Execute all of the passes scheduled for execution. Keep track of /// 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. /// whether any of the passes modifies the module, and if so, return true.
bool runOnModule(Module &M); bool runOnModule(Module &M) override;
using ModulePass::doInitialization; using ModulePass::doInitialization;
using ModulePass::doFinalization; using ModulePass::doFinalization;
@ -58,21 +58,21 @@ public:
bool doFinalization(CallGraph &CG); bool doFinalization(CallGraph &CG);
/// Pass Manager itself does not invalidate any analysis info. /// Pass Manager itself does not invalidate any analysis info.
void getAnalysisUsage(AnalysisUsage &Info) const { void getAnalysisUsage(AnalysisUsage &Info) const override {
// CGPassManager walks SCC and it needs CallGraph. // CGPassManager walks SCC and it needs CallGraph.
Info.addRequired<CallGraphWrapperPass>(); Info.addRequired<CallGraphWrapperPass>();
Info.setPreservesAll(); Info.setPreservesAll();
} }
virtual const char *getPassName() const { const char *getPassName() const override {
return "CallGraph Pass Manager"; return "CallGraph Pass Manager";
} }
virtual PMDataManager *getAsPMDataManager() { return this; } PMDataManager *getAsPMDataManager() override { return this; }
virtual Pass *getAsPass() { return this; } Pass *getAsPass() override { return this; }
// Print passes managed by this manager // Print passes managed by this manager
void dumpPassStructure(unsigned Offset) { void dumpPassStructure(unsigned Offset) override {
errs().indent(Offset*2) << "Call Graph SCC Pass Manager\n"; errs().indent(Offset*2) << "Call Graph SCC Pass Manager\n";
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
Pass *P = getContainedPass(Index); Pass *P = getContainedPass(Index);
@ -86,7 +86,7 @@ public:
return static_cast<Pass *>(PassVector[N]); return static_cast<Pass *>(PassVector[N]);
} }
virtual PassManagerType getPassManagerType() const { PassManagerType getPassManagerType() const override {
return PMT_CallGraphPassManager; return PMT_CallGraphPassManager;
} }
@ -590,12 +590,12 @@ namespace {
static char ID; static char ID;
PrintCallGraphPass(const std::string &B, raw_ostream &o) PrintCallGraphPass(const std::string &B, raw_ostream &o)
: CallGraphSCCPass(ID), Banner(B), Out(o) {} : CallGraphSCCPass(ID), Banner(B), Out(o) {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
} }
bool runOnSCC(CallGraphSCC &SCC) { bool runOnSCC(CallGraphSCC &SCC) override {
Out << Banner; Out << Banner;
for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I)
(*I)->getFunction()->print(Out); (*I)->getFunction()->print(Out);

View File

@ -94,7 +94,7 @@ namespace {
initializeGlobalsModRefPass(*PassRegistry::getPassRegistry()); initializeGlobalsModRefPass(*PassRegistry::getPassRegistry());
} }
bool runOnModule(Module &M) { bool runOnModule(Module &M) override {
InitializeAliasAnalysis(this); InitializeAliasAnalysis(this);
// Find non-addr taken globals. // Find non-addr taken globals.
@ -105,7 +105,7 @@ namespace {
return false; return false;
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AliasAnalysis::getAnalysisUsage(AU); AliasAnalysis::getAnalysisUsage(AU);
AU.addRequired<CallGraphWrapperPass>(); AU.addRequired<CallGraphWrapperPass>();
AU.setPreservesAll(); // Does not transform code AU.setPreservesAll(); // Does not transform code
@ -114,18 +114,18 @@ namespace {
//------------------------------------------------ //------------------------------------------------
// Implement the AliasAnalysis API // Implement the AliasAnalysis API
// //
AliasResult alias(const Location &LocA, const Location &LocB); AliasResult alias(const Location &LocA, const Location &LocB) override;
ModRefResult getModRefInfo(ImmutableCallSite CS, ModRefResult getModRefInfo(ImmutableCallSite CS,
const Location &Loc); const Location &Loc) override;
ModRefResult getModRefInfo(ImmutableCallSite CS1, ModRefResult getModRefInfo(ImmutableCallSite CS1,
ImmutableCallSite CS2) { ImmutableCallSite CS2) override {
return AliasAnalysis::getModRefInfo(CS1, CS2); return AliasAnalysis::getModRefInfo(CS1, CS2);
} }
/// getModRefBehavior - Return the behavior of the specified function if /// getModRefBehavior - Return the behavior of the specified function if
/// called from the specified call site. The call site may be null in which /// called from the specified call site. The call site may be null in which
/// case the most generic behavior of this function should be returned. /// case the most generic behavior of this function should be returned.
ModRefBehavior getModRefBehavior(const Function *F) { ModRefBehavior getModRefBehavior(const Function *F) override {
ModRefBehavior Min = UnknownModRefBehavior; ModRefBehavior Min = UnknownModRefBehavior;
if (FunctionRecord *FR = getFunctionInfo(F)) { if (FunctionRecord *FR = getFunctionInfo(F)) {
@ -141,7 +141,7 @@ namespace {
/// getModRefBehavior - Return the behavior of the specified function if /// getModRefBehavior - Return the behavior of the specified function if
/// called from the specified call site. The call site may be null in which /// called from the specified call site. The call site may be null in which
/// case the most generic behavior of this function should be returned. /// case the most generic behavior of this function should be returned.
ModRefBehavior getModRefBehavior(ImmutableCallSite CS) { ModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
ModRefBehavior Min = UnknownModRefBehavior; ModRefBehavior Min = UnknownModRefBehavior;
if (const Function* F = CS.getCalledFunction()) if (const Function* F = CS.getCalledFunction())
@ -155,15 +155,15 @@ namespace {
return ModRefBehavior(AliasAnalysis::getModRefBehavior(CS) & Min); return ModRefBehavior(AliasAnalysis::getModRefBehavior(CS) & Min);
} }
virtual void deleteValue(Value *V); void deleteValue(Value *V) override;
virtual void copyValue(Value *From, Value *To); void copyValue(Value *From, Value *To) override;
virtual void addEscapingUse(Use &U); void addEscapingUse(Use &U) override;
/// getAdjustedAnalysisPointer - This method is used when a pass implements /// getAdjustedAnalysisPointer - This method is used when a pass implements
/// an analysis interface through multiple inheritance. If needed, it /// an analysis interface through multiple inheritance. If needed, it
/// should override this to adjust the this pointer as needed for the /// should override this to adjust the this pointer as needed for the
/// specified pass info. /// specified pass info.
virtual void *getAdjustedAnalysisPointer(AnalysisID PI) { void *getAdjustedAnalysisPointer(AnalysisID PI) override {
if (PI == &AliasAnalysis::ID) if (PI == &AliasAnalysis::ID)
return (AliasAnalysis*)this; return (AliasAnalysis*)this;
return this; return this;

View File

@ -55,12 +55,12 @@ namespace {
initializeInstCountPass(*PassRegistry::getPassRegistry()); initializeInstCountPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
} }
virtual void print(raw_ostream &O, const Module *M) const {} void print(raw_ostream &O, const Module *M) const override {}
}; };
} }

View File

@ -302,9 +302,9 @@ namespace {
LVIValueHandle(Value *V, LazyValueInfoCache *P) LVIValueHandle(Value *V, LazyValueInfoCache *P)
: CallbackVH(V), Parent(P) { } : CallbackVH(V), Parent(P) { }
void deleted(); void deleted() override;
void allUsesReplacedWith(Value *V) { void allUsesReplacedWith(Value *V) override {
deleted(); deleted();
} }
}; };

View File

@ -113,15 +113,15 @@ namespace {
initializeLintPass(*PassRegistry::getPassRegistry()); initializeLintPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addRequired<AliasAnalysis>(); AU.addRequired<AliasAnalysis>();
AU.addRequired<TargetLibraryInfo>(); AU.addRequired<TargetLibraryInfo>();
AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<DominatorTreeWrapperPass>();
} }
virtual void print(raw_ostream &O, const Module *M) const {} void print(raw_ostream &O, const Module *M) const override {}
void WriteValue(const Value *V) { void WriteValue(const Value *V) {
if (!V) return; if (!V) return;

View File

@ -33,11 +33,11 @@ public:
PrintLoopPass(const std::string &B, raw_ostream &o) PrintLoopPass(const std::string &B, raw_ostream &o)
: LoopPass(ID), Banner(B), Out(o) {} : LoopPass(ID), Banner(B), Out(o) {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
} }
bool runOnLoop(Loop *L, LPPassManager &) { bool runOnLoop(Loop *L, LPPassManager &) override {
Out << Banner; Out << Banner;
for (Loop::block_iterator b = L->block_begin(), be = L->block_end(); for (Loop::block_iterator b = L->block_begin(), be = L->block_end();
b != be; b != be;

View File

@ -44,17 +44,17 @@ namespace {
initializeMemDepPrinterPass(*PassRegistry::getPassRegistry()); initializeMemDepPrinterPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
void print(raw_ostream &OS, const Module * = 0) const; void print(raw_ostream &OS, const Module * = 0) const override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequiredTransitive<AliasAnalysis>(); AU.addRequiredTransitive<AliasAnalysis>();
AU.addRequiredTransitive<MemoryDependenceAnalysis>(); AU.addRequiredTransitive<MemoryDependenceAnalysis>();
AU.setPreservesAll(); AU.setPreservesAll();
} }
virtual void releaseMemory() { void releaseMemory() override {
Deps.clear(); Deps.clear();
F = 0; F = 0;
} }

View File

@ -33,12 +33,12 @@ namespace {
initializeModuleDebugInfoPrinterPass(*PassRegistry::getPassRegistry()); initializeModuleDebugInfoPrinterPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnModule(Module &M); bool runOnModule(Module &M) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
} }
virtual void print(raw_ostream &O, const Module *M) const; void print(raw_ostream &O, const Module *M) const override;
}; };
} }

View File

@ -30,49 +30,47 @@ namespace {
initializeNoAAPass(*PassRegistry::getPassRegistry()); initializeNoAAPass(*PassRegistry::getPassRegistry());
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {}
}
virtual void initializePass() { void initializePass() override {
// Note: NoAA does not call InitializeAliasAnalysis because it's // Note: NoAA does not call InitializeAliasAnalysis because it's
// special and does not support chaining. // special and does not support chaining.
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>(); DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
DL = DLP ? &DLP->getDataLayout() : 0; DL = DLP ? &DLP->getDataLayout() : 0;
} }
virtual AliasResult alias(const Location &LocA, const Location &LocB) { AliasResult alias(const Location &LocA, const Location &LocB) override {
return MayAlias; return MayAlias;
} }
virtual ModRefBehavior getModRefBehavior(ImmutableCallSite CS) { ModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
return UnknownModRefBehavior; return UnknownModRefBehavior;
} }
virtual ModRefBehavior getModRefBehavior(const Function *F) { ModRefBehavior getModRefBehavior(const Function *F) override {
return UnknownModRefBehavior; return UnknownModRefBehavior;
} }
virtual bool pointsToConstantMemory(const Location &Loc, bool pointsToConstantMemory(const Location &Loc, bool OrLocal) override {
bool OrLocal) {
return false; return false;
} }
virtual ModRefResult getModRefInfo(ImmutableCallSite CS, ModRefResult getModRefInfo(ImmutableCallSite CS,
const Location &Loc) { const Location &Loc) override {
return ModRef; return ModRef;
} }
virtual ModRefResult getModRefInfo(ImmutableCallSite CS1, ModRefResult getModRefInfo(ImmutableCallSite CS1,
ImmutableCallSite CS2) { ImmutableCallSite CS2) override {
return ModRef; return ModRef;
} }
virtual void deleteValue(Value *V) {} void deleteValue(Value *V) override {}
virtual void copyValue(Value *From, Value *To) {} void copyValue(Value *From, Value *To) override {}
virtual void addEscapingUse(Use &U) {} void addEscapingUse(Use &U) override {}
/// getAdjustedAnalysisPointer - This method is used when a pass implements /// getAdjustedAnalysisPointer - This method is used when a pass implements
/// an analysis interface through multiple inheritance. If needed, it /// an analysis interface through multiple inheritance. If needed, it
/// should override this to adjust the this pointer as needed for the /// should override this to adjust the this pointer as needed for the
/// specified pass info. /// specified pass info.
virtual void *getAdjustedAnalysisPointer(const void *ID) { void *getAdjustedAnalysisPointer(const void *ID) override {
if (ID == &AliasAnalysis::ID) if (ID == &AliasAnalysis::ID)
return (AliasAnalysis*)this; return (AliasAnalysis*)this;
return this; return this;

View File

@ -189,11 +189,11 @@ public:
PrintRegionPass(const std::string &B, raw_ostream &o) PrintRegionPass(const std::string &B, raw_ostream &o)
: RegionPass(ID), Banner(B), Out(o) {} : RegionPass(ID), Banner(B), Out(o) {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
} }
virtual bool runOnRegion(Region *R, RGPassManager &RGM) { bool runOnRegion(Region *R, RGPassManager &RGM) override {
Out << Banner; Out << Banner;
for (const auto &BB : R->blocks()) for (const auto &BB : R->blocks())
BB->print(Out); BB->print(Out);

View File

@ -43,16 +43,16 @@ namespace {
/// an analysis interface through multiple inheritance. If needed, it /// an analysis interface through multiple inheritance. If needed, it
/// should override this to adjust the this pointer as needed for the /// should override this to adjust the this pointer as needed for the
/// specified pass info. /// specified pass info.
virtual void *getAdjustedAnalysisPointer(AnalysisID PI) { void *getAdjustedAnalysisPointer(AnalysisID PI) override {
if (PI == &AliasAnalysis::ID) if (PI == &AliasAnalysis::ID)
return (AliasAnalysis*)this; return (AliasAnalysis*)this;
return this; return this;
} }
private: private:
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual AliasResult alias(const Location &LocA, const Location &LocB); AliasResult alias(const Location &LocA, const Location &LocB) override;
Value *GetBaseValue(const SCEV *S); Value *GetBaseValue(const SCEV *S);
}; };

View File

@ -281,7 +281,7 @@ namespace {
initializeTypeBasedAliasAnalysisPass(*PassRegistry::getPassRegistry()); initializeTypeBasedAliasAnalysisPass(*PassRegistry::getPassRegistry());
} }
virtual void initializePass() { void initializePass() override {
InitializeAliasAnalysis(this); InitializeAliasAnalysis(this);
} }
@ -289,7 +289,7 @@ namespace {
/// an analysis interface through multiple inheritance. If needed, it /// an analysis interface through multiple inheritance. If needed, it
/// should override this to adjust the this pointer as needed for the /// should override this to adjust the this pointer as needed for the
/// specified pass info. /// specified pass info.
virtual void *getAdjustedAnalysisPointer(const void *PI) { void *getAdjustedAnalysisPointer(const void *PI) override {
if (PI == &AliasAnalysis::ID) if (PI == &AliasAnalysis::ID)
return (AliasAnalysis*)this; return (AliasAnalysis*)this;
return this; return this;
@ -299,15 +299,15 @@ namespace {
bool PathAliases(const MDNode *A, const MDNode *B) const; bool PathAliases(const MDNode *A, const MDNode *B) const;
private: private:
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
virtual AliasResult alias(const Location &LocA, const Location &LocB); AliasResult alias(const Location &LocA, const Location &LocB) override;
virtual bool pointsToConstantMemory(const Location &Loc, bool OrLocal); bool pointsToConstantMemory(const Location &Loc, bool OrLocal) override;
virtual ModRefBehavior getModRefBehavior(ImmutableCallSite CS); ModRefBehavior getModRefBehavior(ImmutableCallSite CS) override;
virtual ModRefBehavior getModRefBehavior(const Function *F); ModRefBehavior getModRefBehavior(const Function *F) override;
virtual ModRefResult getModRefInfo(ImmutableCallSite CS, ModRefResult getModRefInfo(ImmutableCallSite CS,
const Location &Loc); const Location &Loc) override;
virtual ModRefResult getModRefInfo(ImmutableCallSite CS1, ModRefResult getModRefInfo(ImmutableCallSite CS1,
ImmutableCallSite CS2); ImmutableCallSite CS2) override;
}; };
} // End of anonymous namespace } // End of anonymous namespace