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

llvm-svn: 203344
diff --git a/llvm/lib/ExecutionEngine/JIT/JIT.cpp b/llvm/lib/ExecutionEngine/JIT/JIT.cpp
index b271618..d3ad77b 100644
--- a/llvm/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/JIT.cpp
@@ -450,9 +450,8 @@
     MachineCodeInfo *const MCI;
    public:
     MCIListener(MachineCodeInfo *mci) : MCI(mci) {}
-    virtual void NotifyFunctionEmitted(const Function &,
-                                       void *Code, size_t Size,
-                                       const EmittedFunctionDetails &) {
+    void NotifyFunctionEmitted(const Function &, void *Code, size_t Size,
+                               const EmittedFunctionDetails &) override {
       MCI->setAddress(Code);
       MCI->setSize(Size);
     }
diff --git a/llvm/lib/ExecutionEngine/JIT/JIT.h b/llvm/lib/ExecutionEngine/JIT/JIT.h
index 6af2b4a..b1b0768 100644
--- a/llvm/lib/ExecutionEngine/JIT/JIT.h
+++ b/llvm/lib/ExecutionEngine/JIT/JIT.h
@@ -106,16 +106,16 @@
                                       RM, CMM);
   }
 
-  virtual void addModule(Module *M);
+  void addModule(Module *M) override;
 
   /// removeModule - Remove a Module from the list of modules.  Returns true if
   /// M is found.
-  virtual bool removeModule(Module *M);
+  bool removeModule(Module *M) override;
 
   /// runFunction - Start execution with the specified function and arguments.
   ///
-  virtual GenericValue runFunction(Function *F,
-                                   const std::vector<GenericValue> &ArgValues);
+  GenericValue runFunction(Function *F,
+                           const std::vector<GenericValue> &ArgValues) override;
 
   /// getPointerToNamedFunction - This method returns the address of the
   /// specified function by using the MemoryManager. As such it is only
@@ -125,8 +125,8 @@
   /// found, this function silently returns a null pointer. Otherwise,
   /// it prints a message to stderr and aborts.
   ///
-  virtual void *getPointerToNamedFunction(const std::string &Name,
-                                          bool AbortOnFailure = true);
+  void *getPointerToNamedFunction(const std::string &Name,
+                                  bool AbortOnFailure = true) override;
 
   // CompilationCallback - Invoked the first time that a call site is found,
   // which causes lazy compilation of the target function.
@@ -136,7 +136,7 @@
   /// getPointerToFunction - This returns the address of the specified function,
   /// compiling it if necessary.
   ///
-  void *getPointerToFunction(Function *F);
+  void *getPointerToFunction(Function *F) override;
 
   /// addPointerToBasicBlock - Adds address of the specific basic block.
   void addPointerToBasicBlock(const BasicBlock *BB, void *Addr);
@@ -146,18 +146,18 @@
 
   /// getPointerToBasicBlock - This returns the address of the specified basic
   /// block, assuming function is compiled.
-  void *getPointerToBasicBlock(BasicBlock *BB);
+  void *getPointerToBasicBlock(BasicBlock *BB) override;
 
   /// getOrEmitGlobalVariable - Return the address of the specified global
   /// variable, possibly emitting it to memory if needed.  This is used by the
   /// Emitter.
-  void *getOrEmitGlobalVariable(const GlobalVariable *GV);
+  void *getOrEmitGlobalVariable(const GlobalVariable *GV) override;
 
   /// getPointerToFunctionOrStub - If the specified function has been
   /// code-gen'd, return a pointer to the function.  If not, compile it, or use
   /// a stub to implement lazy compilation if available.
   ///
-  void *getPointerToFunctionOrStub(Function *F);
+  void *getPointerToFunctionOrStub(Function *F) override;
 
   /// recompileAndRelinkFunction - This method is used to force a function
   /// which has already been compiled, to be compiled again, possibly
@@ -165,12 +165,12 @@
   /// with a branch to the new copy. If there was no old copy, this acts
   /// just like JIT::getPointerToFunction().
   ///
-  void *recompileAndRelinkFunction(Function *F);
+  void *recompileAndRelinkFunction(Function *F) override;
 
   /// freeMachineCodeForFunction - deallocate memory used to code-generate this
   /// Function.
   ///
-  void freeMachineCodeForFunction(Function *F);
+  void freeMachineCodeForFunction(Function *F) override;
 
   /// addPendingFunction - while jitting non-lazily, a called but non-codegen'd
   /// function was encountered.  Add it to a pending list to be processed after
@@ -189,12 +189,12 @@
                                     TargetMachine *TM);
 
   // Run the JIT on F and return information about the generated code
-  void runJITOnFunction(Function *F, MachineCodeInfo *MCI = 0);
+  void runJITOnFunction(Function *F, MachineCodeInfo *MCI = 0) override;
 
-  virtual void RegisterJITEventListener(JITEventListener *L);
-  virtual void UnregisterJITEventListener(JITEventListener *L);
+  void RegisterJITEventListener(JITEventListener *L) override;
+  void UnregisterJITEventListener(JITEventListener *L) override;
 
-  virtual TargetMachine *getTargetMachine() { return &TM; }
+  TargetMachine *getTargetMachine() override { return &TM; }
 
   /// These functions correspond to the methods on JITEventListener.  They
   /// iterate over the registered listeners and call the corresponding method on
@@ -220,7 +220,7 @@
 protected:
 
   /// getMemoryforGV - Allocate memory for a global variable.
-  virtual char* getMemoryForGV(const GlobalVariable* GV);
+  char* getMemoryForGV(const GlobalVariable* GV) override;
 
 };
 
diff --git a/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp b/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
index b0e48ca..4b2f012 100644
--- a/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
@@ -375,8 +375,8 @@
 
     JITResolver &getJITResolver() { return Resolver; }
 
-    virtual void startFunction(MachineFunction &F);
-    virtual bool finishFunction(MachineFunction &F);
+    void startFunction(MachineFunction &F) override;
+    bool finishFunction(MachineFunction &F) override;
 
     void emitConstantPool(MachineConstantPool *MCP);
     void initJumpTableInfo(MachineJumpTableInfo *MJTI);
@@ -386,24 +386,23 @@
                      unsigned StubSize, unsigned Alignment = 1);
     void startGVStub(void *Buffer, unsigned StubSize);
     void finishGVStub();
-    virtual void *allocIndirectGV(const GlobalValue *GV,
-                                  const uint8_t *Buffer, size_t Size,
-                                  unsigned Alignment);
+    void *allocIndirectGV(const GlobalValue *GV, const uint8_t *Buffer,
+                          size_t Size, unsigned Alignment) override;
 
     /// allocateSpace - Reserves space in the current block if any, or
     /// allocate a new one of the given size.
-    virtual void *allocateSpace(uintptr_t Size, unsigned Alignment);
+    void *allocateSpace(uintptr_t Size, unsigned Alignment) override;
 
     /// allocateGlobal - Allocate memory for a global.  Unlike allocateSpace,
     /// this method does not allocate memory in the current output buffer,
     /// because a global may live longer than the current function.
-    virtual void *allocateGlobal(uintptr_t Size, unsigned Alignment);
+    void *allocateGlobal(uintptr_t Size, unsigned Alignment) override;
 
-    virtual void addRelocation(const MachineRelocation &MR) {
+    void addRelocation(const MachineRelocation &MR) override {
       Relocations.push_back(MR);
     }
 
-    virtual void StartMachineBasicBlock(MachineBasicBlock *MBB) {
+    void StartMachineBasicBlock(MachineBasicBlock *MBB) override {
       if (MBBLocations.size() <= (unsigned)MBB->getNumber())
         MBBLocations.resize((MBB->getNumber()+1)*2);
       MBBLocations[MBB->getNumber()] = getCurrentPCValue();
@@ -414,10 +413,11 @@
                    << (void*) getCurrentPCValue() << "]\n");
     }
 
-    virtual uintptr_t getConstantPoolEntryAddress(unsigned Entry) const;
-    virtual uintptr_t getJumpTableEntryAddress(unsigned Entry) const;
+    uintptr_t getConstantPoolEntryAddress(unsigned Entry) const override;
+    uintptr_t getJumpTableEntryAddress(unsigned Entry) const override;
 
-    virtual uintptr_t getMachineBasicBlockAddress(MachineBasicBlock *MBB) const{
+    uintptr_t
+    getMachineBasicBlockAddress(MachineBasicBlock *MBB) const override {
       assert(MBBLocations.size() > (unsigned)MBB->getNumber() &&
              MBBLocations[MBB->getNumber()] && "MBB not emitted!");
       return MBBLocations[MBB->getNumber()];
@@ -432,22 +432,22 @@
     /// function body.
     void deallocateMemForFunction(const Function *F);
 
-    virtual void processDebugLoc(DebugLoc DL, bool BeforePrintingInsn);
+    void processDebugLoc(DebugLoc DL, bool BeforePrintingInsn) override;
 
-    virtual void emitLabel(MCSymbol *Label) {
+    void emitLabel(MCSymbol *Label) override {
       LabelLocations[Label] = getCurrentPCValue();
     }
 
-    virtual DenseMap<MCSymbol*, uintptr_t> *getLabelLocations() {
+    DenseMap<MCSymbol*, uintptr_t> *getLabelLocations() override {
       return &LabelLocations;
     }
 
-    virtual uintptr_t getLabelAddress(MCSymbol *Label) const {
+    uintptr_t getLabelAddress(MCSymbol *Label) const override {
       assert(LabelLocations.count(Label) && "Label not emitted!");
       return LabelLocations.find(Label)->second;
     }
 
-    virtual void setModuleInfo(MachineModuleInfo* Info) {
+    void setModuleInfo(MachineModuleInfo* Info) override {
       MMI = Info;
     }
 
diff --git a/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp b/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
index f58d31b..6ae7383 100644
--- a/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
@@ -274,8 +274,8 @@
   public:
     JITSlabAllocator(DefaultJITMemoryManager &jmm) : JMM(jmm) { }
     virtual ~JITSlabAllocator() { }
-    virtual MemSlab *Allocate(size_t Size);
-    virtual void Deallocate(MemSlab *Slab);
+    MemSlab *Allocate(size_t Size) override;
+    void Deallocate(MemSlab *Slab) override;
   };
 
   /// DefaultJITMemoryManager - Manage memory for the JIT code generation.
@@ -332,23 +332,24 @@
 
     /// getPointerToNamedFunction - This method returns the address of the
     /// specified function by using the dlsym function call.
-    virtual void *getPointerToNamedFunction(const std::string &Name,
-                                            bool AbortOnFailure = true);
+    void *getPointerToNamedFunction(const std::string &Name,
+                                    bool AbortOnFailure = true) override;
 
-    void AllocateGOT();
+    void AllocateGOT() override;
 
     // Testing methods.
-    virtual bool CheckInvariants(std::string &ErrorStr);
-    size_t GetDefaultCodeSlabSize() { return DefaultCodeSlabSize; }
-    size_t GetDefaultDataSlabSize() { return DefaultSlabSize; }
-    size_t GetDefaultStubSlabSize() { return DefaultSlabSize; }
-    unsigned GetNumCodeSlabs() { return CodeSlabs.size(); }
-    unsigned GetNumDataSlabs() { return DataAllocator.GetNumSlabs(); }
-    unsigned GetNumStubSlabs() { return StubAllocator.GetNumSlabs(); }
+    bool CheckInvariants(std::string &ErrorStr) override;
+    size_t GetDefaultCodeSlabSize() override { return DefaultCodeSlabSize; }
+    size_t GetDefaultDataSlabSize() override { return DefaultSlabSize; }
+    size_t GetDefaultStubSlabSize() override { return DefaultSlabSize; }
+    unsigned GetNumCodeSlabs() override { return CodeSlabs.size(); }
+    unsigned GetNumDataSlabs() override { return DataAllocator.GetNumSlabs(); }
+    unsigned GetNumStubSlabs() override { return StubAllocator.GetNumSlabs(); }
 
     /// startFunctionBody - When a function starts, allocate a block of free
     /// executable memory, returning a pointer to it and its actual size.
-    uint8_t *startFunctionBody(const Function *F, uintptr_t &ActualSize) {
+    uint8_t *startFunctionBody(const Function *F,
+                               uintptr_t &ActualSize) override {
 
       FreeRangeHeader* candidateBlock = FreeMemoryList;
       FreeRangeHeader* head = FreeMemoryList;
@@ -422,7 +423,7 @@
     /// endFunctionBody - The function F is now allocated, and takes the memory
     /// in the range [FunctionStart,FunctionEnd).
     void endFunctionBody(const Function *F, uint8_t *FunctionStart,
-                         uint8_t *FunctionEnd) {
+                         uint8_t *FunctionEnd) override {
       assert(FunctionEnd > FunctionStart);
       assert(FunctionStart == (uint8_t *)(CurBlock+1) &&
              "Mismatched function start/end!");
@@ -435,7 +436,7 @@
 
     /// allocateSpace - Allocate a memory block of the given size.  This method
     /// cannot be called between calls to startFunctionBody and endFunctionBody.
-    uint8_t *allocateSpace(intptr_t Size, unsigned Alignment) {
+    uint8_t *allocateSpace(intptr_t Size, unsigned Alignment) override {
       CurBlock = FreeMemoryList;
       FreeMemoryList = FreeMemoryList->AllocateBlock();
 
@@ -453,18 +454,19 @@
 
     /// allocateStub - Allocate memory for a function stub.
     uint8_t *allocateStub(const GlobalValue* F, unsigned StubSize,
-                          unsigned Alignment) {
+                          unsigned Alignment) override {
       return (uint8_t*)StubAllocator.Allocate(StubSize, Alignment);
     }
 
     /// allocateGlobal - Allocate memory for a global.
-    uint8_t *allocateGlobal(uintptr_t Size, unsigned Alignment) {
+    uint8_t *allocateGlobal(uintptr_t Size, unsigned Alignment) override {
       return (uint8_t*)DataAllocator.Allocate(Size, Alignment);
     }
 
     /// allocateCodeSection - Allocate memory for a code section.
     uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
-                                 unsigned SectionID, StringRef SectionName) {
+                                 unsigned SectionID,
+                                 StringRef SectionName) override {
       // Grow the required block size to account for the block header
       Size += sizeof(*CurBlock);
 
@@ -511,15 +513,15 @@
     /// allocateDataSection - Allocate memory for a data section.
     uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
                                  unsigned SectionID, StringRef SectionName,
-                                 bool IsReadOnly) {
+                                 bool IsReadOnly) override {
       return (uint8_t*)DataAllocator.Allocate(Size, Alignment);
     }
 
-    bool finalizeMemory(std::string *ErrMsg) {
+    bool finalizeMemory(std::string *ErrMsg) override {
       return false;
     }
 
-    uint8_t *getGOTBase() const {
+    uint8_t *getGOTBase() const override {
       return GOTBase;
     }
 
@@ -539,28 +541,26 @@
 
     /// deallocateFunctionBody - Deallocate all memory for the specified
     /// function body.
-    void deallocateFunctionBody(void *Body) {
+    void deallocateFunctionBody(void *Body) override {
       if (Body) deallocateBlock(Body);
     }
 
     /// setMemoryWritable - When code generation is in progress,
     /// the code pages may need permissions changed.
-    void setMemoryWritable()
-    {
+    void setMemoryWritable() override {
       for (unsigned i = 0, e = CodeSlabs.size(); i != e; ++i)
         sys::Memory::setWritable(CodeSlabs[i]);
     }
     /// setMemoryExecutable - When code generation is done and we're ready to
     /// start execution, the code pages may need permissions changed.
-    void setMemoryExecutable()
-    {
+    void setMemoryExecutable() override {
       for (unsigned i = 0, e = CodeSlabs.size(); i != e; ++i)
         sys::Memory::setExecutable(CodeSlabs[i]);
     }
 
     /// setPoisonMemory - Controls whether we write garbage over freed memory.
     ///
-    void setPoisonMemory(bool poison) {
+    void setPoisonMemory(bool poison) override {
       PoisonMemory = poison;
     }
   };