[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
This commit is contained in:
Craig Topper
2014-03-08 08:27:28 +00:00
parent 838cb749dc
commit c83e68f732
22 changed files with 204 additions and 201 deletions

View File

@ -205,11 +205,11 @@ template <typename IRUnitT, typename AnalysisManagerT, typename PassT>
struct PassModel<IRUnitT, AnalysisManagerT, PassT, struct PassModel<IRUnitT, AnalysisManagerT, PassT,
true> : PassConcept<IRUnitT, AnalysisManagerT> { true> : PassConcept<IRUnitT, AnalysisManagerT> {
PassModel(PassT Pass) : Pass(std::move(Pass)) {} PassModel(PassT Pass) : Pass(std::move(Pass)) {}
virtual PassModel *clone() { return new PassModel(Pass); } PassModel *clone() override { return new PassModel(Pass); }
virtual PreservedAnalyses run(IRUnitT IR, AnalysisManagerT *AM) { PreservedAnalyses run(IRUnitT IR, AnalysisManagerT *AM) override {
return Pass.run(IR, AM); return Pass.run(IR, AM);
} }
virtual StringRef name() { return PassT::name(); } StringRef name() override { return PassT::name(); }
PassT Pass; PassT Pass;
}; };
@ -219,11 +219,11 @@ template <typename IRUnitT, typename AnalysisManagerT, typename PassT>
struct PassModel<IRUnitT, AnalysisManagerT, PassT, struct PassModel<IRUnitT, AnalysisManagerT, PassT,
false> : PassConcept<IRUnitT, AnalysisManagerT> { false> : PassConcept<IRUnitT, AnalysisManagerT> {
PassModel(PassT Pass) : Pass(std::move(Pass)) {} PassModel(PassT Pass) : Pass(std::move(Pass)) {}
virtual PassModel *clone() { return new PassModel(Pass); } PassModel *clone() override { return new PassModel(Pass); }
virtual PreservedAnalyses run(IRUnitT IR, AnalysisManagerT *AM) { PreservedAnalyses run(IRUnitT IR, AnalysisManagerT *AM) override {
return Pass.run(IR); return Pass.run(IR);
} }
virtual StringRef name() { return PassT::name(); } StringRef name() override { return PassT::name(); }
PassT Pass; PassT Pass;
}; };
@ -303,12 +303,12 @@ template <typename IRUnitT, typename PassT, typename ResultT>
struct AnalysisResultModel<IRUnitT, PassT, ResultT, struct AnalysisResultModel<IRUnitT, PassT, ResultT,
true> : AnalysisResultConcept<IRUnitT> { true> : 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);
} }
/// \brief The model delegates to the \c ResultT method. /// \brief The model delegates to the \c ResultT method.
virtual bool invalidate(IRUnitT IR, const PreservedAnalyses &PA) { bool invalidate(IRUnitT IR, const PreservedAnalyses &PA) override {
return Result.invalidate(IR, PA); return Result.invalidate(IR, PA);
} }
@ -371,7 +371,7 @@ struct AnalysisPassModel<IRUnitT, AnalysisManagerT, PassT,
false> : AnalysisPassConcept<IRUnitT, false> : AnalysisPassConcept<IRUnitT,
AnalysisManagerT> { AnalysisManagerT> {
AnalysisPassModel(PassT Pass) : Pass(std::move(Pass)) {} AnalysisPassModel(PassT Pass) : Pass(std::move(Pass)) {}
virtual AnalysisPassModel *clone() { return new AnalysisPassModel(Pass); } AnalysisPassModel *clone() override { return new AnalysisPassModel(Pass); }
// FIXME: Replace PassT::Result with type traits when we use C++11. // FIXME: Replace PassT::Result with type traits when we use C++11.
typedef AnalysisResultModel<IRUnitT, PassT, typename PassT::Result> typedef AnalysisResultModel<IRUnitT, PassT, typename PassT::Result>
@ -380,7 +380,7 @@ struct AnalysisPassModel<IRUnitT, AnalysisManagerT, PassT,
/// \brief The model delegates to the \c PassT::run method. /// \brief The model delegates to the \c PassT::run method.
/// ///
/// The return is wrapped in an \c AnalysisResultModel. /// The return is wrapped in an \c AnalysisResultModel.
virtual ResultModelT *run(IRUnitT IR, AnalysisManagerT *) { ResultModelT *run(IRUnitT IR, AnalysisManagerT *) override {
return new ResultModelT(Pass.run(IR)); return new ResultModelT(Pass.run(IR));
} }

View File

@ -29,11 +29,11 @@ namespace {
static char ID; // Pass ID, replacement for typeid static char ID; // Pass ID, replacement for typeid
CrashOnCalls() : BasicBlockPass(ID) {} CrashOnCalls() : BasicBlockPass(ID) {}
private: private:
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
} }
bool runOnBasicBlock(BasicBlock &BB) { bool runOnBasicBlock(BasicBlock &BB) override {
for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I) for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I)
if (isa<CallInst>(*I)) if (isa<CallInst>(*I))
abort(); abort();
@ -56,7 +56,7 @@ namespace {
static char ID; // Pass ID, replacement for typeid static char ID; // Pass ID, replacement for typeid
DeleteCalls() : BasicBlockPass(ID) {} DeleteCalls() : BasicBlockPass(ID) {}
private: private:
bool runOnBasicBlock(BasicBlock &BB) { bool runOnBasicBlock(BasicBlock &BB) override {
for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I) for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I)
if (CallInst *CI = dyn_cast<CallInst>(I)) { if (CallInst *CI = dyn_cast<CallInst>(I)) {
if (!CI->use_empty()) if (!CI->use_empty())

View File

@ -52,9 +52,9 @@ namespace llvm {
// running the "Kept" passes fail when run on the output of the "removed" // running the "Kept" passes fail when run on the output of the "removed"
// passes. If we return true, we update the current module of bugpoint. // passes. If we return true, we update the current module of bugpoint.
// //
virtual TestResult doTest(std::vector<std::string> &Removed, TestResult doTest(std::vector<std::string> &Removed,
std::vector<std::string> &Kept, std::vector<std::string> &Kept,
std::string &Error); std::string &Error) override;
}; };
} }
@ -110,9 +110,9 @@ namespace {
bool (*testFn)(const BugDriver &, Module *)) bool (*testFn)(const BugDriver &, Module *))
: BD(bd), TestFn(testFn) {} : BD(bd), TestFn(testFn) {}
virtual TestResult doTest(std::vector<GlobalVariable*> &Prefix, TestResult doTest(std::vector<GlobalVariable*> &Prefix,
std::vector<GlobalVariable*> &Kept, std::vector<GlobalVariable*> &Kept,
std::string &Error) { std::string &Error) override {
if (!Kept.empty() && TestGlobalVariables(Kept)) if (!Kept.empty() && TestGlobalVariables(Kept))
return KeepSuffix; return KeepSuffix;
if (!Prefix.empty() && TestGlobalVariables(Prefix)) if (!Prefix.empty() && TestGlobalVariables(Prefix))
@ -180,9 +180,9 @@ namespace {
bool (*testFn)(const BugDriver &, Module *)) bool (*testFn)(const BugDriver &, Module *))
: BD(bd), TestFn(testFn) {} : BD(bd), TestFn(testFn) {}
virtual TestResult doTest(std::vector<Function*> &Prefix, TestResult doTest(std::vector<Function*> &Prefix,
std::vector<Function*> &Kept, std::vector<Function*> &Kept,
std::string &Error) { std::string &Error) override {
if (!Kept.empty() && TestFuncs(Kept)) if (!Kept.empty() && TestFuncs(Kept))
return KeepSuffix; return KeepSuffix;
if (!Prefix.empty() && TestFuncs(Prefix)) if (!Prefix.empty() && TestFuncs(Prefix))
@ -253,9 +253,9 @@ namespace {
bool (*testFn)(const BugDriver &, Module *)) bool (*testFn)(const BugDriver &, Module *))
: BD(bd), TestFn(testFn) {} : BD(bd), TestFn(testFn) {}
virtual TestResult doTest(std::vector<const BasicBlock*> &Prefix, TestResult doTest(std::vector<const BasicBlock*> &Prefix,
std::vector<const BasicBlock*> &Kept, std::vector<const BasicBlock*> &Kept,
std::string &Error) { std::string &Error) override {
if (!Kept.empty() && TestBlocks(Kept)) if (!Kept.empty() && TestBlocks(Kept))
return KeepSuffix; return KeepSuffix;
if (!Prefix.empty() && TestBlocks(Prefix)) if (!Prefix.empty() && TestBlocks(Prefix))
@ -362,9 +362,9 @@ namespace {
bool (*testFn)(const BugDriver &, Module *)) bool (*testFn)(const BugDriver &, Module *))
: BD(bd), TestFn(testFn) {} : BD(bd), TestFn(testFn) {}
virtual TestResult doTest(std::vector<const Instruction*> &Prefix, TestResult doTest(std::vector<const Instruction*> &Prefix,
std::vector<const Instruction*> &Kept, std::vector<const Instruction*> &Kept,
std::string &Error) { std::string &Error) override {
if (!Kept.empty() && TestInsts(Kept)) if (!Kept.empty() && TestInsts(Kept))
return KeepSuffix; return KeepSuffix;
if (!Prefix.empty() && TestInsts(Prefix)) if (!Prefix.empty() && TestInsts(Prefix))

View File

@ -48,9 +48,9 @@ namespace {
public: public:
ReduceMiscompilingPasses(BugDriver &bd) : BD(bd) {} ReduceMiscompilingPasses(BugDriver &bd) : BD(bd) {}
virtual TestResult doTest(std::vector<std::string> &Prefix, TestResult doTest(std::vector<std::string> &Prefix,
std::vector<std::string> &Suffix, std::vector<std::string> &Suffix,
std::string &Error); std::string &Error) override;
}; };
} }
@ -183,9 +183,9 @@ namespace {
std::string &)) std::string &))
: BD(bd), TestFn(F) {} : BD(bd), TestFn(F) {}
virtual TestResult doTest(std::vector<Function*> &Prefix, TestResult doTest(std::vector<Function*> &Prefix,
std::vector<Function*> &Suffix, std::vector<Function*> &Suffix,
std::string &Error) { std::string &Error) override {
if (!Suffix.empty()) { if (!Suffix.empty()) {
bool Ret = TestFuncs(Suffix, Error); bool Ret = TestFuncs(Suffix, Error);
if (!Error.empty()) if (!Error.empty())
@ -468,9 +468,9 @@ namespace {
const std::vector<Function*> &Fns) const std::vector<Function*> &Fns)
: BD(bd), TestFn(F), FunctionsBeingTested(Fns) {} : BD(bd), TestFn(F), FunctionsBeingTested(Fns) {}
virtual TestResult doTest(std::vector<BasicBlock*> &Prefix, TestResult doTest(std::vector<BasicBlock*> &Prefix,
std::vector<BasicBlock*> &Suffix, std::vector<BasicBlock*> &Suffix,
std::string &Error) { std::string &Error) override {
if (!Suffix.empty()) { if (!Suffix.empty()) {
bool Ret = TestFuncs(Suffix, Error); bool Ret = TestFuncs(Suffix, Error);
if (!Error.empty()) if (!Error.empty())

View File

@ -178,16 +178,16 @@ namespace {
if (Args) { ToolArgs = *Args; } if (Args) { ToolArgs = *Args; }
} }
virtual int ExecuteProgram(const std::string &Bitcode, int ExecuteProgram(const std::string &Bitcode,
const std::vector<std::string> &Args, const std::vector<std::string> &Args,
const std::string &InputFile, const std::string &InputFile,
const std::string &OutputFile, const std::string &OutputFile,
std::string *Error, std::string *Error,
const std::vector<std::string> &GCCArgs, const std::vector<std::string> &GCCArgs,
const std::vector<std::string> &SharedLibs = const std::vector<std::string> &SharedLibs =
std::vector<std::string>(), std::vector<std::string>(),
unsigned Timeout = 0, unsigned Timeout = 0,
unsigned MemoryLimit = 0); unsigned MemoryLimit = 0) override;
}; };
} }
@ -294,22 +294,22 @@ namespace {
const std::string &CompilerCmd, std::vector<std::string> CompArgs) : const std::string &CompilerCmd, std::vector<std::string> CompArgs) :
CompilerCommand(CompilerCmd), CompilerArgs(CompArgs) {} CompilerCommand(CompilerCmd), CompilerArgs(CompArgs) {}
virtual void compileProgram(const std::string &Bitcode, void compileProgram(const std::string &Bitcode,
std::string *Error, std::string *Error,
unsigned Timeout = 0, unsigned Timeout = 0,
unsigned MemoryLimit = 0); unsigned MemoryLimit = 0) override;
virtual int ExecuteProgram(const std::string &Bitcode, int ExecuteProgram(const std::string &Bitcode,
const std::vector<std::string> &Args, const std::vector<std::string> &Args,
const std::string &InputFile, const std::string &InputFile,
const std::string &OutputFile, const std::string &OutputFile,
std::string *Error, std::string *Error,
const std::vector<std::string> &GCCArgs = const std::vector<std::string> &GCCArgs =
std::vector<std::string>(), std::vector<std::string>(),
const std::vector<std::string> &SharedLibs = const std::vector<std::string> &SharedLibs =
std::vector<std::string>(), std::vector<std::string>(),
unsigned Timeout = 0, unsigned Timeout = 0,
unsigned MemoryLimit = 0) { unsigned MemoryLimit = 0) override {
*Error = "Execution not supported with -compile-custom"; *Error = "Execution not supported with -compile-custom";
return -1; return -1;
} }
@ -355,16 +355,16 @@ namespace {
const std::string &ExecutionCmd, std::vector<std::string> ExecArgs) : const std::string &ExecutionCmd, std::vector<std::string> ExecArgs) :
ExecutionCommand(ExecutionCmd), ExecutorArgs(ExecArgs) {} ExecutionCommand(ExecutionCmd), ExecutorArgs(ExecArgs) {}
virtual int ExecuteProgram(const std::string &Bitcode, int ExecuteProgram(const std::string &Bitcode,
const std::vector<std::string> &Args, const std::vector<std::string> &Args,
const std::string &InputFile, const std::string &InputFile,
const std::string &OutputFile, const std::string &OutputFile,
std::string *Error, std::string *Error,
const std::vector<std::string> &GCCArgs, const std::vector<std::string> &GCCArgs,
const std::vector<std::string> &SharedLibs = const std::vector<std::string> &SharedLibs =
std::vector<std::string>(), std::vector<std::string>(),
unsigned Timeout = 0, unsigned Timeout = 0,
unsigned MemoryLimit = 0); unsigned MemoryLimit = 0) override;
}; };
} }
@ -584,17 +584,17 @@ namespace {
if (Args) { ToolArgs = *Args; } if (Args) { ToolArgs = *Args; }
} }
virtual int ExecuteProgram(const std::string &Bitcode, int ExecuteProgram(const std::string &Bitcode,
const std::vector<std::string> &Args, const std::vector<std::string> &Args,
const std::string &InputFile, const std::string &InputFile,
const std::string &OutputFile, const std::string &OutputFile,
std::string *Error, std::string *Error,
const std::vector<std::string> &GCCArgs = const std::vector<std::string> &GCCArgs =
std::vector<std::string>(), std::vector<std::string>(),
const std::vector<std::string> &SharedLibs = const std::vector<std::string> &SharedLibs =
std::vector<std::string>(), std::vector<std::string>(),
unsigned Timeout = 0, unsigned Timeout = 0,
unsigned MemoryLimit = 0); unsigned MemoryLimit = 0) override;
}; };
} }

View File

@ -168,29 +168,29 @@ public:
/// compileProgram - Compile the specified program from bitcode to executable /// compileProgram - Compile the specified program from bitcode to executable
/// code. This does not produce any output, it is only used when debugging /// code. This does not produce any output, it is only used when debugging
/// the code generator. Returns false if the code generator fails. /// the code generator. Returns false if the code generator fails.
virtual void compileProgram(const std::string &Bitcode, std::string *Error, void compileProgram(const std::string &Bitcode, std::string *Error,
unsigned Timeout = 0, unsigned MemoryLimit = 0); unsigned Timeout = 0, unsigned MemoryLimit = 0) override;
virtual int ExecuteProgram(const std::string &Bitcode, int ExecuteProgram(const std::string &Bitcode,
const std::vector<std::string> &Args, const std::vector<std::string> &Args,
const std::string &InputFile, const std::string &InputFile,
const std::string &OutputFile, const std::string &OutputFile,
std::string *Error, std::string *Error,
const std::vector<std::string> &GCCArgs = const std::vector<std::string> &GCCArgs =
std::vector<std::string>(), std::vector<std::string>(),
const std::vector<std::string> &SharedLibs = const std::vector<std::string> &SharedLibs =
std::vector<std::string>(), std::vector<std::string>(),
unsigned Timeout = 0, unsigned Timeout = 0,
unsigned MemoryLimit = 0); unsigned MemoryLimit = 0) override;
/// OutputCode - Compile the specified program from bitcode to code /// OutputCode - Compile the specified program from bitcode to code
/// understood by the GCC driver (either C or asm). If the code generator /// understood by the GCC driver (either C or asm). If the code generator
/// fails, it sets Error, otherwise, this function returns the type of code /// fails, it sets Error, otherwise, this function returns the type of code
/// emitted. /// emitted.
virtual GCC::FileType OutputCode(const std::string &Bitcode, GCC::FileType OutputCode(const std::string &Bitcode,
std::string &OutFile, std::string &Error, std::string &OutFile, std::string &Error,
unsigned Timeout = 0, unsigned Timeout = 0,
unsigned MemoryLimit = 0); unsigned MemoryLimit = 0) override;
}; };
} // End llvm namespace } // End llvm namespace

View File

@ -101,7 +101,7 @@ namespace {
public: public:
AddToDriver(BugDriver &_D) : FunctionPassManager(0), D(_D) {} AddToDriver(BugDriver &_D) : FunctionPassManager(0), D(_D) {}
virtual void add(Pass *P) { void add(Pass *P) override {
const void *ID = P->getPassID(); const void *ID = P->getPassID();
const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(ID); const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(ID);
D.addPass(PI->getPassArgument()); D.addPass(PI->getPassArgument());

View File

@ -67,45 +67,48 @@ public:
virtual ~RemoteMemoryManager(); virtual ~RemoteMemoryManager();
uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment, uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID, StringRef SectionName); unsigned SectionID,
StringRef SectionName) override;
uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment, uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID, StringRef SectionName, unsigned SectionID, StringRef SectionName,
bool IsReadOnly); bool IsReadOnly) override;
// For now, remote symbol resolution is not support in lli. The MCJIT // For now, remote symbol resolution is not support in lli. The MCJIT
// interface does support this, but clients must provide their own // interface does support this, but clients must provide their own
// mechanism for finding remote symbol addresses. MCJIT will resolve // mechanism for finding remote symbol addresses. MCJIT will resolve
// symbols from Modules it contains. // symbols from Modules it contains.
uint64_t getSymbolAddress(const std::string &Name) { return 0; } uint64_t getSymbolAddress(const std::string &Name) override { return 0; }
void notifyObjectLoaded(ExecutionEngine *EE, const ObjectImage *Obj); void notifyObjectLoaded(ExecutionEngine *EE, const ObjectImage *Obj) override;
bool finalizeMemory(std::string *ErrMsg); bool finalizeMemory(std::string *ErrMsg) override;
// For now, remote EH frame registration isn't supported. Remote symbol // For now, remote EH frame registration isn't supported. Remote symbol
// resolution is a prerequisite to supporting remote EH frame registration. // resolution is a prerequisite to supporting remote EH frame registration.
void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) {} void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr,
void deregisterEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) {} size_t Size) override {}
void deregisterEHFrames(uint8_t *Addr, uint64_t LoadAddr,
size_t Size) override {}
// This is a non-interface function used by lli // This is a non-interface function used by lli
void setRemoteTarget(RemoteTarget *T) { Target = T; } void setRemoteTarget(RemoteTarget *T) { Target = T; }
// The following obsolete JITMemoryManager calls are stubbed out for // The following obsolete JITMemoryManager calls are stubbed out for
// this model. // this model.
void setMemoryWritable(); void setMemoryWritable() override;
void setMemoryExecutable(); void setMemoryExecutable() override;
void setPoisonMemory(bool poison); void setPoisonMemory(bool poison) override;
void AllocateGOT(); void AllocateGOT() override;
uint8_t *getGOTBase() const; uint8_t *getGOTBase() const override;
uint8_t *startFunctionBody(const Function *F, uintptr_t &ActualSize); uint8_t *startFunctionBody(const Function *F, uintptr_t &ActualSize) override;
uint8_t *allocateStub(const GlobalValue* F, unsigned StubSize, uint8_t *allocateStub(const GlobalValue* F, unsigned StubSize,
unsigned Alignment); unsigned Alignment) override;
void endFunctionBody(const Function *F, uint8_t *FunctionStart, void endFunctionBody(const Function *F, uint8_t *FunctionStart,
uint8_t *FunctionEnd); uint8_t *FunctionEnd) override;
uint8_t *allocateSpace(intptr_t Size, unsigned Alignment); uint8_t *allocateSpace(intptr_t Size, unsigned Alignment) override;
uint8_t *allocateGlobal(uintptr_t Size, unsigned Alignment); uint8_t *allocateGlobal(uintptr_t Size, unsigned Alignment) override;
void deallocateFunctionBody(void *Body); void deallocateFunctionBody(void *Body) override;
}; };
} // end namespace llvm } // end namespace llvm

View File

@ -46,9 +46,8 @@ public:
/// ///
/// @returns True on success. On failure, ErrorMsg is updated with /// @returns True on success. On failure, ErrorMsg is updated with
/// descriptive text of the encountered error. /// descriptive text of the encountered error.
virtual bool allocateSpace(size_t Size, bool allocateSpace(size_t Size, unsigned Alignment,
unsigned Alignment, uint64_t &Address) override;
uint64_t &Address);
/// Load data into the target address space. /// Load data into the target address space.
/// ///
@ -58,7 +57,7 @@ public:
/// ///
/// @returns True on success. On failure, ErrorMsg is updated with /// @returns True on success. On failure, ErrorMsg is updated with
/// descriptive text of the encountered error. /// descriptive text of the encountered error.
virtual bool loadData(uint64_t Address, const void *Data, size_t Size); bool loadData(uint64_t Address, const void *Data, size_t Size) override;
/// Load code into the target address space and prepare it for execution. /// Load code into the target address space and prepare it for execution.
/// ///
@ -68,7 +67,7 @@ public:
/// ///
/// @returns True on success. On failure, ErrorMsg is updated with /// @returns True on success. On failure, ErrorMsg is updated with
/// descriptive text of the encountered error. /// descriptive text of the encountered error.
virtual bool loadCode(uint64_t Address, const void *Data, size_t Size); bool loadCode(uint64_t Address, const void *Data, size_t Size) override;
/// Execute code in the target process. The called function is required /// Execute code in the target process. The called function is required
/// to be of signature int "(*)(void)". /// to be of signature int "(*)(void)".
@ -79,16 +78,16 @@ public:
/// ///
/// @returns True on success. On failure, ErrorMsg is updated with /// @returns True on success. On failure, ErrorMsg is updated with
/// descriptive text of the encountered error. /// descriptive text of the encountered error.
virtual bool executeCode(uint64_t Address, int &RetVal); bool executeCode(uint64_t Address, int &RetVal) override;
/// Minimum alignment for memory permissions. Used to separate code and /// Minimum alignment for memory permissions. Used to separate code and
/// data regions to make sure data doesn't get marked as code or vice /// data regions to make sure data doesn't get marked as code or vice
/// versa. /// versa.
/// ///
/// @returns Page alignment return value. Default of 4k. /// @returns Page alignment return value. Default of 4k.
virtual unsigned getPageAlignment() { return 4096; } unsigned getPageAlignment() override { return 4096; }
virtual bool create() { bool create() override {
RPC.ChildName = ChildName; RPC.ChildName = ChildName;
if (!RPC.createServer()) if (!RPC.createServer())
return true; return true;
@ -104,7 +103,7 @@ public:
} }
/// Terminate the remote process. /// Terminate the remote process.
virtual void stop(); void stop() override;
RemoteTargetExternal(std::string &Name) : RemoteTarget(), ChildName(Name) {} RemoteTargetExternal(std::string &Name) : RemoteTarget(), ChildName(Name) {}
virtual ~RemoteTargetExternal() {} virtual ~RemoteTargetExternal() {}

View File

@ -262,7 +262,7 @@ public:
} }
virtual ~LLIObjectCache() {} virtual ~LLIObjectCache() {}
virtual void notifyObjectCompiled(const Module *M, const MemoryBuffer *Obj) { void notifyObjectCompiled(const Module *M, const MemoryBuffer *Obj) override {
const std::string ModuleID = M->getModuleIdentifier(); const std::string ModuleID = M->getModuleIdentifier();
std::string CacheName; std::string CacheName;
if (!getCacheFilename(ModuleID, CacheName)) if (!getCacheFilename(ModuleID, CacheName))
@ -278,7 +278,7 @@ public:
outfile.close(); outfile.close();
} }
virtual MemoryBuffer* getObject(const Module* M) { MemoryBuffer* getObject(const Module* M) override {
const std::string ModuleID = M->getModuleIdentifier(); const std::string ModuleID = M->getModuleIdentifier();
std::string CacheName; std::string CacheName;
if (!getCacheFilename(ModuleID, CacheName)) if (!getCacheFilename(ModuleID, CacheName))

View File

@ -79,11 +79,11 @@ namespace llvm {
: out(errs()), Differences(false), Indent(0) {} : out(errs()), Differences(false), Indent(0) {}
bool hadDifferences() const; bool hadDifferences() const;
void enterContext(Value *L, Value *R); void enterContext(Value *L, Value *R) override;
void exitContext(); void exitContext() override;
void log(StringRef text); void log(StringRef text) override;
void logf(const LogBuilder &Log); void logf(const LogBuilder &Log) override;
void logd(const DiffLogBuilder &Log); void logd(const DiffLogBuilder &Log) override;
}; };
} }

View File

@ -66,11 +66,11 @@ static void printDebugLoc(const DebugLoc &DL, formatted_raw_ostream &OS) {
class CommentWriter : public AssemblyAnnotationWriter { class CommentWriter : public AssemblyAnnotationWriter {
public: public:
void emitFunctionAnnot(const Function *F, void emitFunctionAnnot(const Function *F,
formatted_raw_ostream &OS) { formatted_raw_ostream &OS) override {
OS << "; [#uses=" << F->getNumUses() << ']'; // Output # uses OS << "; [#uses=" << F->getNumUses() << ']'; // Output # uses
OS << '\n'; OS << '\n';
} }
void printInfoComment(const Value &V, formatted_raw_ostream &OS) { void printInfoComment(const Value &V, formatted_raw_ostream &OS) override {
bool Padded = false; bool Padded = false;
if (!V.getType()->isVoidTy()) { if (!V.getType()->isVoidTy()) {
OS.PadToColumn(50); OS.PadToColumn(50);

View File

@ -35,10 +35,10 @@ private:
public: public:
VectorMemoryObject(const ByteArrayTy &bytes) : Bytes(bytes) {} VectorMemoryObject(const ByteArrayTy &bytes) : Bytes(bytes) {}
uint64_t getBase() const { return 0; } uint64_t getBase() const override { return 0; }
uint64_t getExtent() const { return Bytes.size(); } uint64_t getExtent() const override { return Bytes.size(); }
int readByte(uint64_t Addr, uint8_t *Byte) const { int readByte(uint64_t Addr, uint8_t *Byte) const override {
if (Addr >= getExtent()) if (Addr >= getExtent())
return -1; return -1;
*Byte = Bytes[Addr].first; *Byte = Bytes[Addr].first;

View File

@ -42,18 +42,18 @@ public:
ELFDumper(const ELFFile<ELFT> *Obj, StreamWriter &Writer) ELFDumper(const ELFFile<ELFT> *Obj, StreamWriter &Writer)
: ObjDumper(Writer), Obj(Obj) {} : ObjDumper(Writer), Obj(Obj) {}
virtual void printFileHeaders() override; void printFileHeaders() override;
virtual void printSections() override; void printSections() override;
virtual void printRelocations() override; void printRelocations() override;
virtual void printSymbols() override; void printSymbols() override;
virtual void printDynamicSymbols() override; void printDynamicSymbols() override;
virtual void printUnwindInfo() override; void printUnwindInfo() override;
virtual void printDynamicTable() override; void printDynamicTable() override;
virtual void printNeededLibraries() override; void printNeededLibraries() override;
virtual void printProgramHeaders() override; void printProgramHeaders() override;
virtual void printAttributes() override; void printAttributes() override;
private: private:
typedef ELFFile<ELFT> ELFO; typedef ELFFile<ELFT> ELFO;

View File

@ -19,9 +19,9 @@ using namespace llvm;
namespace { namespace {
class _readobj_error_category : public _do_message { class _readobj_error_category : public _do_message {
public: public:
virtual const char* name() const; const char* name() const override;
virtual std::string message(int ev) const; std::string message(int ev) const override;
virtual error_condition default_error_condition(int ev) const; error_condition default_error_condition(int ev) const override;
}; };
} // namespace } // namespace

View File

@ -61,17 +61,18 @@ public:
SmallVector<sys::MemoryBlock, 16> DataMemory; SmallVector<sys::MemoryBlock, 16> DataMemory;
uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment, uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID, StringRef SectionName); unsigned SectionID,
StringRef SectionName) override;
uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment, uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID, StringRef SectionName, unsigned SectionID, StringRef SectionName,
bool IsReadOnly); bool IsReadOnly) override;
virtual void *getPointerToNamedFunction(const std::string &Name, void *getPointerToNamedFunction(const std::string &Name,
bool AbortOnFailure = true) { bool AbortOnFailure = true) override {
return 0; return 0;
} }
bool finalizeMemory(std::string *ErrMsg) { return false; } bool finalizeMemory(std::string *ErrMsg) override { return false; }
// Invalidate instruction cache for sections with execute permissions. // Invalidate instruction cache for sections with execute permissions.
// Some platforms with separate data cache and instruction cache require // Some platforms with separate data cache and instruction cache require

View File

@ -288,7 +288,7 @@ protected:
struct LoadModifier: public Modifier { struct LoadModifier: public Modifier {
LoadModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {} LoadModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
virtual void Act() { void Act() override {
// Try to use predefined pointers. If non-exist, use undef pointer value; // Try to use predefined pointers. If non-exist, use undef pointer value;
Value *Ptr = getRandomPointerValue(); Value *Ptr = getRandomPointerValue();
Value *V = new LoadInst(Ptr, "L", BB->getTerminator()); Value *V = new LoadInst(Ptr, "L", BB->getTerminator());
@ -298,7 +298,7 @@ struct LoadModifier: public Modifier {
struct StoreModifier: public Modifier { struct StoreModifier: public Modifier {
StoreModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {} StoreModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
virtual void Act() { void Act() override {
// Try to use predefined pointers. If non-exist, use undef pointer value; // Try to use predefined pointers. If non-exist, use undef pointer value;
Value *Ptr = getRandomPointerValue(); Value *Ptr = getRandomPointerValue();
Type *Tp = Ptr->getType(); Type *Tp = Ptr->getType();
@ -317,7 +317,7 @@ struct StoreModifier: public Modifier {
struct BinModifier: public Modifier { struct BinModifier: public Modifier {
BinModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {} BinModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
virtual void Act() { void Act() override {
Value *Val0 = getRandomVal(); Value *Val0 = getRandomVal();
Value *Val1 = getRandomValue(Val0->getType()); Value *Val1 = getRandomValue(Val0->getType());
@ -360,7 +360,7 @@ struct BinModifier: public Modifier {
/// Generate constant values. /// Generate constant values.
struct ConstModifier: public Modifier { struct ConstModifier: public Modifier {
ConstModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {} ConstModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
virtual void Act() { void Act() override {
Type *Ty = pickType(); Type *Ty = pickType();
if (Ty->isVectorTy()) { if (Ty->isVectorTy()) {
@ -407,7 +407,7 @@ struct ConstModifier: public Modifier {
struct AllocaModifier: public Modifier { struct AllocaModifier: public Modifier {
AllocaModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R){} AllocaModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R){}
virtual void Act() { void Act() override {
Type *Tp = pickType(); Type *Tp = pickType();
PT->push_back(new AllocaInst(Tp, "A", BB->getFirstNonPHI())); PT->push_back(new AllocaInst(Tp, "A", BB->getFirstNonPHI()));
} }
@ -417,7 +417,7 @@ struct ExtractElementModifier: public Modifier {
ExtractElementModifier(BasicBlock *BB, PieceTable *PT, Random *R): ExtractElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
Modifier(BB, PT, R) {} Modifier(BB, PT, R) {}
virtual void Act() { void Act() override {
Value *Val0 = getRandomVectorValue(); Value *Val0 = getRandomVectorValue();
Value *V = ExtractElementInst::Create(Val0, Value *V = ExtractElementInst::Create(Val0,
ConstantInt::get(Type::getInt32Ty(BB->getContext()), ConstantInt::get(Type::getInt32Ty(BB->getContext()),
@ -429,7 +429,7 @@ struct ExtractElementModifier: public Modifier {
struct ShuffModifier: public Modifier { struct ShuffModifier: public Modifier {
ShuffModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {} ShuffModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
virtual void Act() { void Act() override {
Value *Val0 = getRandomVectorValue(); Value *Val0 = getRandomVectorValue();
Value *Val1 = getRandomValue(Val0->getType()); Value *Val1 = getRandomValue(Val0->getType());
@ -458,7 +458,7 @@ struct InsertElementModifier: public Modifier {
InsertElementModifier(BasicBlock *BB, PieceTable *PT, Random *R): InsertElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
Modifier(BB, PT, R) {} Modifier(BB, PT, R) {}
virtual void Act() { void Act() override {
Value *Val0 = getRandomVectorValue(); Value *Val0 = getRandomVectorValue();
Value *Val1 = getRandomValue(Val0->getType()->getScalarType()); Value *Val1 = getRandomValue(Val0->getType()->getScalarType());
@ -473,7 +473,7 @@ struct InsertElementModifier: public Modifier {
struct CastModifier: public Modifier { struct CastModifier: public Modifier {
CastModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {} CastModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
virtual void Act() { void Act() override {
Value *V = getRandomVal(); Value *V = getRandomVal();
Type *VTy = V->getType(); Type *VTy = V->getType();
@ -560,7 +560,7 @@ struct SelectModifier: public Modifier {
SelectModifier(BasicBlock *BB, PieceTable *PT, Random *R): SelectModifier(BasicBlock *BB, PieceTable *PT, Random *R):
Modifier(BB, PT, R) {} Modifier(BB, PT, R) {}
virtual void Act() { void Act() override {
// Try a bunch of different select configuration until a valid one is found. // Try a bunch of different select configuration until a valid one is found.
Value *Val0 = getRandomVal(); Value *Val0 = getRandomVal();
Value *Val1 = getRandomValue(Val0->getType()); Value *Val1 = getRandomValue(Val0->getType());
@ -583,7 +583,7 @@ struct SelectModifier: public Modifier {
struct CmpModifier: public Modifier { struct CmpModifier: public Modifier {
CmpModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {} CmpModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
virtual void Act() { void Act() override {
Value *Val0 = getRandomVal(); Value *Val0 = getRandomVal();
Value *Val1 = getRandomValue(Val0->getType()); Value *Val1 = getRandomValue(Val0->getType());

View File

@ -32,7 +32,7 @@ namespace {
struct ExternalFunctionsPassedConstants : public ModulePass { struct ExternalFunctionsPassedConstants : public ModulePass {
static char ID; // Pass ID, replacement for typeid static char ID; // Pass ID, replacement for typeid
ExternalFunctionsPassedConstants() : ModulePass(ID) {} 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) { for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
if (!I->isDeclaration()) continue; if (!I->isDeclaration()) continue;
@ -62,7 +62,7 @@ namespace {
return false; return false;
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
} }
}; };
@ -78,11 +78,11 @@ namespace {
static char ID; // Pass ID, replacement for typeid static char ID; // Pass ID, replacement for typeid
CallGraphPrinter() : ModulePass(ID) {} CallGraphPrinter() : ModulePass(ID) {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addRequiredTransitive<CallGraphWrapperPass>(); AU.addRequiredTransitive<CallGraphWrapperPass>();
} }
virtual bool runOnModule(Module &M) { bool runOnModule(Module &M) override {
getAnalysis<CallGraphWrapperPass>().print(errs(), &M); getAnalysis<CallGraphWrapperPass>().print(errs(), &M);
return false; return false;
} }

View File

@ -45,7 +45,7 @@ struct BreakpointPrinter : public ModulePass {
} }
} }
virtual bool runOnModule(Module &M) { bool runOnModule(Module &M) override {
TypeIdentifierMap.clear(); TypeIdentifierMap.clear();
NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu"); NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu");
if (CU_Nodes) if (CU_Nodes)
@ -69,7 +69,7 @@ struct BreakpointPrinter : public ModulePass {
return false; return false;
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
} }
}; };

View File

@ -29,12 +29,12 @@ namespace {
static char ID; // Pass identification, replacement for typeid static char ID; // Pass identification, replacement for typeid
DomInfoPrinter() : FunctionPass(ID) {} DomInfoPrinter() : FunctionPass(ID) {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<DominatorTreeWrapperPass>();
} }
virtual bool runOnFunction(Function &F) { bool runOnFunction(Function &F) override {
getAnalysis<DominatorTreeWrapperPass>().dump(); getAnalysis<DominatorTreeWrapperPass>().dump();
return false; return false;
} }

View File

@ -36,7 +36,7 @@ struct FunctionPassPrinter : public FunctionPass {
PassName = "FunctionPass Printer: " + PassToPrintName; PassName = "FunctionPass Printer: " + PassToPrintName;
} }
virtual bool runOnFunction(Function &F) { bool runOnFunction(Function &F) override {
if (!QuietPass) if (!QuietPass)
Out << "Printing analysis '" << PassToPrint->getPassName() Out << "Printing analysis '" << PassToPrint->getPassName()
<< "' for function '" << F.getName() << "':\n"; << "' for function '" << F.getName() << "':\n";
@ -46,9 +46,9 @@ struct FunctionPassPrinter : public FunctionPass {
return false; 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.addRequiredID(PassToPrint->getTypeInfo());
AU.setPreservesAll(); AU.setPreservesAll();
} }
@ -69,7 +69,7 @@ struct CallGraphSCCPassPrinter : public CallGraphSCCPass {
PassName = "CallGraphSCCPass Printer: " + PassToPrintName; PassName = "CallGraphSCCPass Printer: " + PassToPrintName;
} }
virtual bool runOnSCC(CallGraphSCC &SCC) { bool runOnSCC(CallGraphSCC &SCC) override {
if (!QuietPass) if (!QuietPass)
Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n"; Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
@ -83,9 +83,9 @@ struct CallGraphSCCPassPrinter : public CallGraphSCCPass {
return false; 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.addRequiredID(PassToPrint->getTypeInfo());
AU.setPreservesAll(); AU.setPreservesAll();
} }
@ -106,7 +106,7 @@ struct ModulePassPrinter : public ModulePass {
PassName = "ModulePass Printer: " + PassToPrintName; PassName = "ModulePass Printer: " + PassToPrintName;
} }
virtual bool runOnModule(Module &M) { bool runOnModule(Module &M) override {
if (!QuietPass) if (!QuietPass)
Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n"; Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
@ -115,9 +115,9 @@ struct ModulePassPrinter : public ModulePass {
return false; 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.addRequiredID(PassToPrint->getTypeInfo());
AU.setPreservesAll(); AU.setPreservesAll();
} }
@ -138,7 +138,7 @@ struct LoopPassPrinter : public LoopPass {
PassName = "LoopPass Printer: " + PassToPrintName; PassName = "LoopPass Printer: " + PassToPrintName;
} }
virtual bool runOnLoop(Loop *L, LPPassManager &LPM) { bool runOnLoop(Loop *L, LPPassManager &LPM) override {
if (!QuietPass) if (!QuietPass)
Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n"; Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
@ -148,9 +148,9 @@ struct LoopPassPrinter : public LoopPass {
return false; 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.addRequiredID(PassToPrint->getTypeInfo());
AU.setPreservesAll(); AU.setPreservesAll();
} }
@ -171,7 +171,7 @@ struct RegionPassPrinter : public RegionPass {
PassName = "RegionPass Printer: " + PassToPrintName; PassName = "RegionPass Printer: " + PassToPrintName;
} }
virtual bool runOnRegion(Region *R, RGPassManager &RGM) { bool runOnRegion(Region *R, RGPassManager &RGM) override {
if (!QuietPass) { if (!QuietPass) {
Out << "Printing analysis '" << PassToPrint->getPassName() << "' for " Out << "Printing analysis '" << PassToPrint->getPassName() << "' for "
<< "region: '" << R->getNameStr() << "' in function '" << "region: '" << R->getNameStr() << "' in function '"
@ -183,9 +183,9 @@ struct RegionPassPrinter : public RegionPass {
return false; 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.addRequiredID(PassToPrint->getTypeInfo());
AU.setPreservesAll(); AU.setPreservesAll();
} }
@ -206,7 +206,7 @@ struct BasicBlockPassPrinter : public BasicBlockPass {
PassName = "BasicBlockPass Printer: " + PassToPrintName; PassName = "BasicBlockPass Printer: " + PassToPrintName;
} }
virtual bool runOnBasicBlock(BasicBlock &BB) { bool runOnBasicBlock(BasicBlock &BB) override {
if (!QuietPass) if (!QuietPass)
Out << "Printing Analysis info for BasicBlock '" << BB.getName() Out << "Printing Analysis info for BasicBlock '" << BB.getName()
<< "': Pass " << PassToPrint->getPassName() << ":\n"; << "': Pass " << PassToPrint->getPassName() << ":\n";
@ -217,9 +217,9 @@ struct BasicBlockPassPrinter : public BasicBlockPass {
return false; 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.addRequiredID(PassToPrint->getTypeInfo());
AU.setPreservesAll(); AU.setPreservesAll();
} }

View File

@ -37,11 +37,11 @@ namespace {
struct CFGSCC : public FunctionPass { struct CFGSCC : public FunctionPass {
static char ID; // Pass identification, replacement for typeid static char ID; // Pass identification, replacement for typeid
CFGSCC() : FunctionPass(ID) {} 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(); AU.setPreservesAll();
} }
}; };
@ -51,12 +51,12 @@ namespace {
CallGraphSCC() : ModulePass(ID) {} CallGraphSCC() : ModulePass(ID) {}
// run - Print out SCCs in the call graph for the specified module. // 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. // getAnalysisUsage - This pass requires the CallGraph.
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addRequired<CallGraphWrapperPass>(); AU.addRequired<CallGraphWrapperPass>();
} }