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

llvm-svn: 203345
This commit is contained in:
Craig Topper 2014-03-08 08:27:28 +00:00
parent b51ff603ea
commit e56917c0ca
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,
true> : PassConcept<IRUnitT, AnalysisManagerT> {
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 <typename IRUnitT, typename AnalysisManagerT, typename PassT>
struct PassModel<IRUnitT, AnalysisManagerT, PassT,
false> : PassConcept<IRUnitT, AnalysisManagerT> {
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 <typename IRUnitT, typename PassT, typename ResultT>
struct AnalysisResultModel<IRUnitT, PassT, ResultT,
true> : AnalysisResultConcept<IRUnitT> {
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<IRUnitT, AnalysisManagerT, PassT,
false> : AnalysisPassConcept<IRUnitT,
AnalysisManagerT> {
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<IRUnitT, PassT, typename PassT::Result>
@ -380,7 +380,7 @@ struct AnalysisPassModel<IRUnitT, AnalysisManagerT, PassT,
/// \brief The model delegates to the \c PassT::run method.
///
/// 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));
}

View File

@ -29,11 +29,11 @@ namespace {
static char ID; // Pass ID, replacement for typeid
CrashOnCalls() : BasicBlockPass(ID) {}
private:
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll();
}
bool runOnBasicBlock(BasicBlock &BB) {
bool runOnBasicBlock(BasicBlock &BB) override {
for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I)
if (isa<CallInst>(*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<CallInst>(I)) {
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"
// passes. If we return true, we update the current module of bugpoint.
//
virtual TestResult doTest(std::vector<std::string> &Removed,
std::vector<std::string> &Kept,
std::string &Error);
TestResult doTest(std::vector<std::string> &Removed,
std::vector<std::string> &Kept,
std::string &Error) override;
};
}
@ -110,9 +110,9 @@ namespace {
bool (*testFn)(const BugDriver &, Module *))
: BD(bd), TestFn(testFn) {}
virtual TestResult doTest(std::vector<GlobalVariable*> &Prefix,
std::vector<GlobalVariable*> &Kept,
std::string &Error) {
TestResult doTest(std::vector<GlobalVariable*> &Prefix,
std::vector<GlobalVariable*> &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<Function*> &Prefix,
std::vector<Function*> &Kept,
std::string &Error) {
TestResult doTest(std::vector<Function*> &Prefix,
std::vector<Function*> &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<const BasicBlock*> &Prefix,
std::vector<const BasicBlock*> &Kept,
std::string &Error) {
TestResult doTest(std::vector<const BasicBlock*> &Prefix,
std::vector<const BasicBlock*> &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<const Instruction*> &Prefix,
std::vector<const Instruction*> &Kept,
std::string &Error) {
TestResult doTest(std::vector<const Instruction*> &Prefix,
std::vector<const Instruction*> &Kept,
std::string &Error) override {
if (!Kept.empty() && TestInsts(Kept))
return KeepSuffix;
if (!Prefix.empty() && TestInsts(Prefix))

View File

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

View File

@ -178,16 +178,16 @@ namespace {
if (Args) { ToolArgs = *Args; }
}
virtual int ExecuteProgram(const std::string &Bitcode,
const std::vector<std::string> &Args,
const std::string &InputFile,
const std::string &OutputFile,
std::string *Error,
const std::vector<std::string> &GCCArgs,
const std::vector<std::string> &SharedLibs =
std::vector<std::string>(),
unsigned Timeout = 0,
unsigned MemoryLimit = 0);
int ExecuteProgram(const std::string &Bitcode,
const std::vector<std::string> &Args,
const std::string &InputFile,
const std::string &OutputFile,
std::string *Error,
const std::vector<std::string> &GCCArgs,
const std::vector<std::string> &SharedLibs =
std::vector<std::string>(),
unsigned Timeout = 0,
unsigned MemoryLimit = 0) override;
};
}
@ -294,22 +294,22 @@ namespace {
const std::string &CompilerCmd, std::vector<std::string> CompArgs) :
CompilerCommand(CompilerCmd), CompilerArgs(CompArgs) {}
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<std::string> &Args,
const std::string &InputFile,
const std::string &OutputFile,
std::string *Error,
const std::vector<std::string> &GCCArgs =
std::vector<std::string>(),
const std::vector<std::string> &SharedLibs =
std::vector<std::string>(),
unsigned Timeout = 0,
unsigned MemoryLimit = 0) {
int ExecuteProgram(const std::string &Bitcode,
const std::vector<std::string> &Args,
const std::string &InputFile,
const std::string &OutputFile,
std::string *Error,
const std::vector<std::string> &GCCArgs =
std::vector<std::string>(),
const std::vector<std::string> &SharedLibs =
std::vector<std::string>(),
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<std::string> ExecArgs) :
ExecutionCommand(ExecutionCmd), ExecutorArgs(ExecArgs) {}
virtual int ExecuteProgram(const std::string &Bitcode,
const std::vector<std::string> &Args,
const std::string &InputFile,
const std::string &OutputFile,
std::string *Error,
const std::vector<std::string> &GCCArgs,
const std::vector<std::string> &SharedLibs =
std::vector<std::string>(),
unsigned Timeout = 0,
unsigned MemoryLimit = 0);
int ExecuteProgram(const std::string &Bitcode,
const std::vector<std::string> &Args,
const std::string &InputFile,
const std::string &OutputFile,
std::string *Error,
const std::vector<std::string> &GCCArgs,
const std::vector<std::string> &SharedLibs =
std::vector<std::string>(),
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<std::string> &Args,
const std::string &InputFile,
const std::string &OutputFile,
std::string *Error,
const std::vector<std::string> &GCCArgs =
std::vector<std::string>(),
const std::vector<std::string> &SharedLibs =
std::vector<std::string>(),
unsigned Timeout = 0,
unsigned MemoryLimit = 0);
int ExecuteProgram(const std::string &Bitcode,
const std::vector<std::string> &Args,
const std::string &InputFile,
const std::string &OutputFile,
std::string *Error,
const std::vector<std::string> &GCCArgs =
std::vector<std::string>(),
const std::vector<std::string> &SharedLibs =
std::vector<std::string>(),
unsigned Timeout = 0,
unsigned MemoryLimit = 0) override;
};
}

View File

@ -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<std::string> &Args,
const std::string &InputFile,
const std::string &OutputFile,
std::string *Error,
const std::vector<std::string> &GCCArgs =
std::vector<std::string>(),
const std::vector<std::string> &SharedLibs =
std::vector<std::string>(),
unsigned Timeout = 0,
unsigned MemoryLimit = 0);
int ExecuteProgram(const std::string &Bitcode,
const std::vector<std::string> &Args,
const std::string &InputFile,
const std::string &OutputFile,
std::string *Error,
const std::vector<std::string> &GCCArgs =
std::vector<std::string>(),
const std::vector<std::string> &SharedLibs =
std::vector<std::string>(),
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

View File

@ -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());

View File

@ -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

View File

@ -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() {}

View File

@ -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))

View File

@ -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;
};
}

View File

@ -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);

View File

@ -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;

View File

@ -42,18 +42,18 @@ public:
ELFDumper(const ELFFile<ELFT> *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;
void printFileHeaders() override;
void printSections() override;
void printRelocations() override;
void printSymbols() override;
void printDynamicSymbols() override;
void printUnwindInfo() override;
virtual void printDynamicTable() override;
virtual void printNeededLibraries() override;
virtual void printProgramHeaders() override;
void printDynamicTable() override;
void printNeededLibraries() override;
void printProgramHeaders() override;
virtual void printAttributes() override;
void printAttributes() override;
private:
typedef ELFFile<ELFT> ELFO;

View File

@ -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

View File

@ -61,17 +61,18 @@ public:
SmallVector<sys::MemoryBlock, 16> 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

View File

@ -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());

View File

@ -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<CallGraphWrapperPass>();
}
virtual bool runOnModule(Module &M) {
bool runOnModule(Module &M) override {
getAnalysis<CallGraphWrapperPass>().print(errs(), &M);
return false;
}

View File

@ -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();
}
};

View File

@ -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<DominatorTreeWrapperPass>();
}
virtual bool runOnFunction(Function &F) {
bool runOnFunction(Function &F) override {
getAnalysis<DominatorTreeWrapperPass>().dump();
return false;
}

View File

@ -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();
}

View File

@ -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<CallGraphWrapperPass>();
}