From e56917c0caad30fe9c6225968c0b47673fd2e7ad Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sat, 8 Mar 2014 08:27:28 +0000 Subject: [PATCH] [C++11] Add 'override' keyword to virtual methods that override their base class. llvm-svn: 203345 --- llvm/include/llvm/IR/PassManager.h | 20 +++---- llvm/tools/bugpoint-passes/TestPasses.cpp | 6 +- llvm/tools/bugpoint/CrashDebugger.cpp | 30 +++++----- llvm/tools/bugpoint/Miscompilation.cpp | 18 +++--- llvm/tools/bugpoint/ToolRunner.cpp | 94 +++++++++++++++---------------- llvm/tools/bugpoint/ToolRunner.h | 34 +++++------ llvm/tools/bugpoint/bugpoint.cpp | 2 +- llvm/tools/lli/RemoteMemoryManager.h | 39 +++++++------ llvm/tools/lli/RemoteTargetExternal.h | 17 +++--- llvm/tools/lli/lli.cpp | 4 +- llvm/tools/llvm-diff/DiffConsumer.h | 10 ++-- llvm/tools/llvm-dis/llvm-dis.cpp | 4 +- llvm/tools/llvm-mc/Disassembler.cpp | 6 +- llvm/tools/llvm-readobj/ELFDumper.cpp | 24 ++++---- llvm/tools/llvm-readobj/Error.cpp | 6 +- llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp | 11 ++-- llvm/tools/llvm-stress/llvm-stress.cpp | 22 ++++---- llvm/tools/opt/AnalysisWrappers.cpp | 8 +-- llvm/tools/opt/BreakpointPrinter.cpp | 4 +- llvm/tools/opt/GraphPrinters.cpp | 4 +- llvm/tools/opt/PassPrinters.cpp | 36 ++++++------ llvm/tools/opt/PrintSCC.cpp | 12 ++-- 22 files changed, 207 insertions(+), 204 deletions(-) diff --git a/llvm/include/llvm/IR/PassManager.h b/llvm/include/llvm/IR/PassManager.h index 4057771..e4260ba 100644 --- a/llvm/include/llvm/IR/PassManager.h +++ b/llvm/include/llvm/IR/PassManager.h @@ -205,11 +205,11 @@ template struct PassModel : PassConcept { PassModel(PassT Pass) : Pass(std::move(Pass)) {} - virtual PassModel *clone() { return new PassModel(Pass); } - virtual PreservedAnalyses run(IRUnitT IR, AnalysisManagerT *AM) { + PassModel *clone() override { return new PassModel(Pass); } + PreservedAnalyses run(IRUnitT IR, AnalysisManagerT *AM) override { return Pass.run(IR, AM); } - virtual StringRef name() { return PassT::name(); } + StringRef name() override { return PassT::name(); } PassT Pass; }; @@ -219,11 +219,11 @@ template struct PassModel : PassConcept { PassModel(PassT Pass) : Pass(std::move(Pass)) {} - virtual PassModel *clone() { return new PassModel(Pass); } - virtual PreservedAnalyses run(IRUnitT IR, AnalysisManagerT *AM) { + PassModel *clone() override { return new PassModel(Pass); } + PreservedAnalyses run(IRUnitT IR, AnalysisManagerT *AM) override { return Pass.run(IR); } - virtual StringRef name() { return PassT::name(); } + StringRef name() override { return PassT::name(); } PassT Pass; }; @@ -303,12 +303,12 @@ template struct AnalysisResultModel : AnalysisResultConcept { AnalysisResultModel(ResultT Result) : Result(std::move(Result)) {} - virtual AnalysisResultModel *clone() { + AnalysisResultModel *clone() override { return new AnalysisResultModel(Result); } /// \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); } @@ -371,7 +371,7 @@ struct AnalysisPassModel : AnalysisPassConcept { 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. typedef AnalysisResultModel @@ -380,7 +380,7 @@ struct AnalysisPassModel(*I)) abort(); @@ -56,7 +56,7 @@ namespace { static char ID; // Pass ID, replacement for typeid DeleteCalls() : BasicBlockPass(ID) {} private: - bool runOnBasicBlock(BasicBlock &BB) { + bool runOnBasicBlock(BasicBlock &BB) override { for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I) if (CallInst *CI = dyn_cast(I)) { if (!CI->use_empty()) diff --git a/llvm/tools/bugpoint/CrashDebugger.cpp b/llvm/tools/bugpoint/CrashDebugger.cpp index 3918030..bdaa6c9c 100644 --- a/llvm/tools/bugpoint/CrashDebugger.cpp +++ b/llvm/tools/bugpoint/CrashDebugger.cpp @@ -52,9 +52,9 @@ namespace llvm { // 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. // - virtual TestResult doTest(std::vector &Removed, - std::vector &Kept, - std::string &Error); + TestResult doTest(std::vector &Removed, + std::vector &Kept, + std::string &Error) override; }; } @@ -110,9 +110,9 @@ namespace { bool (*testFn)(const BugDriver &, Module *)) : BD(bd), TestFn(testFn) {} - virtual TestResult doTest(std::vector &Prefix, - std::vector &Kept, - std::string &Error) { + TestResult doTest(std::vector &Prefix, + std::vector &Kept, + std::string &Error) override { if (!Kept.empty() && TestGlobalVariables(Kept)) return KeepSuffix; if (!Prefix.empty() && TestGlobalVariables(Prefix)) @@ -180,9 +180,9 @@ namespace { bool (*testFn)(const BugDriver &, Module *)) : BD(bd), TestFn(testFn) {} - virtual TestResult doTest(std::vector &Prefix, - std::vector &Kept, - std::string &Error) { + TestResult doTest(std::vector &Prefix, + std::vector &Kept, + std::string &Error) override { if (!Kept.empty() && TestFuncs(Kept)) return KeepSuffix; if (!Prefix.empty() && TestFuncs(Prefix)) @@ -253,9 +253,9 @@ namespace { bool (*testFn)(const BugDriver &, Module *)) : BD(bd), TestFn(testFn) {} - virtual TestResult doTest(std::vector &Prefix, - std::vector &Kept, - std::string &Error) { + TestResult doTest(std::vector &Prefix, + std::vector &Kept, + std::string &Error) override { if (!Kept.empty() && TestBlocks(Kept)) return KeepSuffix; if (!Prefix.empty() && TestBlocks(Prefix)) @@ -362,9 +362,9 @@ namespace { bool (*testFn)(const BugDriver &, Module *)) : BD(bd), TestFn(testFn) {} - virtual TestResult doTest(std::vector &Prefix, - std::vector &Kept, - std::string &Error) { + TestResult doTest(std::vector &Prefix, + std::vector &Kept, + std::string &Error) override { if (!Kept.empty() && TestInsts(Kept)) return KeepSuffix; if (!Prefix.empty() && TestInsts(Prefix)) diff --git a/llvm/tools/bugpoint/Miscompilation.cpp b/llvm/tools/bugpoint/Miscompilation.cpp index db26fe2..fecae60 100644 --- a/llvm/tools/bugpoint/Miscompilation.cpp +++ b/llvm/tools/bugpoint/Miscompilation.cpp @@ -48,9 +48,9 @@ namespace { public: ReduceMiscompilingPasses(BugDriver &bd) : BD(bd) {} - virtual TestResult doTest(std::vector &Prefix, - std::vector &Suffix, - std::string &Error); + TestResult doTest(std::vector &Prefix, + std::vector &Suffix, + std::string &Error) override; }; } @@ -183,9 +183,9 @@ namespace { std::string &)) : BD(bd), TestFn(F) {} - virtual TestResult doTest(std::vector &Prefix, - std::vector &Suffix, - std::string &Error) { + TestResult doTest(std::vector &Prefix, + std::vector &Suffix, + std::string &Error) override { if (!Suffix.empty()) { bool Ret = TestFuncs(Suffix, Error); if (!Error.empty()) @@ -468,9 +468,9 @@ namespace { const std::vector &Fns) : BD(bd), TestFn(F), FunctionsBeingTested(Fns) {} - virtual TestResult doTest(std::vector &Prefix, - std::vector &Suffix, - std::string &Error) { + TestResult doTest(std::vector &Prefix, + std::vector &Suffix, + std::string &Error) override { if (!Suffix.empty()) { bool Ret = TestFuncs(Suffix, Error); if (!Error.empty()) diff --git a/llvm/tools/bugpoint/ToolRunner.cpp b/llvm/tools/bugpoint/ToolRunner.cpp index 22199f8..f0fb4bf 100644 --- a/llvm/tools/bugpoint/ToolRunner.cpp +++ b/llvm/tools/bugpoint/ToolRunner.cpp @@ -178,16 +178,16 @@ namespace { if (Args) { ToolArgs = *Args; } } - virtual int ExecuteProgram(const std::string &Bitcode, - const std::vector &Args, - const std::string &InputFile, - const std::string &OutputFile, - std::string *Error, - const std::vector &GCCArgs, - const std::vector &SharedLibs = - std::vector(), - unsigned Timeout = 0, - unsigned MemoryLimit = 0); + int ExecuteProgram(const std::string &Bitcode, + const std::vector &Args, + const std::string &InputFile, + const std::string &OutputFile, + std::string *Error, + const std::vector &GCCArgs, + const std::vector &SharedLibs = + std::vector(), + unsigned Timeout = 0, + unsigned MemoryLimit = 0) override; }; } @@ -294,22 +294,22 @@ namespace { const std::string &CompilerCmd, std::vector CompArgs) : CompilerCommand(CompilerCmd), CompilerArgs(CompArgs) {} - virtual void compileProgram(const std::string &Bitcode, - std::string *Error, - unsigned Timeout = 0, - unsigned MemoryLimit = 0); - - virtual int ExecuteProgram(const std::string &Bitcode, - const std::vector &Args, - const std::string &InputFile, - const std::string &OutputFile, - std::string *Error, - const std::vector &GCCArgs = - std::vector(), - const std::vector &SharedLibs = - std::vector(), - unsigned Timeout = 0, - unsigned MemoryLimit = 0) { + void compileProgram(const std::string &Bitcode, + std::string *Error, + unsigned Timeout = 0, + unsigned MemoryLimit = 0) override; + + int ExecuteProgram(const std::string &Bitcode, + const std::vector &Args, + const std::string &InputFile, + const std::string &OutputFile, + std::string *Error, + const std::vector &GCCArgs = + std::vector(), + const std::vector &SharedLibs = + std::vector(), + unsigned Timeout = 0, + unsigned MemoryLimit = 0) override { *Error = "Execution not supported with -compile-custom"; return -1; } @@ -355,16 +355,16 @@ namespace { const std::string &ExecutionCmd, std::vector ExecArgs) : ExecutionCommand(ExecutionCmd), ExecutorArgs(ExecArgs) {} - virtual int ExecuteProgram(const std::string &Bitcode, - const std::vector &Args, - const std::string &InputFile, - const std::string &OutputFile, - std::string *Error, - const std::vector &GCCArgs, - const std::vector &SharedLibs = - std::vector(), - unsigned Timeout = 0, - unsigned MemoryLimit = 0); + int ExecuteProgram(const std::string &Bitcode, + const std::vector &Args, + const std::string &InputFile, + const std::string &OutputFile, + std::string *Error, + const std::vector &GCCArgs, + const std::vector &SharedLibs = + std::vector(), + unsigned Timeout = 0, + unsigned MemoryLimit = 0) override; }; } @@ -584,17 +584,17 @@ namespace { if (Args) { ToolArgs = *Args; } } - virtual int ExecuteProgram(const std::string &Bitcode, - const std::vector &Args, - const std::string &InputFile, - const std::string &OutputFile, - std::string *Error, - const std::vector &GCCArgs = - std::vector(), - const std::vector &SharedLibs = - std::vector(), - unsigned Timeout = 0, - unsigned MemoryLimit = 0); + int ExecuteProgram(const std::string &Bitcode, + const std::vector &Args, + const std::string &InputFile, + const std::string &OutputFile, + std::string *Error, + const std::vector &GCCArgs = + std::vector(), + const std::vector &SharedLibs = + std::vector(), + unsigned Timeout = 0, + unsigned MemoryLimit = 0) override; }; } diff --git a/llvm/tools/bugpoint/ToolRunner.h b/llvm/tools/bugpoint/ToolRunner.h index bc2be46..38a5835 100644 --- a/llvm/tools/bugpoint/ToolRunner.h +++ b/llvm/tools/bugpoint/ToolRunner.h @@ -168,29 +168,29 @@ public: /// compileProgram - Compile the specified program from bitcode to executable /// code. This does not produce any output, it is only used when debugging /// the code generator. Returns false if the code generator fails. - virtual void compileProgram(const std::string &Bitcode, std::string *Error, - unsigned Timeout = 0, unsigned MemoryLimit = 0); + void compileProgram(const std::string &Bitcode, std::string *Error, + unsigned Timeout = 0, unsigned MemoryLimit = 0) override; - virtual int ExecuteProgram(const std::string &Bitcode, - const std::vector &Args, - const std::string &InputFile, - const std::string &OutputFile, - std::string *Error, - const std::vector &GCCArgs = - std::vector(), - const std::vector &SharedLibs = - std::vector(), - unsigned Timeout = 0, - unsigned MemoryLimit = 0); + int ExecuteProgram(const std::string &Bitcode, + const std::vector &Args, + const std::string &InputFile, + const std::string &OutputFile, + std::string *Error, + const std::vector &GCCArgs = + std::vector(), + const std::vector &SharedLibs = + std::vector(), + unsigned Timeout = 0, + unsigned MemoryLimit = 0) override; /// OutputCode - Compile the specified program from bitcode to code /// 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 /// emitted. - virtual GCC::FileType OutputCode(const std::string &Bitcode, - std::string &OutFile, std::string &Error, - unsigned Timeout = 0, - unsigned MemoryLimit = 0); + GCC::FileType OutputCode(const std::string &Bitcode, + std::string &OutFile, std::string &Error, + unsigned Timeout = 0, + unsigned MemoryLimit = 0) override; }; } // End llvm namespace diff --git a/llvm/tools/bugpoint/bugpoint.cpp b/llvm/tools/bugpoint/bugpoint.cpp index f664a07..b794340 100644 --- a/llvm/tools/bugpoint/bugpoint.cpp +++ b/llvm/tools/bugpoint/bugpoint.cpp @@ -101,7 +101,7 @@ namespace { public: AddToDriver(BugDriver &_D) : FunctionPassManager(0), D(_D) {} - virtual void add(Pass *P) { + void add(Pass *P) override { const void *ID = P->getPassID(); const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(ID); D.addPass(PI->getPassArgument()); diff --git a/llvm/tools/lli/RemoteMemoryManager.h b/llvm/tools/lli/RemoteMemoryManager.h index b9691f4..11f600f 100644 --- a/llvm/tools/lli/RemoteMemoryManager.h +++ b/llvm/tools/lli/RemoteMemoryManager.h @@ -67,45 +67,48 @@ public: virtual ~RemoteMemoryManager(); 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, unsigned SectionID, StringRef SectionName, - bool IsReadOnly); + bool IsReadOnly) override; // For now, remote symbol resolution is not support in lli. The MCJIT // interface does support this, but clients must provide their own // mechanism for finding remote symbol addresses. MCJIT will resolve // 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 // resolution is a prerequisite to supporting remote EH frame registration. - void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) {} - void deregisterEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) {} + void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr, + 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 void setRemoteTarget(RemoteTarget *T) { Target = T; } // The following obsolete JITMemoryManager calls are stubbed out for // this model. - void setMemoryWritable(); - void setMemoryExecutable(); - void setPoisonMemory(bool poison); - void AllocateGOT(); - uint8_t *getGOTBase() const; - uint8_t *startFunctionBody(const Function *F, uintptr_t &ActualSize); + void setMemoryWritable() override; + void setMemoryExecutable() override; + void setPoisonMemory(bool poison) override; + void AllocateGOT() override; + uint8_t *getGOTBase() const override; + uint8_t *startFunctionBody(const Function *F, uintptr_t &ActualSize) override; uint8_t *allocateStub(const GlobalValue* F, unsigned StubSize, - unsigned Alignment); + unsigned Alignment) override; void endFunctionBody(const Function *F, uint8_t *FunctionStart, - uint8_t *FunctionEnd); - uint8_t *allocateSpace(intptr_t Size, unsigned Alignment); - uint8_t *allocateGlobal(uintptr_t Size, unsigned Alignment); - void deallocateFunctionBody(void *Body); + uint8_t *FunctionEnd) override; + uint8_t *allocateSpace(intptr_t Size, unsigned Alignment) override; + uint8_t *allocateGlobal(uintptr_t Size, unsigned Alignment) override; + void deallocateFunctionBody(void *Body) override; }; } // end namespace llvm diff --git a/llvm/tools/lli/RemoteTargetExternal.h b/llvm/tools/lli/RemoteTargetExternal.h index 587849b..f87fc61 100644 --- a/llvm/tools/lli/RemoteTargetExternal.h +++ b/llvm/tools/lli/RemoteTargetExternal.h @@ -46,9 +46,8 @@ public: /// /// @returns True on success. On failure, ErrorMsg is updated with /// descriptive text of the encountered error. - virtual bool allocateSpace(size_t Size, - unsigned Alignment, - uint64_t &Address); + bool allocateSpace(size_t Size, unsigned Alignment, + uint64_t &Address) override; /// Load data into the target address space. /// @@ -58,7 +57,7 @@ public: /// /// @returns True on success. On failure, ErrorMsg is updated with /// 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. /// @@ -68,7 +67,7 @@ public: /// /// @returns True on success. On failure, ErrorMsg is updated with /// 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 /// to be of signature int "(*)(void)". @@ -79,16 +78,16 @@ public: /// /// @returns True on success. On failure, ErrorMsg is updated with /// 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 /// data regions to make sure data doesn't get marked as code or vice /// versa. /// /// @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; if (!RPC.createServer()) return true; @@ -104,7 +103,7 @@ public: } /// Terminate the remote process. - virtual void stop(); + void stop() override; RemoteTargetExternal(std::string &Name) : RemoteTarget(), ChildName(Name) {} virtual ~RemoteTargetExternal() {} diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp index a9125a4..c0c0f9d 100644 --- a/llvm/tools/lli/lli.cpp +++ b/llvm/tools/lli/lli.cpp @@ -262,7 +262,7 @@ public: } 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(); std::string CacheName; if (!getCacheFilename(ModuleID, CacheName)) @@ -278,7 +278,7 @@ public: outfile.close(); } - virtual MemoryBuffer* getObject(const Module* M) { + MemoryBuffer* getObject(const Module* M) override { const std::string ModuleID = M->getModuleIdentifier(); std::string CacheName; if (!getCacheFilename(ModuleID, CacheName)) diff --git a/llvm/tools/llvm-diff/DiffConsumer.h b/llvm/tools/llvm-diff/DiffConsumer.h index 6c2209f..ac13a5e 100644 --- a/llvm/tools/llvm-diff/DiffConsumer.h +++ b/llvm/tools/llvm-diff/DiffConsumer.h @@ -79,11 +79,11 @@ namespace llvm { : out(errs()), Differences(false), Indent(0) {} bool hadDifferences() const; - void enterContext(Value *L, Value *R); - void exitContext(); - void log(StringRef text); - void logf(const LogBuilder &Log); - void logd(const DiffLogBuilder &Log); + void enterContext(Value *L, Value *R) override; + void exitContext() override; + void log(StringRef text) override; + void logf(const LogBuilder &Log) override; + void logd(const DiffLogBuilder &Log) override; }; } diff --git a/llvm/tools/llvm-dis/llvm-dis.cpp b/llvm/tools/llvm-dis/llvm-dis.cpp index df649cc..c6f0dcf 100644 --- a/llvm/tools/llvm-dis/llvm-dis.cpp +++ b/llvm/tools/llvm-dis/llvm-dis.cpp @@ -66,11 +66,11 @@ static void printDebugLoc(const DebugLoc &DL, formatted_raw_ostream &OS) { class CommentWriter : public AssemblyAnnotationWriter { public: void emitFunctionAnnot(const Function *F, - formatted_raw_ostream &OS) { + formatted_raw_ostream &OS) override { OS << "; [#uses=" << F->getNumUses() << ']'; // Output # uses OS << '\n'; } - void printInfoComment(const Value &V, formatted_raw_ostream &OS) { + void printInfoComment(const Value &V, formatted_raw_ostream &OS) override { bool Padded = false; if (!V.getType()->isVoidTy()) { OS.PadToColumn(50); diff --git a/llvm/tools/llvm-mc/Disassembler.cpp b/llvm/tools/llvm-mc/Disassembler.cpp index 509a1d4..9c402f23 100644 --- a/llvm/tools/llvm-mc/Disassembler.cpp +++ b/llvm/tools/llvm-mc/Disassembler.cpp @@ -35,10 +35,10 @@ private: public: VectorMemoryObject(const ByteArrayTy &bytes) : Bytes(bytes) {} - uint64_t getBase() const { return 0; } - uint64_t getExtent() const { return Bytes.size(); } + uint64_t getBase() const override { return 0; } + 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()) return -1; *Byte = Bytes[Addr].first; diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp index cc51089..e4532a5 100644 --- a/llvm/tools/llvm-readobj/ELFDumper.cpp +++ b/llvm/tools/llvm-readobj/ELFDumper.cpp @@ -42,18 +42,18 @@ public: ELFDumper(const ELFFile *Obj, StreamWriter &Writer) : ObjDumper(Writer), Obj(Obj) {} - virtual void printFileHeaders() override; - virtual void printSections() override; - virtual void printRelocations() override; - virtual void printSymbols() override; - virtual void printDynamicSymbols() override; - virtual void printUnwindInfo() override; - - virtual void printDynamicTable() override; - virtual void printNeededLibraries() override; - virtual void printProgramHeaders() override; - - virtual void printAttributes() override; + void printFileHeaders() override; + void printSections() override; + void printRelocations() override; + void printSymbols() override; + void printDynamicSymbols() override; + void printUnwindInfo() override; + + void printDynamicTable() override; + void printNeededLibraries() override; + void printProgramHeaders() override; + + void printAttributes() override; private: typedef ELFFile ELFO; diff --git a/llvm/tools/llvm-readobj/Error.cpp b/llvm/tools/llvm-readobj/Error.cpp index a6c6132..1aed92b 100644 --- a/llvm/tools/llvm-readobj/Error.cpp +++ b/llvm/tools/llvm-readobj/Error.cpp @@ -19,9 +19,9 @@ using namespace llvm; namespace { class _readobj_error_category : public _do_message { public: - virtual const char* name() const; - virtual std::string message(int ev) const; - virtual error_condition default_error_condition(int ev) const; + const char* name() const override; + std::string message(int ev) const override; + error_condition default_error_condition(int ev) const override; }; } // namespace diff --git a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp index ffac5dc..ac43653 100644 --- a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp +++ b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp @@ -61,17 +61,18 @@ public: SmallVector DataMemory; 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, unsigned SectionID, StringRef SectionName, - bool IsReadOnly); + bool IsReadOnly) override; - virtual void *getPointerToNamedFunction(const std::string &Name, - bool AbortOnFailure = true) { + void *getPointerToNamedFunction(const std::string &Name, + bool AbortOnFailure = true) override { 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. // Some platforms with separate data cache and instruction cache require diff --git a/llvm/tools/llvm-stress/llvm-stress.cpp b/llvm/tools/llvm-stress/llvm-stress.cpp index 6afcae4..18f1e6c 100644 --- a/llvm/tools/llvm-stress/llvm-stress.cpp +++ b/llvm/tools/llvm-stress/llvm-stress.cpp @@ -288,7 +288,7 @@ protected: struct LoadModifier: public Modifier { 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; Value *Ptr = getRandomPointerValue(); Value *V = new LoadInst(Ptr, "L", BB->getTerminator()); @@ -298,7 +298,7 @@ struct LoadModifier: public Modifier { struct StoreModifier: public Modifier { 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; Value *Ptr = getRandomPointerValue(); Type *Tp = Ptr->getType(); @@ -317,7 +317,7 @@ struct StoreModifier: public Modifier { struct BinModifier: public Modifier { BinModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {} - virtual void Act() { + void Act() override { Value *Val0 = getRandomVal(); Value *Val1 = getRandomValue(Val0->getType()); @@ -360,7 +360,7 @@ struct BinModifier: public Modifier { /// Generate constant values. struct ConstModifier: public Modifier { ConstModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {} - virtual void Act() { + void Act() override { Type *Ty = pickType(); if (Ty->isVectorTy()) { @@ -407,7 +407,7 @@ struct ConstModifier: public Modifier { struct AllocaModifier: public Modifier { AllocaModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R){} - virtual void Act() { + void Act() override { Type *Tp = pickType(); PT->push_back(new AllocaInst(Tp, "A", BB->getFirstNonPHI())); } @@ -417,7 +417,7 @@ struct ExtractElementModifier: public Modifier { ExtractElementModifier(BasicBlock *BB, PieceTable *PT, Random *R): Modifier(BB, PT, R) {} - virtual void Act() { + void Act() override { Value *Val0 = getRandomVectorValue(); Value *V = ExtractElementInst::Create(Val0, ConstantInt::get(Type::getInt32Ty(BB->getContext()), @@ -429,7 +429,7 @@ struct ExtractElementModifier: public Modifier { struct ShuffModifier: public Modifier { ShuffModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {} - virtual void Act() { + void Act() override { Value *Val0 = getRandomVectorValue(); Value *Val1 = getRandomValue(Val0->getType()); @@ -458,7 +458,7 @@ struct InsertElementModifier: public Modifier { InsertElementModifier(BasicBlock *BB, PieceTable *PT, Random *R): Modifier(BB, PT, R) {} - virtual void Act() { + void Act() override { Value *Val0 = getRandomVectorValue(); Value *Val1 = getRandomValue(Val0->getType()->getScalarType()); @@ -473,7 +473,7 @@ struct InsertElementModifier: public Modifier { struct CastModifier: public Modifier { CastModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {} - virtual void Act() { + void Act() override { Value *V = getRandomVal(); Type *VTy = V->getType(); @@ -560,7 +560,7 @@ struct SelectModifier: public Modifier { SelectModifier(BasicBlock *BB, PieceTable *PT, Random *R): Modifier(BB, PT, R) {} - virtual void Act() { + void Act() override { // Try a bunch of different select configuration until a valid one is found. Value *Val0 = getRandomVal(); Value *Val1 = getRandomValue(Val0->getType()); @@ -583,7 +583,7 @@ struct SelectModifier: public Modifier { struct CmpModifier: public Modifier { CmpModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {} - virtual void Act() { + void Act() override { Value *Val0 = getRandomVal(); Value *Val1 = getRandomValue(Val0->getType()); diff --git a/llvm/tools/opt/AnalysisWrappers.cpp b/llvm/tools/opt/AnalysisWrappers.cpp index b9c627d..1774ea0 100644 --- a/llvm/tools/opt/AnalysisWrappers.cpp +++ b/llvm/tools/opt/AnalysisWrappers.cpp @@ -32,7 +32,7 @@ namespace { struct ExternalFunctionsPassedConstants : public ModulePass { static char ID; // Pass ID, replacement for typeid ExternalFunctionsPassedConstants() : ModulePass(ID) {} - virtual bool runOnModule(Module &M) { + bool runOnModule(Module &M) override { for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { if (!I->isDeclaration()) continue; @@ -62,7 +62,7 @@ namespace { return false; } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); } }; @@ -78,11 +78,11 @@ namespace { static char ID; // Pass ID, replacement for typeid CallGraphPrinter() : ModulePass(ID) {} - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); AU.addRequiredTransitive(); } - virtual bool runOnModule(Module &M) { + bool runOnModule(Module &M) override { getAnalysis().print(errs(), &M); return false; } diff --git a/llvm/tools/opt/BreakpointPrinter.cpp b/llvm/tools/opt/BreakpointPrinter.cpp index 66e93fde..44f4a11 100644 --- a/llvm/tools/opt/BreakpointPrinter.cpp +++ b/llvm/tools/opt/BreakpointPrinter.cpp @@ -45,7 +45,7 @@ struct BreakpointPrinter : public ModulePass { } } - virtual bool runOnModule(Module &M) { + bool runOnModule(Module &M) override { TypeIdentifierMap.clear(); NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu"); if (CU_Nodes) @@ -69,7 +69,7 @@ struct BreakpointPrinter : public ModulePass { return false; } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); } }; diff --git a/llvm/tools/opt/GraphPrinters.cpp b/llvm/tools/opt/GraphPrinters.cpp index b299f4c..640edfe 100644 --- a/llvm/tools/opt/GraphPrinters.cpp +++ b/llvm/tools/opt/GraphPrinters.cpp @@ -29,12 +29,12 @@ namespace { static char ID; // Pass identification, replacement for typeid DomInfoPrinter() : FunctionPass(ID) {} - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); AU.addRequired(); } - virtual bool runOnFunction(Function &F) { + bool runOnFunction(Function &F) override { getAnalysis().dump(); return false; } diff --git a/llvm/tools/opt/PassPrinters.cpp b/llvm/tools/opt/PassPrinters.cpp index b809d1d..d699489 100644 --- a/llvm/tools/opt/PassPrinters.cpp +++ b/llvm/tools/opt/PassPrinters.cpp @@ -36,7 +36,7 @@ struct FunctionPassPrinter : public FunctionPass { PassName = "FunctionPass Printer: " + PassToPrintName; } - virtual bool runOnFunction(Function &F) { + bool runOnFunction(Function &F) override { if (!QuietPass) Out << "Printing analysis '" << PassToPrint->getPassName() << "' for function '" << F.getName() << "':\n"; @@ -46,9 +46,9 @@ struct FunctionPassPrinter : public FunctionPass { return false; } - virtual const char *getPassName() const { return PassName.c_str(); } + const char *getPassName() const override { return PassName.c_str(); } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } @@ -69,7 +69,7 @@ struct CallGraphSCCPassPrinter : public CallGraphSCCPass { PassName = "CallGraphSCCPass Printer: " + PassToPrintName; } - virtual bool runOnSCC(CallGraphSCC &SCC) { + bool runOnSCC(CallGraphSCC &SCC) override { if (!QuietPass) Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n"; @@ -83,9 +83,9 @@ struct CallGraphSCCPassPrinter : public CallGraphSCCPass { return false; } - virtual const char *getPassName() const { return PassName.c_str(); } + const char *getPassName() const override { return PassName.c_str(); } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } @@ -106,7 +106,7 @@ struct ModulePassPrinter : public ModulePass { PassName = "ModulePass Printer: " + PassToPrintName; } - virtual bool runOnModule(Module &M) { + bool runOnModule(Module &M) override { if (!QuietPass) Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n"; @@ -115,9 +115,9 @@ struct ModulePassPrinter : public ModulePass { return false; } - virtual const char *getPassName() const { return PassName.c_str(); } + const char *getPassName() const override { return PassName.c_str(); } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } @@ -138,7 +138,7 @@ struct LoopPassPrinter : public LoopPass { PassName = "LoopPass Printer: " + PassToPrintName; } - virtual bool runOnLoop(Loop *L, LPPassManager &LPM) { + bool runOnLoop(Loop *L, LPPassManager &LPM) override { if (!QuietPass) Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n"; @@ -148,9 +148,9 @@ struct LoopPassPrinter : public LoopPass { return false; } - virtual const char *getPassName() const { return PassName.c_str(); } + const char *getPassName() const override { return PassName.c_str(); } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } @@ -171,7 +171,7 @@ struct RegionPassPrinter : public RegionPass { PassName = "RegionPass Printer: " + PassToPrintName; } - virtual bool runOnRegion(Region *R, RGPassManager &RGM) { + bool runOnRegion(Region *R, RGPassManager &RGM) override { if (!QuietPass) { Out << "Printing analysis '" << PassToPrint->getPassName() << "' for " << "region: '" << R->getNameStr() << "' in function '" @@ -183,9 +183,9 @@ struct RegionPassPrinter : public RegionPass { return false; } - virtual const char *getPassName() const { return PassName.c_str(); } + const char *getPassName() const override { return PassName.c_str(); } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } @@ -206,7 +206,7 @@ struct BasicBlockPassPrinter : public BasicBlockPass { PassName = "BasicBlockPass Printer: " + PassToPrintName; } - virtual bool runOnBasicBlock(BasicBlock &BB) { + bool runOnBasicBlock(BasicBlock &BB) override { if (!QuietPass) Out << "Printing Analysis info for BasicBlock '" << BB.getName() << "': Pass " << PassToPrint->getPassName() << ":\n"; @@ -217,9 +217,9 @@ struct BasicBlockPassPrinter : public BasicBlockPass { return false; } - virtual const char *getPassName() const { return PassName.c_str(); } + const char *getPassName() const override { return PassName.c_str(); } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } diff --git a/llvm/tools/opt/PrintSCC.cpp b/llvm/tools/opt/PrintSCC.cpp index f2e77f0..cbc0a55 100644 --- a/llvm/tools/opt/PrintSCC.cpp +++ b/llvm/tools/opt/PrintSCC.cpp @@ -37,11 +37,11 @@ namespace { struct CFGSCC : public FunctionPass { static char ID; // Pass identification, replacement for typeid CFGSCC() : FunctionPass(ID) {} - bool runOnFunction(Function& func); + bool runOnFunction(Function& func) override; - void print(raw_ostream &O, const Module* = 0) const { } + void print(raw_ostream &O, const Module* = 0) const override { } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); } }; @@ -51,12 +51,12 @@ namespace { CallGraphSCC() : ModulePass(ID) {} // run - Print out SCCs in the call graph for the specified module. - bool runOnModule(Module &M); + bool runOnModule(Module &M) override; - void print(raw_ostream &O, const Module* = 0) const { } + void print(raw_ostream &O, const Module* = 0) const override { } // getAnalysisUsage - This pass requires the CallGraph. - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); AU.addRequired(); } -- 2.7.4