From c83e68f7326f424876198514eb2ad89110f52c45 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sat, 8 Mar 2014 08:27:28 +0000 Subject: [C++11] Add 'override' keyword to virtual methods that override their base class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203345 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IR/PassManager.h | 20 ++++---- tools/bugpoint-passes/TestPasses.cpp | 6 +-- tools/bugpoint/CrashDebugger.cpp | 30 ++++++------ tools/bugpoint/Miscompilation.cpp | 18 +++---- tools/bugpoint/ToolRunner.cpp | 94 ++++++++++++++++++------------------ tools/bugpoint/ToolRunner.h | 34 ++++++------- tools/bugpoint/bugpoint.cpp | 2 +- tools/lli/RemoteMemoryManager.h | 39 ++++++++------- tools/lli/RemoteTargetExternal.h | 17 +++---- tools/lli/lli.cpp | 4 +- tools/llvm-diff/DiffConsumer.h | 10 ++-- tools/llvm-dis/llvm-dis.cpp | 4 +- tools/llvm-mc/Disassembler.cpp | 6 +-- tools/llvm-readobj/ELFDumper.cpp | 24 ++++----- tools/llvm-readobj/Error.cpp | 6 +-- tools/llvm-rtdyld/llvm-rtdyld.cpp | 11 +++-- tools/llvm-stress/llvm-stress.cpp | 22 ++++----- tools/opt/AnalysisWrappers.cpp | 8 +-- tools/opt/BreakpointPrinter.cpp | 4 +- tools/opt/GraphPrinters.cpp | 4 +- tools/opt/PassPrinters.cpp | 36 +++++++------- tools/opt/PrintSCC.cpp | 12 ++--- 22 files changed, 207 insertions(+), 204 deletions(-) diff --git a/include/llvm/IR/PassManager.h b/include/llvm/IR/PassManager.h index 4057771e20..e4260ba77d 100644 --- a/include/llvm/IR/PassManager.h +++ b/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/tools/bugpoint/CrashDebugger.cpp b/tools/bugpoint/CrashDebugger.cpp index 3918030479..bdaa6c9c89 100644 --- a/tools/bugpoint/CrashDebugger.cpp +++ b/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/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp index db26fe2ea0..fecae60c41 100644 --- a/tools/bugpoint/Miscompilation.cpp +++ b/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/tools/bugpoint/ToolRunner.cpp b/tools/bugpoint/ToolRunner.cpp index 22199f8144..f0fb4bf6f5 100644 --- a/tools/bugpoint/ToolRunner.cpp +++ b/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/tools/bugpoint/ToolRunner.h b/tools/bugpoint/ToolRunner.h index bc2be46b32..38a58356a6 100644 --- a/tools/bugpoint/ToolRunner.h +++ b/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/tools/bugpoint/bugpoint.cpp b/tools/bugpoint/bugpoint.cpp index f664a07a99..b79434080d 100644 --- a/tools/bugpoint/bugpoint.cpp +++ b/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/tools/lli/RemoteMemoryManager.h b/tools/lli/RemoteMemoryManager.h index b9691f4470..11f600f3c7 100644 --- a/tools/lli/RemoteMemoryManager.h +++ b/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/tools/lli/RemoteTargetExternal.h b/tools/lli/RemoteTargetExternal.h index 587849b906..f87fc6199f 100644 --- a/tools/lli/RemoteTargetExternal.h +++ b/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/tools/lli/lli.cpp b/tools/lli/lli.cpp index a9125a48b8..c0c0f9d2b2 100644 --- a/tools/lli/lli.cpp +++ b/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/tools/llvm-diff/DiffConsumer.h b/tools/llvm-diff/DiffConsumer.h index 6c2209f27e..ac13a5e3e5 100644 --- a/tools/llvm-diff/DiffConsumer.h +++ b/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/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp index df649cccff..c6f0dcf6ae 100644 --- a/tools/llvm-dis/llvm-dis.cpp +++ b/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/tools/llvm-mc/Disassembler.cpp b/tools/llvm-mc/Disassembler.cpp index 509a1d4ec3..9c402f2305 100644 --- a/tools/llvm-mc/Disassembler.cpp +++ b/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/tools/llvm-readobj/ELFDumper.cpp b/tools/llvm-readobj/ELFDumper.cpp index cc51089afd..e4532a5476 100644 --- a/tools/llvm-readobj/ELFDumper.cpp +++ b/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/tools/llvm-readobj/Error.cpp b/tools/llvm-readobj/Error.cpp index a6c61321c6..1aed92bc8d 100644 --- a/tools/llvm-readobj/Error.cpp +++ b/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/tools/llvm-rtdyld/llvm-rtdyld.cpp b/tools/llvm-rtdyld/llvm-rtdyld.cpp index ffac5dce82..ac43653d58 100644 --- a/tools/llvm-rtdyld/llvm-rtdyld.cpp +++ b/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/tools/llvm-stress/llvm-stress.cpp b/tools/llvm-stress/llvm-stress.cpp index 6afcae43f9..18f1e6ca1b 100644 --- a/tools/llvm-stress/llvm-stress.cpp +++ b/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/tools/opt/AnalysisWrappers.cpp b/tools/opt/AnalysisWrappers.cpp index b9c627d8f5..1774ea0295 100644 --- a/tools/opt/AnalysisWrappers.cpp +++ b/tools/opt/AnalysisWrappers.cpp @@ -32,7 +32,7 @@ namespace { struct ExternalFunctionsPassedConstants : public ModulePass { static char ID; // Pass ID, replacement for typeid ExternalFunctionsPassedConstants() : ModulePass(ID) {} - virtual bool runOnModule(Module &M) { + bool runOnModule(Module &M) override { for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { if (!I->isDeclaration()) continue; @@ -62,7 +62,7 @@ namespace { return false; } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); } }; @@ -78,11 +78,11 @@ namespace { static char ID; // Pass ID, replacement for typeid CallGraphPrinter() : ModulePass(ID) {} - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); AU.addRequiredTransitive(); } - virtual bool runOnModule(Module &M) { + bool runOnModule(Module &M) override { getAnalysis().print(errs(), &M); return false; } diff --git a/tools/opt/BreakpointPrinter.cpp b/tools/opt/BreakpointPrinter.cpp index 66e93fde38..44f4a11773 100644 --- a/tools/opt/BreakpointPrinter.cpp +++ b/tools/opt/BreakpointPrinter.cpp @@ -45,7 +45,7 @@ struct BreakpointPrinter : public ModulePass { } } - virtual bool runOnModule(Module &M) { + bool runOnModule(Module &M) override { TypeIdentifierMap.clear(); NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu"); if (CU_Nodes) @@ -69,7 +69,7 @@ struct BreakpointPrinter : public ModulePass { return false; } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); } }; diff --git a/tools/opt/GraphPrinters.cpp b/tools/opt/GraphPrinters.cpp index b299f4c362..640edfee41 100644 --- a/tools/opt/GraphPrinters.cpp +++ b/tools/opt/GraphPrinters.cpp @@ -29,12 +29,12 @@ namespace { static char ID; // Pass identification, replacement for typeid DomInfoPrinter() : FunctionPass(ID) {} - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); AU.addRequired(); } - virtual bool runOnFunction(Function &F) { + bool runOnFunction(Function &F) override { getAnalysis().dump(); return false; } diff --git a/tools/opt/PassPrinters.cpp b/tools/opt/PassPrinters.cpp index b809d1d405..d6994894ca 100644 --- a/tools/opt/PassPrinters.cpp +++ b/tools/opt/PassPrinters.cpp @@ -36,7 +36,7 @@ struct FunctionPassPrinter : public FunctionPass { PassName = "FunctionPass Printer: " + PassToPrintName; } - virtual bool runOnFunction(Function &F) { + bool runOnFunction(Function &F) override { if (!QuietPass) Out << "Printing analysis '" << PassToPrint->getPassName() << "' for function '" << F.getName() << "':\n"; @@ -46,9 +46,9 @@ struct FunctionPassPrinter : public FunctionPass { return false; } - virtual const char *getPassName() const { return PassName.c_str(); } + const char *getPassName() const override { return PassName.c_str(); } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } @@ -69,7 +69,7 @@ struct CallGraphSCCPassPrinter : public CallGraphSCCPass { PassName = "CallGraphSCCPass Printer: " + PassToPrintName; } - virtual bool runOnSCC(CallGraphSCC &SCC) { + bool runOnSCC(CallGraphSCC &SCC) override { if (!QuietPass) Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n"; @@ -83,9 +83,9 @@ struct CallGraphSCCPassPrinter : public CallGraphSCCPass { return false; } - virtual const char *getPassName() const { return PassName.c_str(); } + const char *getPassName() const override { return PassName.c_str(); } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } @@ -106,7 +106,7 @@ struct ModulePassPrinter : public ModulePass { PassName = "ModulePass Printer: " + PassToPrintName; } - virtual bool runOnModule(Module &M) { + bool runOnModule(Module &M) override { if (!QuietPass) Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n"; @@ -115,9 +115,9 @@ struct ModulePassPrinter : public ModulePass { return false; } - virtual const char *getPassName() const { return PassName.c_str(); } + const char *getPassName() const override { return PassName.c_str(); } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } @@ -138,7 +138,7 @@ struct LoopPassPrinter : public LoopPass { PassName = "LoopPass Printer: " + PassToPrintName; } - virtual bool runOnLoop(Loop *L, LPPassManager &LPM) { + bool runOnLoop(Loop *L, LPPassManager &LPM) override { if (!QuietPass) Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n"; @@ -148,9 +148,9 @@ struct LoopPassPrinter : public LoopPass { return false; } - virtual const char *getPassName() const { return PassName.c_str(); } + const char *getPassName() const override { return PassName.c_str(); } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } @@ -171,7 +171,7 @@ struct RegionPassPrinter : public RegionPass { PassName = "RegionPass Printer: " + PassToPrintName; } - virtual bool runOnRegion(Region *R, RGPassManager &RGM) { + bool runOnRegion(Region *R, RGPassManager &RGM) override { if (!QuietPass) { Out << "Printing analysis '" << PassToPrint->getPassName() << "' for " << "region: '" << R->getNameStr() << "' in function '" @@ -183,9 +183,9 @@ struct RegionPassPrinter : public RegionPass { return false; } - virtual const char *getPassName() const { return PassName.c_str(); } + const char *getPassName() const override { return PassName.c_str(); } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } @@ -206,7 +206,7 @@ struct BasicBlockPassPrinter : public BasicBlockPass { PassName = "BasicBlockPass Printer: " + PassToPrintName; } - virtual bool runOnBasicBlock(BasicBlock &BB) { + bool runOnBasicBlock(BasicBlock &BB) override { if (!QuietPass) Out << "Printing Analysis info for BasicBlock '" << BB.getName() << "': Pass " << PassToPrint->getPassName() << ":\n"; @@ -217,9 +217,9 @@ struct BasicBlockPassPrinter : public BasicBlockPass { return false; } - virtual const char *getPassName() const { return PassName.c_str(); } + const char *getPassName() const override { return PassName.c_str(); } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } diff --git a/tools/opt/PrintSCC.cpp b/tools/opt/PrintSCC.cpp index f2e77f0cef..cbc0a55996 100644 --- a/tools/opt/PrintSCC.cpp +++ b/tools/opt/PrintSCC.cpp @@ -37,11 +37,11 @@ namespace { struct CFGSCC : public FunctionPass { static char ID; // Pass identification, replacement for typeid CFGSCC() : FunctionPass(ID) {} - bool runOnFunction(Function& func); + bool runOnFunction(Function& func) override; - void print(raw_ostream &O, const Module* = 0) const { } + void print(raw_ostream &O, const Module* = 0) const override { } - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); } }; @@ -51,12 +51,12 @@ namespace { CallGraphSCC() : ModulePass(ID) {} // run - Print out SCCs in the call graph for the specified module. - bool runOnModule(Module &M); + bool runOnModule(Module &M) override; - void print(raw_ostream &O, const Module* = 0) const { } + void print(raw_ostream &O, const Module* = 0) const override { } // getAnalysisUsage - This pass requires the CallGraph. - virtual void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); AU.addRequired(); } -- cgit v1.2.3