From b21ab43cfc3fa0dacf5c95f04e58b6d804b59a16 Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Mon, 18 Nov 2013 09:31:53 +0000 Subject: [PATCH] Revert r194865 and r194874. This change is incorrect. If you delete virtual destructor of both a base class and a subclass, then the following code: Base *foo = new Child(); delete foo; will not cause the destructor for members of Child class. As a result, I observe plently of memory leaks. Notable examples I investigated are: ObjectBuffer and ObjectBufferStream, AttributeImpl and StringSAttributeImpl. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194997 91177308-0d34-0410-b5e6-96231b3b80d8 --- examples/ExceptionDemo/ExceptionDemo.cpp | 4 +- examples/Kaleidoscope/Chapter2/toy.cpp | 16 +---- examples/Kaleidoscope/Chapter3/toy.cpp | 4 +- examples/Kaleidoscope/Chapter4/toy.cpp | 4 +- examples/Kaleidoscope/Chapter5/toy.cpp | 4 +- examples/Kaleidoscope/Chapter6/toy.cpp | 4 +- examples/Kaleidoscope/Chapter7/toy.cpp | 4 +- include/llvm/CodeGen/MachineRegisterInfo.h | 3 +- include/llvm/CodeGen/MachineScheduler.h | 2 - include/llvm/ExecutionEngine/ObjectBuffer.h | 2 + include/llvm/ExecutionEngine/ObjectCache.h | 1 - include/llvm/ExecutionEngine/ObjectImage.h | 1 - include/llvm/MC/MCAtom.h | 1 - include/llvm/MC/MCStreamer.h | 1 - include/llvm/MC/MCWinCOFFObjectWriter.h | 2 - include/llvm/Support/CommandLine.h | 4 -- include/llvm/Support/ValueHandle.h | 5 +- include/llvm/Support/YAMLParser.h | 7 -- include/llvm/Support/YAMLTraits.h | 7 +- lib/CodeGen/MachineRegisterInfo.cpp | 3 - lib/CodeGen/MachineScheduler.cpp | 4 -- lib/CodeGen/RegAllocBase.cpp | 3 - lib/CodeGen/RegAllocBase.h | 1 - lib/ExecutionEngine/ExecutionEngine.cpp | 4 -- .../RuntimeDyld/JITRegistrar.h | 1 - .../RuntimeDyld/ObjectImageCommon.h | 1 - .../RuntimeDyld/RuntimeDyld.cpp | 6 -- lib/IR/AttributeImpl.h | 2 + lib/IR/Attributes.cpp | 2 + lib/IR/Metadata.cpp | 4 +- lib/IR/Value.cpp | 8 ++- lib/MC/MCAtom.cpp | 3 - lib/MC/MCStreamer.cpp | 2 - lib/MC/WinCOFFObjectWriter.cpp | 5 +- lib/Support/CommandLine.cpp | 2 - lib/Support/ErrorHandling.cpp | 2 - lib/Support/YAMLParser.cpp | 9 --- lib/Support/YAMLTraits.cpp | 7 -- lib/Target/AArch64/AArch64InstrInfo.cpp | 2 +- lib/Target/AArch64/AArch64Subtarget.cpp | 3 - lib/Target/AArch64/AArch64Subtarget.h | 1 - .../AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp | 2 - .../AArch64/MCTargetDesc/AArch64MCAsmInfo.h | 9 +-- lib/Target/ARM/ARMBaseInstrInfo.cpp | 2 +- lib/Target/Hexagon/CMakeLists.txt | 1 - lib/Target/Hexagon/HexagonInstrInfo.cpp | 4 +- lib/Target/Hexagon/HexagonInstrInfo.h | 2 - .../Hexagon/HexagonMachineFunctionInfo.cpp | 16 ----- .../Hexagon/HexagonMachineFunctionInfo.h | 4 +- lib/Target/Hexagon/HexagonSubtarget.cpp | 1 - lib/Target/Hexagon/HexagonSubtarget.h | 1 - .../Hexagon/MCTargetDesc/HexagonMCAsmInfo.cpp | 3 - .../Hexagon/MCTargetDesc/HexagonMCAsmInfo.h | 1 - lib/Target/MSP430/MSP430InstrInfo.cpp | 5 +- lib/Target/MSP430/MSP430InstrInfo.h | 1 - .../Mips/MCTargetDesc/MipsMCTargetDesc.cpp | 3 - lib/Target/Mips/MipsInstrInfo.cpp | 5 +- lib/Target/Mips/MipsInstrInfo.h | 1 - lib/Target/Mips/MipsTargetStreamer.h | 1 - lib/Target/NVPTX/NVPTXISelLowering.cpp | 26 -------- lib/Target/NVPTX/NVPTXInstrInfo.cpp | 5 +- lib/Target/NVPTX/NVPTXInstrInfo.h | 1 - lib/Target/NVPTX/NVPTXSection.h | 4 +- lib/Target/NVPTX/NVPTXSubtarget.cpp | 3 - lib/Target/NVPTX/NVPTXSubtarget.h | 2 - lib/Target/NVPTX/NVPTXTargetObjectFile.h | 23 ++++++- .../PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp | 3 - lib/Target/PowerPC/PPCInstrInfo.cpp | 5 +- lib/Target/PowerPC/PPCInstrInfo.h | 1 - lib/Target/PowerPC/PPCTargetStreamer.h | 1 - lib/Target/R600/AMDGPUInstrInfo.cpp | 6 +- lib/Target/R600/AMDGPUInstrInfo.h | 1 - lib/Target/R600/AMDGPUMachineFunction.cpp | 3 - lib/Target/R600/AMDGPUMachineFunction.h | 1 - .../R600/MCTargetDesc/AMDGPUMCCodeEmitter.cpp | 21 ------ .../R600/MCTargetDesc/AMDGPUMCCodeEmitter.h | 1 - lib/Target/R600/MCTargetDesc/CMakeLists.txt | 1 - lib/Target/R600/R600InstrInfo.cpp | 2 +- lib/Target/R600/R600MachineFunctionInfo.cpp | 6 +- lib/Target/R600/R600MachineFunctionInfo.h | 1 - lib/Target/R600/SIMachineFunctionInfo.cpp | 4 -- lib/Target/R600/SIMachineFunctionInfo.h | 1 - lib/Target/Sparc/SparcInstrInfo.cpp | 6 +- lib/Target/Sparc/SparcInstrInfo.h | 1 - lib/Target/SystemZ/CMakeLists.txt | 1 - lib/Target/SystemZ/SystemZInstrInfo.cpp | 5 +- lib/Target/SystemZ/SystemZInstrInfo.h | 1 - .../SystemZ/SystemZMachineFunctionInfo.cpp | 17 ----- .../SystemZ/SystemZMachineFunctionInfo.h | 2 - lib/Target/SystemZ/SystemZSubtarget.cpp | 3 - lib/Target/SystemZ/SystemZSubtarget.h | 1 - .../MCTargetDesc/X86WinCOFFObjectWriter.cpp | 2 +- lib/Target/X86/X86InstrInfo.cpp | 5 +- lib/Target/X86/X86InstrInfo.h | 2 - lib/Target/XCore/XCoreInstrInfo.cpp | 6 +- lib/Target/XCore/XCoreInstrInfo.h | 1 - tools/llvm-stress/llvm-stress.cpp | 40 +---------- unittests/ADT/IntrusiveRefCntPtrTest.cpp | 4 +- .../ExecutionEngine/MCJIT/MCJITCAPITest.cpp | 18 +++-- .../MCJIT/MCJITMultipleModuleTest.cpp | 8 +-- unittests/ExecutionEngine/MCJIT/MCJITTest.cpp | 8 +-- utils/TableGen/CodeGenSchedule.cpp | 66 +++++++++---------- utils/TableGen/InstrInfoEmitter.cpp | 10 ++- utils/TableGen/SetTheory.cpp | 49 ++++++-------- utils/TableGen/TGValueTypes.cpp | 16 +---- .../include/gtest/gtest-test-part.h | 2 +- .../unittest/googletest/include/gtest/gtest.h | 5 +- .../internal/gtest-death-test-internal.h | 4 +- .../include/gtest/internal/gtest-internal.h | 3 +- .../include/gtest/internal/gtest-param-util.h | 2 +- .../include/gtest/internal/gtest-port.h | 4 +- .../googletest/src/gtest-death-test.cc | 2 - .../googletest/src/gtest-internal-inl.h | 2 +- utils/unittest/googletest/src/gtest-port.cc | 12 ---- utils/unittest/googletest/src/gtest.cc | 9 --- 115 files changed, 152 insertions(+), 500 deletions(-) delete mode 100644 lib/Target/Hexagon/HexagonMachineFunctionInfo.cpp delete mode 100644 lib/Target/R600/MCTargetDesc/AMDGPUMCCodeEmitter.cpp delete mode 100644 lib/Target/SystemZ/SystemZMachineFunctionInfo.cpp diff --git a/examples/ExceptionDemo/ExceptionDemo.cpp b/examples/ExceptionDemo/ExceptionDemo.cpp index c935206b811..61b175091b7 100644 --- a/examples/ExceptionDemo/ExceptionDemo.cpp +++ b/examples/ExceptionDemo/ExceptionDemo.cpp @@ -1577,11 +1577,9 @@ public: std::runtime_error::operator=(toCopy))); } - ~OurCppRunException (void) throw (); + ~OurCppRunException (void) throw () {} }; -OurCppRunException::~OurCppRunException() throw () {} - /// Throws foreign C++ exception. /// @param ignoreIt unused parameter that allows function to match implied diff --git a/examples/Kaleidoscope/Chapter2/toy.cpp b/examples/Kaleidoscope/Chapter2/toy.cpp index 43eeb1c2cd2..2dc6711eed7 100644 --- a/examples/Kaleidoscope/Chapter2/toy.cpp +++ b/examples/Kaleidoscope/Chapter2/toy.cpp @@ -79,39 +79,28 @@ static int gettok() { /// ExprAST - Base class for all expression nodes. class ExprAST { public: - virtual ~ExprAST(); + virtual ~ExprAST() {} }; -ExprAST::~ExprAST() {} - /// NumberExprAST - Expression class for numeric literals like "1.0". class NumberExprAST : public ExprAST { public: NumberExprAST(double val) {} - virtual ~NumberExprAST(); }; -NumberExprAST::~NumberExprAST() {} - /// VariableExprAST - Expression class for referencing a variable, like "a". class VariableExprAST : public ExprAST { std::string Name; public: VariableExprAST(const std::string &name) : Name(name) {} - virtual ~VariableExprAST(); }; -VariableExprAST::~VariableExprAST() {} - /// BinaryExprAST - Expression class for a binary operator. class BinaryExprAST : public ExprAST { public: BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) {} - virtual ~BinaryExprAST(); }; -BinaryExprAST::~BinaryExprAST() {} - /// CallExprAST - Expression class for function calls. class CallExprAST : public ExprAST { std::string Callee; @@ -119,11 +108,8 @@ class CallExprAST : public ExprAST { public: CallExprAST(const std::string &callee, std::vector &args) : Callee(callee), Args(args) {} - virtual ~CallExprAST(); }; -CallExprAST::~CallExprAST() {} - /// PrototypeAST - This class represents the "prototype" for a function, /// which captures its name, and its argument names (thus implicitly the number /// of arguments the function takes). diff --git a/examples/Kaleidoscope/Chapter3/toy.cpp b/examples/Kaleidoscope/Chapter3/toy.cpp index d25aa5d4d7f..0fb64e3a54d 100644 --- a/examples/Kaleidoscope/Chapter3/toy.cpp +++ b/examples/Kaleidoscope/Chapter3/toy.cpp @@ -84,12 +84,10 @@ static int gettok() { /// ExprAST - Base class for all expression nodes. class ExprAST { public: - virtual ~ExprAST(); + virtual ~ExprAST() {} virtual Value *Codegen() = 0; }; -ExprAST::~ExprAST() {} - /// NumberExprAST - Expression class for numeric literals like "1.0". class NumberExprAST : public ExprAST { double Val; diff --git a/examples/Kaleidoscope/Chapter4/toy.cpp b/examples/Kaleidoscope/Chapter4/toy.cpp index a52b5552a29..0e41cc14ead 100644 --- a/examples/Kaleidoscope/Chapter4/toy.cpp +++ b/examples/Kaleidoscope/Chapter4/toy.cpp @@ -91,12 +91,10 @@ static int gettok() { /// ExprAST - Base class for all expression nodes. class ExprAST { public: - virtual ~ExprAST(); + virtual ~ExprAST() {} virtual Value *Codegen() = 0; }; -ExprAST::~ExprAST() {} - /// NumberExprAST - Expression class for numeric literals like "1.0". class NumberExprAST : public ExprAST { double Val; diff --git a/examples/Kaleidoscope/Chapter5/toy.cpp b/examples/Kaleidoscope/Chapter5/toy.cpp index 2770a380b7e..d5a88a5a693 100644 --- a/examples/Kaleidoscope/Chapter5/toy.cpp +++ b/examples/Kaleidoscope/Chapter5/toy.cpp @@ -100,12 +100,10 @@ static int gettok() { /// ExprAST - Base class for all expression nodes. class ExprAST { public: - virtual ~ExprAST(); + virtual ~ExprAST() {} virtual Value *Codegen() = 0; }; -ExprAST::~ExprAST() {} - /// NumberExprAST - Expression class for numeric literals like "1.0". class NumberExprAST : public ExprAST { double Val; diff --git a/examples/Kaleidoscope/Chapter6/toy.cpp b/examples/Kaleidoscope/Chapter6/toy.cpp index 2a0f212ef41..4d6a128cba2 100644 --- a/examples/Kaleidoscope/Chapter6/toy.cpp +++ b/examples/Kaleidoscope/Chapter6/toy.cpp @@ -105,12 +105,10 @@ static int gettok() { /// ExprAST - Base class for all expression nodes. class ExprAST { public: - virtual ~ExprAST(); + virtual ~ExprAST() {} virtual Value *Codegen() = 0; }; -ExprAST::~ExprAST() {} - /// NumberExprAST - Expression class for numeric literals like "1.0". class NumberExprAST : public ExprAST { double Val; diff --git a/examples/Kaleidoscope/Chapter7/toy.cpp b/examples/Kaleidoscope/Chapter7/toy.cpp index 00628010d60..beb0c0099cc 100644 --- a/examples/Kaleidoscope/Chapter7/toy.cpp +++ b/examples/Kaleidoscope/Chapter7/toy.cpp @@ -109,12 +109,10 @@ static int gettok() { /// ExprAST - Base class for all expression nodes. class ExprAST { public: - virtual ~ExprAST(); + virtual ~ExprAST() {} virtual Value *Codegen() = 0; }; -ExprAST::~ExprAST() {} - /// NumberExprAST - Expression class for numeric literals like "1.0". class NumberExprAST : public ExprAST { double Val; diff --git a/include/llvm/CodeGen/MachineRegisterInfo.h b/include/llvm/CodeGen/MachineRegisterInfo.h index 58ca907316a..736a0a2b757 100644 --- a/include/llvm/CodeGen/MachineRegisterInfo.h +++ b/include/llvm/CodeGen/MachineRegisterInfo.h @@ -30,9 +30,8 @@ class PSetIterator; class MachineRegisterInfo { public: class Delegate { - virtual void anchor(); public: - virtual void MRI_NoteNewVirtualRegister(unsigned Reg) = 0; + virtual void MRI_NoteNewVirtualRegister(unsigned Reg) {} virtual ~Delegate() {} }; diff --git a/include/llvm/CodeGen/MachineScheduler.h b/include/llvm/CodeGen/MachineScheduler.h index 77828953347..e6af370855e 100644 --- a/include/llvm/CodeGen/MachineScheduler.h +++ b/include/llvm/CodeGen/MachineScheduler.h @@ -164,7 +164,6 @@ struct MachineSchedPolicy { /// Initialization sequence: /// initPolicy -> shouldTrackPressure -> initialize(DAG) -> registerRoots class MachineSchedStrategy { - virtual void anchor(); public: virtual ~MachineSchedStrategy() {} @@ -263,7 +262,6 @@ public: /// Mutate the DAG as a postpass after normal DAG building. class ScheduleDAGMutation { - virtual void anchor(); public: virtual ~ScheduleDAGMutation() {} diff --git a/include/llvm/ExecutionEngine/ObjectBuffer.h b/include/llvm/ExecutionEngine/ObjectBuffer.h index 51051c9d188..32de40464a5 100644 --- a/include/llvm/ExecutionEngine/ObjectBuffer.h +++ b/include/llvm/ExecutionEngine/ObjectBuffer.h @@ -33,6 +33,7 @@ class ObjectBuffer { public: ObjectBuffer() {} ObjectBuffer(MemoryBuffer* Buf) : Buffer(Buf) {} + virtual ~ObjectBuffer() {} /// getMemBuffer - Like MemoryBuffer::getMemBuffer() this function /// returns a pointer to an object that is owned by the caller. However, @@ -57,6 +58,7 @@ protected: class ObjectBufferStream : public ObjectBuffer { public: ObjectBufferStream() : OS(SV) {} + virtual ~ObjectBufferStream() {} raw_ostream &getOStream() { return OS; } void flush() diff --git a/include/llvm/ExecutionEngine/ObjectCache.h b/include/llvm/ExecutionEngine/ObjectCache.h index d1849dfc3bf..6f55e4391e6 100644 --- a/include/llvm/ExecutionEngine/ObjectCache.h +++ b/include/llvm/ExecutionEngine/ObjectCache.h @@ -20,7 +20,6 @@ class Module; /// ExecutionEngine for the purpose of avoiding compilation for Modules that /// have already been compiled and an object file is available. class ObjectCache { - virtual void anchor(); public: ObjectCache() { } diff --git a/include/llvm/ExecutionEngine/ObjectImage.h b/include/llvm/ExecutionEngine/ObjectImage.h index 076f4b1146c..9fddca7e33c 100644 --- a/include/llvm/ExecutionEngine/ObjectImage.h +++ b/include/llvm/ExecutionEngine/ObjectImage.h @@ -25,7 +25,6 @@ namespace llvm { class ObjectImage { ObjectImage() LLVM_DELETED_FUNCTION; ObjectImage(const ObjectImage &other) LLVM_DELETED_FUNCTION; - virtual void anchor(); protected: OwningPtr Buffer; diff --git a/include/llvm/MC/MCAtom.h b/include/llvm/MC/MCAtom.h index eab32d691fa..4758588ac37 100644 --- a/include/llvm/MC/MCAtom.h +++ b/include/llvm/MC/MCAtom.h @@ -32,7 +32,6 @@ class MCDataAtom; /// \brief Represents a contiguous range of either instructions (a TextAtom) /// or data (a DataAtom). Address ranges are expressed as _closed_ intervals. class MCAtom { - virtual void anchor(); public: virtual ~MCAtom() {} diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h index 0b1fe6ec012..04af407a445 100644 --- a/include/llvm/MC/MCStreamer.h +++ b/include/llvm/MC/MCStreamer.h @@ -76,7 +76,6 @@ public: // FIXME: declared here because it is used from // lib/CodeGen/AsmPrinter/ARMException.cpp. class ARMTargetStreamer : public MCTargetStreamer { - virtual void anchor(); public: virtual void emitFnStart() = 0; virtual void emitFnEnd() = 0; diff --git a/include/llvm/MC/MCWinCOFFObjectWriter.h b/include/llvm/MC/MCWinCOFFObjectWriter.h index e79e4bc83de..f13e7d54802 100644 --- a/include/llvm/MC/MCWinCOFFObjectWriter.h +++ b/include/llvm/MC/MCWinCOFFObjectWriter.h @@ -19,8 +19,6 @@ namespace llvm { class MCWinCOFFObjectTargetWriter { const unsigned Machine; - virtual void anchor(); - protected: MCWinCOFFObjectTargetWriter(unsigned Machine_); diff --git a/include/llvm/Support/CommandLine.h b/include/llvm/Support/CommandLine.h index 4efb6a67cf6..c0bfbae0370 100644 --- a/include/llvm/Support/CommandLine.h +++ b/include/llvm/Support/CommandLine.h @@ -350,9 +350,6 @@ struct cat { struct GenericOptionValue { virtual ~GenericOptionValue() {} virtual bool compare(const GenericOptionValue &V) const = 0; - -private: - virtual void anchor(); }; template struct OptionValue; @@ -1755,7 +1752,6 @@ void getRegisteredOptions(StringMap &Map); /// \brief Saves strings in the inheritor's stable storage and returns a stable /// raw character pointer. class StringSaver { - virtual void anchor(); public: virtual const char *SaveString(const char *Str) = 0; virtual ~StringSaver() {}; // Pacify -Wnon-virtual-dtor. diff --git a/include/llvm/Support/ValueHandle.h b/include/llvm/Support/ValueHandle.h index bc02ba31b9b..b49341c3ffb 100644 --- a/include/llvm/Support/ValueHandle.h +++ b/include/llvm/Support/ValueHandle.h @@ -339,7 +339,6 @@ public: /// rearrange itself when the pointer changes). Unlike ValueHandleBase, this /// class has a vtable and a virtual destructor. class CallbackVH : public ValueHandleBase { - virtual void anchor(); protected: CallbackVH(const CallbackVH &RHS) : ValueHandleBase(Callback, RHS) {} @@ -366,13 +365,13 @@ public: /// /// All implementations must remove the reference from this object to the /// Value that's being destroyed. - virtual void deleted() { setValPtr(NULL); } + virtual void deleted(); /// Called when this->getValPtr()->replaceAllUsesWith(new_value) is called, /// _before_ any of the uses have actually been replaced. If WeakVH were /// implemented as a CallbackVH, it would use this method to call /// setValPtr(new_value). AssertingVH would do nothing in this method. - virtual void allUsesReplacedWith(Value *) {} + virtual void allUsesReplacedWith(Value *); }; } // End llvm namespace diff --git a/include/llvm/Support/YAMLParser.h b/include/llvm/Support/YAMLParser.h index 702044936c6..0e780bab121 100644 --- a/include/llvm/Support/YAMLParser.h +++ b/include/llvm/Support/YAMLParser.h @@ -105,7 +105,6 @@ private: /// @brief Abstract base class for all Nodes. class Node { - virtual void anchor(); public: enum NodeKind { NK_Null, @@ -176,7 +175,6 @@ private: /// Example: /// !!null null class NullNode : public Node { - virtual void anchor(); public: NullNode(OwningPtr &D) : Node(NK_Null, D, StringRef(), StringRef()) {} @@ -192,7 +190,6 @@ public: /// Example: /// Adena class ScalarNode : public Node { - virtual void anchor(); public: ScalarNode(OwningPtr &D, StringRef Anchor, StringRef Tag, StringRef Val) @@ -234,7 +231,6 @@ private: /// Example: /// Section: .text class KeyValueNode : public Node { - virtual void anchor(); public: KeyValueNode(OwningPtr &D) : Node(NK_KeyValue, D, StringRef(), StringRef()) @@ -346,7 +342,6 @@ void skip(CollectionType &C) { /// Name: _main /// Scope: Global class MappingNode : public Node { - virtual void anchor(); public: enum MappingType { MT_Block, @@ -396,7 +391,6 @@ private: /// - Hello /// - World class SequenceNode : public Node { - virtual void anchor(); public: enum SequenceType { ST_Block, @@ -452,7 +446,6 @@ private: /// Example: /// *AnchorName class AliasNode : public Node { - virtual void anchor(); public: AliasNode(OwningPtr &D, StringRef Val) : Node(NK_Alias, D, StringRef(), StringRef()), Name(Val) {} diff --git a/include/llvm/Support/YAMLTraits.h b/include/llvm/Support/YAMLTraits.h index 4c271e035fa..d6eeaace7bf 100644 --- a/include/llvm/Support/YAMLTraits.h +++ b/include/llvm/Support/YAMLTraits.h @@ -723,7 +723,6 @@ private: virtual bool canElideEmptySequence(); class HNode { - virtual void anchor(); public: HNode(Node *n) : _node(n) { } virtual ~HNode() { } @@ -733,9 +732,9 @@ private: }; class EmptyHNode : public HNode { - virtual void anchor(); public: EmptyHNode(Node *n) : HNode(n) { } + virtual ~EmptyHNode() {} static inline bool classof(const HNode *n) { return NullNode::classof(n->_node); } @@ -743,9 +742,9 @@ private: }; class ScalarHNode : public HNode { - virtual void anchor(); public: ScalarHNode(Node *n, StringRef s) : HNode(n), _value(s) { } + virtual ~ScalarHNode() { } StringRef value() const { return _value; } @@ -758,7 +757,6 @@ private: }; class MapHNode : public HNode { - virtual void anchor(); public: MapHNode(Node *n) : HNode(n) { } virtual ~MapHNode(); @@ -777,7 +775,6 @@ private: }; class SequenceHNode : public HNode { - virtual void anchor(); public: SequenceHNode(Node *n) : HNode(n) { } virtual ~SequenceHNode(); diff --git a/lib/CodeGen/MachineRegisterInfo.cpp b/lib/CodeGen/MachineRegisterInfo.cpp index 7dad84db454..ce7d567cc29 100644 --- a/lib/CodeGen/MachineRegisterInfo.cpp +++ b/lib/CodeGen/MachineRegisterInfo.cpp @@ -19,9 +19,6 @@ using namespace llvm; -// pin vtable to this file -void MachineRegisterInfo::Delegate::anchor() {} - MachineRegisterInfo::MachineRegisterInfo(const TargetMachine &TM) : TM(TM), TheDelegate(0), IsSSA(true), TracksLiveness(true) { VRegInfo.reserve(256); diff --git a/lib/CodeGen/MachineScheduler.cpp b/lib/CodeGen/MachineScheduler.cpp index df756ba6e3f..3144dfe4d39 100644 --- a/lib/CodeGen/MachineScheduler.cpp +++ b/lib/CodeGen/MachineScheduler.cpp @@ -72,10 +72,6 @@ static cl::opt VerifyScheduling("verify-misched", cl::Hidden, // DAG subtrees must have at least this many nodes. static const unsigned MinSubtreeSize = 8; -// pin vtable to this file -void MachineSchedStrategy::anchor() {} -void ScheduleDAGMutation::anchor() {} - //===----------------------------------------------------------------------===// // Machine Instruction Scheduling Pass and Registry //===----------------------------------------------------------------------===// diff --git a/lib/CodeGen/RegAllocBase.cpp b/lib/CodeGen/RegAllocBase.cpp index 3a4d5462a8a..b94ce4d33f7 100644 --- a/lib/CodeGen/RegAllocBase.cpp +++ b/lib/CodeGen/RegAllocBase.cpp @@ -50,9 +50,6 @@ bool RegAllocBase::VerifyEnabled = false; // RegAllocBase Implementation //===----------------------------------------------------------------------===// -// pin vtable to this file -void RegAllocBase::anchor() {} - void RegAllocBase::init(VirtRegMap &vrm, LiveIntervals &lis, LiveRegMatrix &mat) { diff --git a/lib/CodeGen/RegAllocBase.h b/lib/CodeGen/RegAllocBase.h index c17a8d96ef6..9c0029837d0 100644 --- a/lib/CodeGen/RegAllocBase.h +++ b/lib/CodeGen/RegAllocBase.h @@ -57,7 +57,6 @@ class Spiller; /// live range splitting. They must also override enqueue/dequeue to provide an /// assignment order. class RegAllocBase { - virtual void anchor(); protected: const TargetRegisterInfo *TRI; MachineRegisterInfo *MRI; diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index 16128be7829..73bd43ba515 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/lib/ExecutionEngine/ExecutionEngine.cpp @@ -15,7 +15,6 @@ #define DEBUG_TYPE "jit" #include "llvm/ExecutionEngine/ExecutionEngine.h" #include "llvm/ExecutionEngine/JITMemoryManager.h" -#include "llvm/ExecutionEngine/ObjectCache.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/Statistic.h" #include "llvm/ExecutionEngine/GenericValue.h" @@ -40,9 +39,6 @@ using namespace llvm; STATISTIC(NumInitBytes, "Number of bytes of global vars initialized"); STATISTIC(NumGlobals , "Number of global vars initialized"); -// pin vtable to this file -void ObjectCache::anchor() {} - ExecutionEngine *(*ExecutionEngine::JITCtor)( Module *M, std::string *ErrorStr, diff --git a/lib/ExecutionEngine/RuntimeDyld/JITRegistrar.h b/lib/ExecutionEngine/RuntimeDyld/JITRegistrar.h index 6a514ea3ec3..69e9dbe490d 100644 --- a/lib/ExecutionEngine/RuntimeDyld/JITRegistrar.h +++ b/lib/ExecutionEngine/RuntimeDyld/JITRegistrar.h @@ -16,7 +16,6 @@ namespace llvm { /// Global access point for the JIT debugging interface. class JITRegistrar { - virtual void anchor(); public: /// Instantiates the JIT service. JITRegistrar() {} diff --git a/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h b/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h index 9cbde5daede..89350cc5b62 100644 --- a/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h +++ b/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h @@ -23,7 +23,6 @@ namespace llvm { class ObjectImageCommon : public ObjectImage { ObjectImageCommon(); // = delete ObjectImageCommon(const ObjectImageCommon &other); // = delete - virtual void anchor(); protected: object::ObjectFile *ObjFile; diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp index 9641a57756f..2c068be970e 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp @@ -13,7 +13,6 @@ #define DEBUG_TYPE "dyld" #include "llvm/ExecutionEngine/RuntimeDyld.h" -#include "JITRegistrar.h" #include "ObjectImageCommon.h" #include "RuntimeDyldELF.h" #include "RuntimeDyldImpl.h" @@ -29,11 +28,6 @@ using namespace llvm::object; // Empty out-of-line virtual destructor as the key function. RuntimeDyldImpl::~RuntimeDyldImpl() {} -// pin JITRegistrar.h and ObjectImage*.h vtables to this file -void JITRegistrar::anchor() {} -void ObjectImage::anchor() {} -void ObjectImageCommon::anchor() {} - namespace llvm { void RuntimeDyldImpl::registerEHFrames() { diff --git a/lib/IR/AttributeImpl.h b/lib/IR/AttributeImpl.h index 2d2604449a2..9da3f9659e0 100644 --- a/lib/IR/AttributeImpl.h +++ b/lib/IR/AttributeImpl.h @@ -46,6 +46,8 @@ protected: AttributeImpl(AttrEntryKind KindID) : KindID(KindID) {} public: + virtual ~AttributeImpl(); + bool isEnumAttribute() const { return KindID == EnumAttrEntry; } bool isAlignAttribute() const { return KindID == AlignAttrEntry; } bool isStringAttribute() const { return KindID == StringAttrEntry; } diff --git a/lib/IR/Attributes.cpp b/lib/IR/Attributes.cpp index f876778c45c..bcd324c4ffa 100644 --- a/lib/IR/Attributes.cpp +++ b/lib/IR/Attributes.cpp @@ -286,6 +286,8 @@ bool Attribute::operator<(Attribute A) const { // AttributeImpl Definition //===----------------------------------------------------------------------===// +AttributeImpl::~AttributeImpl() {} + bool AttributeImpl::hasAttribute(Attribute::AttrKind A) const { if (isStringAttribute()) return false; return getKindAsEnum() == A; diff --git a/lib/IR/Metadata.cpp b/lib/IR/Metadata.cpp index ef0660da864..bd4d9c0a077 100644 --- a/lib/IR/Metadata.cpp +++ b/lib/IR/Metadata.cpp @@ -65,7 +65,7 @@ class MDNodeOperand : public CallbackVH { public: MDNodeOperand(Value *V) : CallbackVH(V) {} - virtual ~MDNodeOperand(); + ~MDNodeOperand() {} void set(Value *V) { unsigned IsFirst = this->getValPtrInt(); @@ -82,8 +82,6 @@ public: }; } // end namespace llvm. -MDNodeOperand::~MDNodeOperand() {} - void MDNodeOperand::deleted() { getParent()->replaceOperand(this, 0); diff --git a/lib/IR/Value.cpp b/lib/IR/Value.cpp index a56272ffe68..35808a658b4 100644 --- a/lib/IR/Value.cpp +++ b/lib/IR/Value.cpp @@ -735,5 +735,9 @@ void ValueHandleBase::ValueIsRAUWd(Value *Old, Value *New) { #endif } -// pin vtable to this file -void CallbackVH::anchor() {} +// Default implementation for CallbackVH. +void CallbackVH::allUsesReplacedWith(Value *) {} + +void CallbackVH::deleted() { + setValPtr(NULL); +} diff --git a/lib/MC/MCAtom.cpp b/lib/MC/MCAtom.cpp index 3da1ba3ae7a..d0a64c30084 100644 --- a/lib/MC/MCAtom.cpp +++ b/lib/MC/MCAtom.cpp @@ -14,9 +14,6 @@ using namespace llvm; -// pin vtable to this file -void MCAtom::anchor() {} - void MCAtom::remap(uint64_t NewBegin, uint64_t NewEnd) { Parent->remap(this, NewBegin, NewEnd); } diff --git a/lib/MC/MCStreamer.cpp b/lib/MC/MCStreamer.cpp index 0616a4daf12..2be89e95e70 100644 --- a/lib/MC/MCStreamer.cpp +++ b/lib/MC/MCStreamer.cpp @@ -22,9 +22,7 @@ #include using namespace llvm; -// pin vtables to this file MCTargetStreamer::~MCTargetStreamer() {} -void ARMTargetStreamer::anchor() {} MCStreamer::MCStreamer(MCContext &Ctx, MCTargetStreamer *TargetStreamer) : Context(Ctx), TargetStreamer(TargetStreamer), EmitEHFrame(true), diff --git a/lib/MC/WinCOFFObjectWriter.cpp b/lib/MC/WinCOFFObjectWriter.cpp index 270456ca8ac..32523173ee6 100644 --- a/lib/MC/WinCOFFObjectWriter.cpp +++ b/lib/MC/WinCOFFObjectWriter.cpp @@ -138,7 +138,7 @@ public: symbol_map SymbolMap; WinCOFFObjectWriter(MCWinCOFFObjectTargetWriter *MOTW, raw_ostream &OS); - virtual ~WinCOFFObjectWriter(); + ~WinCOFFObjectWriter(); COFFSymbol *createSymbol(StringRef Name); COFFSymbol *GetOrCreateCOFFSymbol(const MCSymbol * Symbol); @@ -898,9 +898,6 @@ MCWinCOFFObjectTargetWriter::MCWinCOFFObjectTargetWriter(unsigned Machine_) : Machine(Machine_) { } -// pin vtable to this file -void MCWinCOFFObjectTargetWriter::anchor() {} - //------------------------------------------------------------------------------ // WinCOFFObjectWriter factory function diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp index c25b08e628b..a47af2729f3 100644 --- a/lib/Support/CommandLine.cpp +++ b/lib/Support/CommandLine.cpp @@ -60,7 +60,6 @@ TEMPLATE_INSTANTIATION(class opt); TEMPLATE_INSTANTIATION(class opt); } } // end namespace llvm::cl -void GenericOptionValue::anchor() {} void OptionValue::anchor() {} void OptionValue::anchor() {} void Option::anchor() {} @@ -74,7 +73,6 @@ void parser::anchor() {} void parser::anchor() {} void parser::anchor() {} void parser::anchor() {} -void StringSaver::anchor() {} //===----------------------------------------------------------------------===// diff --git a/lib/Support/ErrorHandling.cpp b/lib/Support/ErrorHandling.cpp index b91be9d600a..1eafb96fde0 100644 --- a/lib/Support/ErrorHandling.cpp +++ b/lib/Support/ErrorHandling.cpp @@ -17,7 +17,6 @@ #include "llvm/ADT/Twine.h" #include "llvm/Config/config.h" #include "llvm/Support/Debug.h" -#include "llvm/Support/ErrorOr.h" #include "llvm/Support/Signals.h" #include "llvm/Support/Threading.h" #include "llvm/Support/raw_ostream.h" @@ -120,4 +119,3 @@ void LLVMInstallFatalErrorHandler(LLVMFatalErrorHandler Handler) { void LLVMResetFatalErrorHandler() { remove_fatal_error_handler(); } - diff --git a/lib/Support/YAMLParser.cpp b/lib/Support/YAMLParser.cpp index 38303b4c015..9e506128bc2 100644 --- a/lib/Support/YAMLParser.cpp +++ b/lib/Support/YAMLParser.cpp @@ -96,15 +96,6 @@ static EncodingInfo getUnicodeEncoding(StringRef Input) { namespace llvm { namespace yaml { -/// pin the vtables to this file -void Node::anchor() {} -void NullNode::anchor() {} -void ScalarNode::anchor() {} -void KeyValueNode::anchor() {} -void MappingNode::anchor() {} -void SequenceNode::anchor() {} -void AliasNode::anchor() {} - /// Token - A single YAML token. struct Token : ilist_node { enum TokenKind { diff --git a/lib/Support/YAMLTraits.cpp b/lib/Support/YAMLTraits.cpp index c20ce888ad3..f103ed8bcbe 100644 --- a/lib/Support/YAMLTraits.cpp +++ b/lib/Support/YAMLTraits.cpp @@ -59,13 +59,6 @@ void Input::setDiagHandler(SourceMgr::DiagHandlerTy Handler, void *Ctxt) { SrcMgr.setDiagHandler(Handler, Ctxt); } -/// pin the vtables to this file -void Input::HNode::anchor() {} -void Input::EmptyHNode::anchor() {} -void Input::ScalarHNode::anchor() {} -void Input::MapHNode::anchor() {} -void Input::SequenceHNode::anchor() {} - bool Input::outputting() const { return false; } diff --git a/lib/Target/AArch64/AArch64InstrInfo.cpp b/lib/Target/AArch64/AArch64InstrInfo.cpp index 706d0b05e06..14daab33ecf 100644 --- a/lib/Target/AArch64/AArch64InstrInfo.cpp +++ b/lib/Target/AArch64/AArch64InstrInfo.cpp @@ -29,7 +29,7 @@ #include -#define GET_INSTRINFO_CTOR_DTOR +#define GET_INSTRINFO_CTOR #include "AArch64GenInstrInfo.inc" using namespace llvm; diff --git a/lib/Target/AArch64/AArch64Subtarget.cpp b/lib/Target/AArch64/AArch64Subtarget.cpp index 4da529434b1..eece389302e 100644 --- a/lib/Target/AArch64/AArch64Subtarget.cpp +++ b/lib/Target/AArch64/AArch64Subtarget.cpp @@ -25,9 +25,6 @@ using namespace llvm; -// pin vtable to this file -void AArch64Subtarget::anchor() {} - AArch64Subtarget::AArch64Subtarget(StringRef TT, StringRef CPU, StringRef FS) : AArch64GenSubtargetInfo(TT, CPU, FS), HasFPARMv8(false), HasNEON(false), HasCrypto(false), TargetTriple(TT), CPUString(CPU) { diff --git a/lib/Target/AArch64/AArch64Subtarget.h b/lib/Target/AArch64/AArch64Subtarget.h index bbfd3bc7dfa..57eb187c9d1 100644 --- a/lib/Target/AArch64/AArch64Subtarget.h +++ b/lib/Target/AArch64/AArch64Subtarget.h @@ -27,7 +27,6 @@ class StringRef; class GlobalValue; class AArch64Subtarget : public AArch64GenSubtargetInfo { - virtual void anchor(); protected: bool HasFPARMv8; bool HasNEON; diff --git a/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp b/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp index d0015022d8e..dd12e2c08c5 100644 --- a/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp +++ b/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp @@ -37,5 +37,3 @@ AArch64ELFMCAsmInfo::AArch64ELFMCAsmInfo() { // Exceptions handling ExceptionsType = ExceptionHandling::DwarfCFI; } - -void AArch64ELFMCAsmInfo::anchor() {} diff --git a/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.h b/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.h index 67158c6b367..ae0a674fa83 100644 --- a/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.h +++ b/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.h @@ -18,12 +18,9 @@ namespace llvm { -struct AArch64ELFMCAsmInfo : public MCAsmInfoELF { - explicit AArch64ELFMCAsmInfo(); - -private: - virtual void anchor(); -}; + struct AArch64ELFMCAsmInfo : public MCAsmInfoELF { + explicit AArch64ELFMCAsmInfo(); + }; } // namespace llvm diff --git a/lib/Target/ARM/ARMBaseInstrInfo.cpp b/lib/Target/ARM/ARMBaseInstrInfo.cpp index b2dd9d85e52..b76ef9671bb 100644 --- a/lib/Target/ARM/ARMBaseInstrInfo.cpp +++ b/lib/Target/ARM/ARMBaseInstrInfo.cpp @@ -37,7 +37,7 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" -#define GET_INSTRINFO_CTOR_DTOR +#define GET_INSTRINFO_CTOR #include "ARMGenInstrInfo.inc" using namespace llvm; diff --git a/lib/Target/Hexagon/CMakeLists.txt b/lib/Target/Hexagon/CMakeLists.txt index ae3c9ebc255..2b797910e43 100644 --- a/lib/Target/Hexagon/CMakeLists.txt +++ b/lib/Target/Hexagon/CMakeLists.txt @@ -17,7 +17,6 @@ add_llvm_target(HexagonCodeGen HexagonFrameLowering.cpp HexagonHardwareLoops.cpp HexagonFixupHwLoops.cpp - HexagonMachineFunctionInfo.cpp HexagonMachineScheduler.cpp HexagonMCInstLower.cpp HexagonInstrInfo.cpp diff --git a/lib/Target/Hexagon/HexagonInstrInfo.cpp b/lib/Target/Hexagon/HexagonInstrInfo.cpp index 7d5b284188c..5af645c7cb6 100644 --- a/lib/Target/Hexagon/HexagonInstrInfo.cpp +++ b/lib/Target/Hexagon/HexagonInstrInfo.cpp @@ -26,7 +26,7 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" -#define GET_INSTRINFO_CTOR_DTOR +#define GET_INSTRINFO_CTOR #define GET_INSTRMAP_INFO #include "HexagonGenInstrInfo.inc" #include "HexagonGenDFAPacketizer.inc" @@ -55,8 +55,6 @@ const int Hexagon_MEMH_AUTOINC_MIN = -16; const int Hexagon_MEMB_AUTOINC_MAX = 7; const int Hexagon_MEMB_AUTOINC_MIN = -8; -// pin vtable to this file -void HexagonInstrInfo::anchor() {} HexagonInstrInfo::HexagonInstrInfo(HexagonSubtarget &ST) : HexagonGenInstrInfo(Hexagon::ADJCALLSTACKDOWN, Hexagon::ADJCALLSTACKUP), diff --git a/lib/Target/Hexagon/HexagonInstrInfo.h b/lib/Target/Hexagon/HexagonInstrInfo.h index 7679b5f04e2..3c28df438d1 100644 --- a/lib/Target/Hexagon/HexagonInstrInfo.h +++ b/lib/Target/Hexagon/HexagonInstrInfo.h @@ -30,8 +30,6 @@ class HexagonInstrInfo : public HexagonGenInstrInfo { const HexagonSubtarget &Subtarget; typedef unsigned Opcode_t; - virtual void anchor(); - public: explicit HexagonInstrInfo(HexagonSubtarget &ST); diff --git a/lib/Target/Hexagon/HexagonMachineFunctionInfo.cpp b/lib/Target/Hexagon/HexagonMachineFunctionInfo.cpp deleted file mode 100644 index 9579c8b6df1..00000000000 --- a/lib/Target/Hexagon/HexagonMachineFunctionInfo.cpp +++ /dev/null @@ -1,16 +0,0 @@ -//= HexagonMachineFunctionInfo.cpp - Hexagon machine function info *- C++ -*-=// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "HexagonMachineFunctionInfo.h" - -using namespace llvm; - -// pin vtable to this file -void HexagonMachineFunctionInfo::anchor() {} - diff --git a/lib/Target/Hexagon/HexagonMachineFunctionInfo.h b/lib/Target/Hexagon/HexagonMachineFunctionInfo.h index c68416c20bc..bd7b26a6190 100644 --- a/lib/Target/Hexagon/HexagonMachineFunctionInfo.h +++ b/lib/Target/Hexagon/HexagonMachineFunctionInfo.h @@ -1,4 +1,4 @@ -//=- HexagonMachineFunctionInfo.h - Hexagon machine function info -*- C++ -*-=// +//=- HexagonMachineFuctionInfo.h - Hexagon machine function info --*- C++ -*-=// // // The LLVM Compiler Infrastructure // @@ -10,7 +10,6 @@ #ifndef HexagonMACHINEFUNCTIONINFO_H #define HexagonMACHINEFUNCTIONINFO_H -#include #include "llvm/CodeGen/MachineFunction.h" namespace llvm { @@ -34,7 +33,6 @@ class HexagonMachineFunctionInfo : public MachineFunctionInfo { std::map PacketInfo; - virtual void anchor(); public: HexagonMachineFunctionInfo() : SRetReturnReg(0), HasClobberLR(0), diff --git a/lib/Target/Hexagon/HexagonSubtarget.cpp b/lib/Target/Hexagon/HexagonSubtarget.cpp index a0a7c3d6407..07d5ce1d8ab 100644 --- a/lib/Target/Hexagon/HexagonSubtarget.cpp +++ b/lib/Target/Hexagon/HexagonSubtarget.cpp @@ -86,4 +86,3 @@ HexagonSubtarget::HexagonSubtarget(StringRef TT, StringRef CPU, StringRef FS): ModeIEEERndNear = false; } -HexagonSubtarget::~HexagonSubtarget() {} diff --git a/lib/Target/Hexagon/HexagonSubtarget.h b/lib/Target/Hexagon/HexagonSubtarget.h index e8711103d0d..76a8fba195f 100644 --- a/lib/Target/Hexagon/HexagonSubtarget.h +++ b/lib/Target/Hexagon/HexagonSubtarget.h @@ -42,7 +42,6 @@ public: public: HexagonSubtarget(StringRef TT, StringRef CPU, StringRef FS); - virtual ~HexagonSubtarget(); /// getInstrItins - Return the instruction itineraies based on subtarget /// selection. diff --git a/lib/Target/Hexagon/MCTargetDesc/HexagonMCAsmInfo.cpp b/lib/Target/Hexagon/MCTargetDesc/HexagonMCAsmInfo.cpp index fa13008ae89..b9fef0ce4d7 100644 --- a/lib/Target/Hexagon/MCTargetDesc/HexagonMCAsmInfo.cpp +++ b/lib/Target/Hexagon/MCTargetDesc/HexagonMCAsmInfo.cpp @@ -15,9 +15,6 @@ using namespace llvm; -// pin vtable to this file -void HexagonMCAsmInfo::anchor() {} - HexagonMCAsmInfo::HexagonMCAsmInfo(StringRef TT) { Data16bitsDirective = "\t.half\t"; Data32bitsDirective = "\t.word\t"; diff --git a/lib/Target/Hexagon/MCTargetDesc/HexagonMCAsmInfo.h b/lib/Target/Hexagon/MCTargetDesc/HexagonMCAsmInfo.h index bd8cb7637af..b2c1d377a32 100644 --- a/lib/Target/Hexagon/MCTargetDesc/HexagonMCAsmInfo.h +++ b/lib/Target/Hexagon/MCTargetDesc/HexagonMCAsmInfo.h @@ -19,7 +19,6 @@ namespace llvm { class HexagonMCAsmInfo : public MCAsmInfoELF { - virtual void anchor(); public: explicit HexagonMCAsmInfo(StringRef TT); }; diff --git a/lib/Target/MSP430/MSP430InstrInfo.cpp b/lib/Target/MSP430/MSP430InstrInfo.cpp index f0695a7f7c2..c8505946dfa 100644 --- a/lib/Target/MSP430/MSP430InstrInfo.cpp +++ b/lib/Target/MSP430/MSP430InstrInfo.cpp @@ -22,14 +22,11 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/TargetRegistry.h" -#define GET_INSTRINFO_CTOR_DTOR +#define GET_INSTRINFO_CTOR #include "MSP430GenInstrInfo.inc" using namespace llvm; -// pin vtable to this file -void MSP430InstrInfo::anchor() {} - MSP430InstrInfo::MSP430InstrInfo(MSP430TargetMachine &tm) : MSP430GenInstrInfo(MSP430::ADJCALLSTACKDOWN, MSP430::ADJCALLSTACKUP), RI(tm) {} diff --git a/lib/Target/MSP430/MSP430InstrInfo.h b/lib/Target/MSP430/MSP430InstrInfo.h index ad2b8cc7cd4..d79f99245e7 100644 --- a/lib/Target/MSP430/MSP430InstrInfo.h +++ b/lib/Target/MSP430/MSP430InstrInfo.h @@ -42,7 +42,6 @@ namespace MSP430II { class MSP430InstrInfo : public MSP430GenInstrInfo { const MSP430RegisterInfo RI; - virtual void anchor(); public: explicit MSP430InstrInfo(MSP430TargetMachine &TM); diff --git a/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp b/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp index 3d417a88e48..6c48053615e 100644 --- a/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp +++ b/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp @@ -42,9 +42,6 @@ using namespace llvm; static cl::opt PrintHackDirectives("print-hack-directives", cl::init(false), cl::Hidden); -// pin vtable to this file -void MipsTargetStreamer::anchor() {} - static std::string ParseMipsTriple(StringRef TT, StringRef CPU) { std::string MipsArchFeature; size_t DashPosition = 0; diff --git a/lib/Target/Mips/MipsInstrInfo.cpp b/lib/Target/Mips/MipsInstrInfo.cpp index a36dcc8995d..7b04a9a3759 100644 --- a/lib/Target/Mips/MipsInstrInfo.cpp +++ b/lib/Target/Mips/MipsInstrInfo.cpp @@ -22,14 +22,11 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/TargetRegistry.h" -#define GET_INSTRINFO_CTOR_DTOR +#define GET_INSTRINFO_CTOR #include "MipsGenInstrInfo.inc" using namespace llvm; -// pin vtable to this file -void MipsInstrInfo::anchor() {} - MipsInstrInfo::MipsInstrInfo(MipsTargetMachine &tm, unsigned UncondBr) : MipsGenInstrInfo(Mips::ADJCALLSTACKDOWN, Mips::ADJCALLSTACKUP), TM(tm), UncondBrOpc(UncondBr) {} diff --git a/lib/Target/Mips/MipsInstrInfo.h b/lib/Target/Mips/MipsInstrInfo.h index d9ac961cd33..b6480ef3376 100644 --- a/lib/Target/Mips/MipsInstrInfo.h +++ b/lib/Target/Mips/MipsInstrInfo.h @@ -27,7 +27,6 @@ namespace llvm { class MipsInstrInfo : public MipsGenInstrInfo { - virtual void anchor(); protected: MipsTargetMachine &TM; unsigned UncondBrOpc; diff --git a/lib/Target/Mips/MipsTargetStreamer.h b/lib/Target/Mips/MipsTargetStreamer.h index 237017a3d20..fb9f5ef9e0e 100644 --- a/lib/Target/Mips/MipsTargetStreamer.h +++ b/lib/Target/Mips/MipsTargetStreamer.h @@ -14,7 +14,6 @@ namespace llvm { class MipsTargetStreamer : public MCTargetStreamer { - virtual void anchor(); public: virtual void emitMipsHackELFFlags(unsigned Flags) = 0; virtual void emitMipsHackSTOCG(MCSymbol *Sym, unsigned Val) = 0; diff --git a/lib/Target/NVPTX/NVPTXISelLowering.cpp b/lib/Target/NVPTX/NVPTXISelLowering.cpp index 756b15e18fb..7ff43bf2310 100644 --- a/lib/Target/NVPTX/NVPTXISelLowering.cpp +++ b/lib/Target/NVPTX/NVPTXISelLowering.cpp @@ -2288,29 +2288,3 @@ void NVPTXTargetLowering::ReplaceNodeResults( return; } } - -// pin NVPTXSection.h and NVPTXTargetObjectFile.h vtables to this file -void NVPTXSection::anchor() {} - -NVPTXTargetObjectFile::~NVPTXTargetObjectFile() { - delete TextSection; - delete DataSection; - delete BSSSection; - delete ReadOnlySection; - - delete StaticCtorSection; - delete StaticDtorSection; - delete LSDASection; - delete EHFrameSection; - delete DwarfAbbrevSection; - delete DwarfInfoSection; - delete DwarfLineSection; - delete DwarfFrameSection; - delete DwarfPubTypesSection; - delete DwarfDebugInlineSection; - delete DwarfStrSection; - delete DwarfLocSection; - delete DwarfARangesSection; - delete DwarfRangesSection; - delete DwarfMacroInfoSection; -} diff --git a/lib/Target/NVPTX/NVPTXInstrInfo.cpp b/lib/Target/NVPTX/NVPTXInstrInfo.cpp index ce5b5d5ffb3..1f54d3e6ed3 100644 --- a/lib/Target/NVPTX/NVPTXInstrInfo.cpp +++ b/lib/Target/NVPTX/NVPTXInstrInfo.cpp @@ -14,7 +14,7 @@ #include "NVPTX.h" #include "NVPTXInstrInfo.h" #include "NVPTXTargetMachine.h" -#define GET_INSTRINFO_CTOR_DTOR +#define GET_INSTRINFO_CTOR #include "NVPTXGenInstrInfo.inc" #include "llvm/IR/Function.h" #include "llvm/ADT/STLExtras.h" @@ -24,9 +24,6 @@ using namespace llvm; -// pin vtable to this file -void NVPTXInstrInfo::anchor() {} - // FIXME: Add the subtarget support on this constructor. NVPTXInstrInfo::NVPTXInstrInfo(NVPTXTargetMachine &tm) : NVPTXGenInstrInfo(), TM(tm), RegInfo(*TM.getSubtargetImpl()) {} diff --git a/lib/Target/NVPTX/NVPTXInstrInfo.h b/lib/Target/NVPTX/NVPTXInstrInfo.h index 600fc5c60a1..b1972e9b725 100644 --- a/lib/Target/NVPTX/NVPTXInstrInfo.h +++ b/lib/Target/NVPTX/NVPTXInstrInfo.h @@ -26,7 +26,6 @@ namespace llvm { class NVPTXInstrInfo : public NVPTXGenInstrInfo { NVPTXTargetMachine &TM; const NVPTXRegisterInfo RegInfo; - virtual void anchor(); public: explicit NVPTXInstrInfo(NVPTXTargetMachine &TM); diff --git a/lib/Target/NVPTX/NVPTXSection.h b/lib/Target/NVPTX/NVPTXSection.h index f8a692e9b1a..e57ace92e85 100644 --- a/lib/Target/NVPTX/NVPTXSection.h +++ b/lib/Target/NVPTX/NVPTXSection.h @@ -24,10 +24,10 @@ namespace llvm { /// the ASMPrint interface. /// class NVPTXSection : public MCSection { - virtual void anchor(); + public: NVPTXSection(SectionVariant V, SectionKind K) : MCSection(V, K) {} - virtual ~NVPTXSection() {} + ~NVPTXSection() {} /// Override this as NVPTX has its own way of printing switching /// to a section. diff --git a/lib/Target/NVPTX/NVPTXSubtarget.cpp b/lib/Target/NVPTX/NVPTXSubtarget.cpp index 3e5bcf79dd6..c4d0d6e4193 100644 --- a/lib/Target/NVPTX/NVPTXSubtarget.cpp +++ b/lib/Target/NVPTX/NVPTXSubtarget.cpp @@ -20,9 +20,6 @@ using namespace llvm; -// pin vtable to this file -void NVPTXSubtarget::anchor() {} - NVPTXSubtarget::NVPTXSubtarget(const std::string &TT, const std::string &CPU, const std::string &FS, bool is64Bit) : NVPTXGenSubtargetInfo(TT, CPU, FS), Is64Bit(is64Bit), PTXVersion(0), diff --git a/lib/Target/NVPTX/NVPTXSubtarget.h b/lib/Target/NVPTX/NVPTXSubtarget.h index a1839203416..670077daaa6 100644 --- a/lib/Target/NVPTX/NVPTXSubtarget.h +++ b/lib/Target/NVPTX/NVPTXSubtarget.h @@ -36,8 +36,6 @@ class NVPTXSubtarget : public NVPTXGenSubtargetInfo { // SM version x.y is represented as 10*x+y, e.g. 3.1 == 31 unsigned int SmVersion; - virtual void anchor(); - public: /// This constructor initializes the data members to match that /// of the specified module. diff --git a/lib/Target/NVPTX/NVPTXTargetObjectFile.h b/lib/Target/NVPTX/NVPTXTargetObjectFile.h index 2a7394b79ae..1449f52a966 100644 --- a/lib/Target/NVPTX/NVPTXTargetObjectFile.h +++ b/lib/Target/NVPTX/NVPTXTargetObjectFile.h @@ -44,7 +44,28 @@ public: DwarfMacroInfoSection = 0; } - virtual ~NVPTXTargetObjectFile(); + ~NVPTXTargetObjectFile() { + delete TextSection; + delete DataSection; + delete BSSSection; + delete ReadOnlySection; + + delete StaticCtorSection; + delete StaticDtorSection; + delete LSDASection; + delete EHFrameSection; + delete DwarfAbbrevSection; + delete DwarfInfoSection; + delete DwarfLineSection; + delete DwarfFrameSection; + delete DwarfPubTypesSection; + delete DwarfDebugInlineSection; + delete DwarfStrSection; + delete DwarfLocSection; + delete DwarfARangesSection; + delete DwarfRangesSection; + delete DwarfMacroInfoSection; + } virtual void Initialize(MCContext &ctx, const TargetMachine &TM) { TargetLoweringObjectFile::Initialize(ctx, TM); diff --git a/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp b/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp index 8f4e224219a..5c08de1ccf3 100644 --- a/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp +++ b/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp @@ -37,9 +37,6 @@ using namespace llvm; -// pin vtable to this file -PPCTargetStreamer::~PPCTargetStreamer() {} - static MCInstrInfo *createPPCMCInstrInfo() { MCInstrInfo *X = new MCInstrInfo(); InitPPCMCInstrInfo(X); diff --git a/lib/Target/PowerPC/PPCInstrInfo.cpp b/lib/Target/PowerPC/PPCInstrInfo.cpp index 102057193e2..375daee59e9 100644 --- a/lib/Target/PowerPC/PPCInstrInfo.cpp +++ b/lib/Target/PowerPC/PPCInstrInfo.cpp @@ -33,7 +33,7 @@ #include "llvm/Support/raw_ostream.h" #define GET_INSTRMAP_INFO -#define GET_INSTRINFO_CTOR_DTOR +#define GET_INSTRINFO_CTOR #include "PPCGenInstrInfo.inc" using namespace llvm; @@ -45,9 +45,6 @@ opt DisableCTRLoopAnal("disable-ppc-ctrloop-analysis", cl::Hidden, static cl::opt DisableCmpOpt("disable-ppc-cmp-opt", cl::desc("Disable compare instruction optimization"), cl::Hidden); -//pin vtable to this file -void PPCInstrInfo::anchor() {} - PPCInstrInfo::PPCInstrInfo(PPCTargetMachine &tm) : PPCGenInstrInfo(PPC::ADJCALLSTACKDOWN, PPC::ADJCALLSTACKUP), TM(tm), RI(*TM.getSubtargetImpl()) {} diff --git a/lib/Target/PowerPC/PPCInstrInfo.h b/lib/Target/PowerPC/PPCInstrInfo.h index f140c41a2a8..bd72a4d9e51 100644 --- a/lib/Target/PowerPC/PPCInstrInfo.h +++ b/lib/Target/PowerPC/PPCInstrInfo.h @@ -78,7 +78,6 @@ class PPCInstrInfo : public PPCGenInstrInfo { const TargetRegisterClass *RC, SmallVectorImpl &NewMIs, bool &NonRI, bool &SpillsVRS) const; - virtual void anchor(); public: explicit PPCInstrInfo(PPCTargetMachine &TM); diff --git a/lib/Target/PowerPC/PPCTargetStreamer.h b/lib/Target/PowerPC/PPCTargetStreamer.h index e876be16a9b..3ecd8a8b0a4 100644 --- a/lib/Target/PowerPC/PPCTargetStreamer.h +++ b/lib/Target/PowerPC/PPCTargetStreamer.h @@ -15,7 +15,6 @@ namespace llvm { class PPCTargetStreamer : public MCTargetStreamer { public: - virtual ~PPCTargetStreamer(); virtual void emitTCEntry(const MCSymbol &S) = 0; }; } diff --git a/lib/Target/R600/AMDGPUInstrInfo.cpp b/lib/Target/R600/AMDGPUInstrInfo.cpp index 3a859cf407a..1b2e131fb9c 100644 --- a/lib/Target/R600/AMDGPUInstrInfo.cpp +++ b/lib/Target/R600/AMDGPUInstrInfo.cpp @@ -20,17 +20,13 @@ #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineRegisterInfo.h" -#define GET_INSTRINFO_CTOR_DTOR +#define GET_INSTRINFO_CTOR #define GET_INSTRINFO_NAMED_OPS #define GET_INSTRMAP_INFO #include "AMDGPUGenInstrInfo.inc" using namespace llvm; - -// pin vtable to this file -void AMDGPUInstrInfo::anchor() {} - AMDGPUInstrInfo::AMDGPUInstrInfo(TargetMachine &tm) : AMDGPUGenInstrInfo(-1,-1), RI(tm), TM(tm) { } diff --git a/lib/Target/R600/AMDGPUInstrInfo.h b/lib/Target/R600/AMDGPUInstrInfo.h index ce5b58c6923..6378fdd1eb4 100644 --- a/lib/Target/R600/AMDGPUInstrInfo.h +++ b/lib/Target/R600/AMDGPUInstrInfo.h @@ -43,7 +43,6 @@ private: const AMDGPURegisterInfo RI; bool getNextBranchInstr(MachineBasicBlock::iterator &iter, MachineBasicBlock &MBB) const; - virtual void anchor(); protected: TargetMachine &TM; public: diff --git a/lib/Target/R600/AMDGPUMachineFunction.cpp b/lib/Target/R600/AMDGPUMachineFunction.cpp index d4531012c84..f2342b0e885 100644 --- a/lib/Target/R600/AMDGPUMachineFunction.cpp +++ b/lib/Target/R600/AMDGPUMachineFunction.cpp @@ -6,9 +6,6 @@ using namespace llvm; static const char *const ShaderTypeAttribute = "ShaderType"; -// pin vtable to this file -void AMDGPUMachineFunction::anchor() {} - AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) : MachineFunctionInfo() { ShaderType = ShaderType::COMPUTE; diff --git a/lib/Target/R600/AMDGPUMachineFunction.h b/lib/Target/R600/AMDGPUMachineFunction.h index fea0b39e91e..fe80ce3f015 100644 --- a/lib/Target/R600/AMDGPUMachineFunction.h +++ b/lib/Target/R600/AMDGPUMachineFunction.h @@ -19,7 +19,6 @@ namespace llvm { class AMDGPUMachineFunction : public MachineFunctionInfo { - virtual void anchor(); public: AMDGPUMachineFunction(const MachineFunction &MF); unsigned ShaderType; diff --git a/lib/Target/R600/MCTargetDesc/AMDGPUMCCodeEmitter.cpp b/lib/Target/R600/MCTargetDesc/AMDGPUMCCodeEmitter.cpp deleted file mode 100644 index 521b3b39bba..00000000000 --- a/lib/Target/R600/MCTargetDesc/AMDGPUMCCodeEmitter.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===-- AMDGPUCodeEmitter.cpp - AMDGPU Code Emitter interface -------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -/// \file -/// \brief CodeEmitter interface for R600 and SI codegen. -// -//===----------------------------------------------------------------------===// - -#include "AMDGPUMCCodeEmitter.h" - -using namespace llvm; - -// pin vtable to this file -void AMDGPUMCCodeEmitter::anchor() {} - diff --git a/lib/Target/R600/MCTargetDesc/AMDGPUMCCodeEmitter.h b/lib/Target/R600/MCTargetDesc/AMDGPUMCCodeEmitter.h index d8cf64adb91..cd3a7ce65aa 100644 --- a/lib/Target/R600/MCTargetDesc/AMDGPUMCCodeEmitter.h +++ b/lib/Target/R600/MCTargetDesc/AMDGPUMCCodeEmitter.h @@ -24,7 +24,6 @@ class MCInst; class MCOperand; class AMDGPUMCCodeEmitter : public MCCodeEmitter { - virtual void anchor(); public: uint64_t getBinaryCodeForInstr(const MCInst &MI, diff --git a/lib/Target/R600/MCTargetDesc/CMakeLists.txt b/lib/Target/R600/MCTargetDesc/CMakeLists.txt index 98f6925d9fb..3ccdf420601 100644 --- a/lib/Target/R600/MCTargetDesc/CMakeLists.txt +++ b/lib/Target/R600/MCTargetDesc/CMakeLists.txt @@ -2,7 +2,6 @@ add_llvm_library(LLVMR600Desc AMDGPUAsmBackend.cpp AMDGPUELFObjectWriter.cpp - AMDGPUMCCodeEmitter.cpp AMDGPUMCTargetDesc.cpp AMDGPUMCAsmInfo.cpp R600MCCodeEmitter.cpp diff --git a/lib/Target/R600/R600InstrInfo.cpp b/lib/Target/R600/R600InstrInfo.cpp index 1f4741634e1..6381c38919a 100644 --- a/lib/Target/R600/R600InstrInfo.cpp +++ b/lib/Target/R600/R600InstrInfo.cpp @@ -23,7 +23,7 @@ #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineRegisterInfo.h" -#define GET_INSTRINFO_CTOR_DTOR +#define GET_INSTRINFO_CTOR #include "AMDGPUGenDFAPacketizer.inc" using namespace llvm; diff --git a/lib/Target/R600/R600MachineFunctionInfo.cpp b/lib/Target/R600/R600MachineFunctionInfo.cpp index d0d35cf0efe..018b4036336 100644 --- a/lib/Target/R600/R600MachineFunctionInfo.cpp +++ b/lib/Target/R600/R600MachineFunctionInfo.cpp @@ -12,9 +12,7 @@ using namespace llvm; - -// pin vtable to this file -void R600MachineFunctionInfo::anchor() {} - R600MachineFunctionInfo::R600MachineFunctionInfo(const MachineFunction &MF) : AMDGPUMachineFunction(MF) { } + + diff --git a/lib/Target/R600/R600MachineFunctionInfo.h b/lib/Target/R600/R600MachineFunctionInfo.h index c1bec0aae7e..f23d9b78b31 100644 --- a/lib/Target/R600/R600MachineFunctionInfo.h +++ b/lib/Target/R600/R600MachineFunctionInfo.h @@ -21,7 +21,6 @@ namespace llvm { class R600MachineFunctionInfo : public AMDGPUMachineFunction { - virtual void anchor(); public: R600MachineFunctionInfo(const MachineFunction &MF); SmallVector LiveOuts; diff --git a/lib/Target/R600/SIMachineFunctionInfo.cpp b/lib/Target/R600/SIMachineFunctionInfo.cpp index 2f66360d83c..ee0e30755f0 100644 --- a/lib/Target/R600/SIMachineFunctionInfo.cpp +++ b/lib/Target/R600/SIMachineFunctionInfo.cpp @@ -13,10 +13,6 @@ using namespace llvm; - -// pin vtable to this file -void SIMachineFunctionInfo::anchor() {} - SIMachineFunctionInfo::SIMachineFunctionInfo(const MachineFunction &MF) : AMDGPUMachineFunction(MF), PSInputAddr(0) { } diff --git a/lib/Target/R600/SIMachineFunctionInfo.h b/lib/Target/R600/SIMachineFunctionInfo.h index 2f1961cafdb..6da9f7f9a14 100644 --- a/lib/Target/R600/SIMachineFunctionInfo.h +++ b/lib/Target/R600/SIMachineFunctionInfo.h @@ -22,7 +22,6 @@ namespace llvm { /// This class keeps track of the SPI_SP_INPUT_ADDR config register, which /// tells the hardware which interpolation parameters to load. class SIMachineFunctionInfo : public AMDGPUMachineFunction { - virtual void anchor(); public: SIMachineFunctionInfo(const MachineFunction &MF); unsigned PSInputAddr; diff --git a/lib/Target/Sparc/SparcInstrInfo.cpp b/lib/Target/Sparc/SparcInstrInfo.cpp index 5e5e37a778a..93d7b56501f 100644 --- a/lib/Target/Sparc/SparcInstrInfo.cpp +++ b/lib/Target/Sparc/SparcInstrInfo.cpp @@ -24,15 +24,11 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/TargetRegistry.h" -#define GET_INSTRINFO_CTOR_DTOR +#define GET_INSTRINFO_CTOR #include "SparcGenInstrInfo.inc" using namespace llvm; - -// pin vtable to this file -void SparcInstrInfo::anchor() {} - SparcInstrInfo::SparcInstrInfo(SparcSubtarget &ST) : SparcGenInstrInfo(SP::ADJCALLSTACKDOWN, SP::ADJCALLSTACKUP), RI(ST), Subtarget(ST) { diff --git a/lib/Target/Sparc/SparcInstrInfo.h b/lib/Target/Sparc/SparcInstrInfo.h index a86cbcb1c4b..d0b220b73d4 100644 --- a/lib/Target/Sparc/SparcInstrInfo.h +++ b/lib/Target/Sparc/SparcInstrInfo.h @@ -37,7 +37,6 @@ namespace SPII { class SparcInstrInfo : public SparcGenInstrInfo { const SparcRegisterInfo RI; const SparcSubtarget& Subtarget; - virtual void anchor(); public: explicit SparcInstrInfo(SparcSubtarget &ST); diff --git a/lib/Target/SystemZ/CMakeLists.txt b/lib/Target/SystemZ/CMakeLists.txt index d21c0a8086f..8a4eaa35e92 100644 --- a/lib/Target/SystemZ/CMakeLists.txt +++ b/lib/Target/SystemZ/CMakeLists.txt @@ -21,7 +21,6 @@ add_llvm_target(SystemZCodeGen SystemZISelLowering.cpp SystemZInstrInfo.cpp SystemZLongBranch.cpp - SystemZMachineFunctionInfo.cpp SystemZMCInstLower.cpp SystemZRegisterInfo.cpp SystemZSelectionDAGInfo.cpp diff --git a/lib/Target/SystemZ/SystemZInstrInfo.cpp b/lib/Target/SystemZ/SystemZInstrInfo.cpp index 67aacf3551f..2ebbc0d81ae 100644 --- a/lib/Target/SystemZ/SystemZInstrInfo.cpp +++ b/lib/Target/SystemZ/SystemZInstrInfo.cpp @@ -17,7 +17,7 @@ #include "llvm/CodeGen/LiveVariables.h" #include "llvm/CodeGen/MachineRegisterInfo.h" -#define GET_INSTRINFO_CTOR_DTOR +#define GET_INSTRINFO_CTOR #define GET_INSTRMAP_INFO #include "SystemZGenInstrInfo.inc" @@ -37,9 +37,6 @@ static bool isHighReg(unsigned int Reg) { return false; } -// pin vtable to this file -void SystemZInstrInfo::anchor() {} - SystemZInstrInfo::SystemZInstrInfo(SystemZTargetMachine &tm) : SystemZGenInstrInfo(SystemZ::ADJCALLSTACKDOWN, SystemZ::ADJCALLSTACKUP), RI(tm), TM(tm) { diff --git a/lib/Target/SystemZ/SystemZInstrInfo.h b/lib/Target/SystemZ/SystemZInstrInfo.h index be4c8fe2add..7978be42c90 100644 --- a/lib/Target/SystemZ/SystemZInstrInfo.h +++ b/lib/Target/SystemZ/SystemZInstrInfo.h @@ -127,7 +127,6 @@ class SystemZInstrInfo : public SystemZGenInstrInfo { void emitGRX32Move(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, DebugLoc DL, unsigned DestReg, unsigned SrcReg, unsigned LowLowOpcode, unsigned Size, bool KillSrc) const; - virtual void anchor(); public: explicit SystemZInstrInfo(SystemZTargetMachine &TM); diff --git a/lib/Target/SystemZ/SystemZMachineFunctionInfo.cpp b/lib/Target/SystemZ/SystemZMachineFunctionInfo.cpp deleted file mode 100644 index 00572d0b9d7..00000000000 --- a/lib/Target/SystemZ/SystemZMachineFunctionInfo.cpp +++ /dev/null @@ -1,17 +0,0 @@ -//== SystemZMachineFuctionInfo.cpp - SystemZ machine function info-*- C++ -*-=// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "SystemZMachineFunctionInfo.h" - -using namespace llvm; - - -// pin vtable to this file -void SystemZMachineFunctionInfo::anchor() {} - diff --git a/lib/Target/SystemZ/SystemZMachineFunctionInfo.h b/lib/Target/SystemZ/SystemZMachineFunctionInfo.h index 509cef6d646..69c269137e0 100644 --- a/lib/Target/SystemZ/SystemZMachineFunctionInfo.h +++ b/lib/Target/SystemZ/SystemZMachineFunctionInfo.h @@ -23,8 +23,6 @@ class SystemZMachineFunctionInfo : public MachineFunctionInfo { unsigned RegSaveFrameIndex; bool ManipulatesSP; - virtual void anchor(); - public: explicit SystemZMachineFunctionInfo(MachineFunction &MF) : LowSavedGPR(0), HighSavedGPR(0), VarArgsFirstGPR(0), VarArgsFirstFPR(0), diff --git a/lib/Target/SystemZ/SystemZSubtarget.cpp b/lib/Target/SystemZ/SystemZSubtarget.cpp index b9a9db2aa77..474192099f2 100644 --- a/lib/Target/SystemZ/SystemZSubtarget.cpp +++ b/lib/Target/SystemZ/SystemZSubtarget.cpp @@ -18,9 +18,6 @@ using namespace llvm; -// pin vtabel to this file -void SystemZSubtarget::anchor() {} - SystemZSubtarget::SystemZSubtarget(const std::string &TT, const std::string &CPU, const std::string &FS) diff --git a/lib/Target/SystemZ/SystemZSubtarget.h b/lib/Target/SystemZ/SystemZSubtarget.h index 5817491d458..74d3f90ad74 100644 --- a/lib/Target/SystemZ/SystemZSubtarget.h +++ b/lib/Target/SystemZ/SystemZSubtarget.h @@ -26,7 +26,6 @@ class GlobalValue; class StringRef; class SystemZSubtarget : public SystemZGenSubtargetInfo { - virtual void anchor(); protected: bool HasDistinctOps; bool HasLoadStoreOnCond; diff --git a/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp b/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp index 6da414287cf..ed64a32eeff 100644 --- a/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp +++ b/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp @@ -27,7 +27,7 @@ namespace { public: X86WinCOFFObjectWriter(bool Is64Bit_); - virtual ~X86WinCOFFObjectWriter(); + ~X86WinCOFFObjectWriter(); virtual unsigned getRelocType(const MCValue &Target, const MCFixup &Fixup, diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp index b13fd33d4f7..63f699a0072 100644 --- a/lib/Target/X86/X86InstrInfo.cpp +++ b/lib/Target/X86/X86InstrInfo.cpp @@ -36,7 +36,7 @@ #include "llvm/Target/TargetOptions.h" #include -#define GET_INSTRINFO_CTOR_DTOR +#define GET_INSTRINFO_CTOR #include "X86GenInstrInfo.inc" using namespace llvm; @@ -92,9 +92,6 @@ struct X86OpTblEntry { uint16_t Flags; }; -// pin vtable to this file -void X86InstrInfo::anchor() {} - X86InstrInfo::X86InstrInfo(X86TargetMachine &tm) : X86GenInstrInfo((tm.getSubtarget().is64Bit() ? X86::ADJCALLSTACKDOWN64 diff --git a/lib/Target/X86/X86InstrInfo.h b/lib/Target/X86/X86InstrInfo.h index 600e3922a71..532e7805ad5 100644 --- a/lib/Target/X86/X86InstrInfo.h +++ b/lib/Target/X86/X86InstrInfo.h @@ -152,8 +152,6 @@ class X86InstrInfo : public X86GenInstrInfo { MemOp2RegOpTableType &M2RTable, unsigned RegOp, unsigned MemOp, unsigned Flags); - virtual void anchor(); - public: explicit X86InstrInfo(X86TargetMachine &tm); diff --git a/lib/Target/XCore/XCoreInstrInfo.cpp b/lib/Target/XCore/XCoreInstrInfo.cpp index 71939650d9e..d6b8c2d5ede 100644 --- a/lib/Target/XCore/XCoreInstrInfo.cpp +++ b/lib/Target/XCore/XCoreInstrInfo.cpp @@ -22,7 +22,7 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/TargetRegistry.h" -#define GET_INSTRINFO_CTOR_DTOR +#define GET_INSTRINFO_CTOR #include "XCoreGenInstrInfo.inc" namespace llvm { @@ -39,10 +39,6 @@ namespace XCore { using namespace llvm; - -// pin vtable to this file -void XCoreInstrInfo::anchor() {} - XCoreInstrInfo::XCoreInstrInfo() : XCoreGenInstrInfo(XCore::ADJCALLSTACKDOWN, XCore::ADJCALLSTACKUP), RI() { diff --git a/lib/Target/XCore/XCoreInstrInfo.h b/lib/Target/XCore/XCoreInstrInfo.h index 4429b07e41e..51d66a1f20d 100644 --- a/lib/Target/XCore/XCoreInstrInfo.h +++ b/lib/Target/XCore/XCoreInstrInfo.h @@ -24,7 +24,6 @@ namespace llvm { class XCoreInstrInfo : public XCoreGenInstrInfo { const XCoreRegisterInfo RI; - virtual void anchor(); public: XCoreInstrInfo(); diff --git a/tools/llvm-stress/llvm-stress.cpp b/tools/llvm-stress/llvm-stress.cpp index d262a69d932..15f7abf70e9 100644 --- a/tools/llvm-stress/llvm-stress.cpp +++ b/tools/llvm-stress/llvm-stress.cpp @@ -128,7 +128,7 @@ public: BB(Block),PT(PT),Ran(R),Context(BB->getContext()) {} /// virtual D'tor to silence warnings. - virtual ~Modifier(); + virtual ~Modifier() {} /// Add a new instruction. virtual void Act() = 0; @@ -285,11 +285,8 @@ protected: LLVMContext &Context; }; -Modifier::~Modifier() {} - struct LoadModifier: public Modifier { LoadModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {} - virtual ~LoadModifier(); virtual void Act() { // Try to use predefined pointers. If non exist, use undef pointer value; Value *Ptr = getRandomPointerValue(); @@ -298,11 +295,8 @@ struct LoadModifier: public Modifier { } }; -LoadModifier::~LoadModifier() {} - struct StoreModifier: public Modifier { StoreModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {} - virtual ~StoreModifier(); virtual void Act() { // Try to use predefined pointers. If non exist, use undef pointer value; Value *Ptr = getRandomPointerValue(); @@ -319,11 +313,8 @@ struct StoreModifier: public Modifier { } }; -StoreModifier::~StoreModifier() {} - struct BinModifier: public Modifier { BinModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {} - virtual ~BinModifier(); virtual void Act() { Value *Val0 = getRandomVal(); @@ -365,13 +356,9 @@ struct BinModifier: public Modifier { } }; -BinModifier::~BinModifier() {} - /// Generate constant values. struct ConstModifier: public Modifier { ConstModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {} - virtual ~ConstModifier(); - virtual void Act() { Type *Ty = pickType(); @@ -416,11 +403,8 @@ struct ConstModifier: public Modifier { } }; -ConstModifier::~ConstModifier() {} - struct AllocaModifier: public Modifier { AllocaModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R){} - virtual ~AllocaModifier(); virtual void Act() { Type *Tp = pickType(); @@ -428,12 +412,9 @@ struct AllocaModifier: public Modifier { } }; -AllocaModifier::~AllocaModifier() {} - struct ExtractElementModifier: public Modifier { ExtractElementModifier(BasicBlock *BB, PieceTable *PT, Random *R): Modifier(BB, PT, R) {} - virtual ~ExtractElementModifier(); virtual void Act() { Value *Val0 = getRandomVectorValue(); @@ -445,12 +426,8 @@ struct ExtractElementModifier: public Modifier { } }; -ExtractElementModifier::~ExtractElementModifier() {} - struct ShuffModifier: public Modifier { ShuffModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {} - virtual ~ShuffModifier(); - virtual void Act() { Value *Val0 = getRandomVectorValue(); @@ -476,12 +453,9 @@ struct ShuffModifier: public Modifier { } }; -ShuffModifier::~ShuffModifier() {} - struct InsertElementModifier: public Modifier { InsertElementModifier(BasicBlock *BB, PieceTable *PT, Random *R): Modifier(BB, PT, R) {} - virtual ~InsertElementModifier(); virtual void Act() { Value *Val0 = getRandomVectorValue(); @@ -496,12 +470,8 @@ struct InsertElementModifier: public Modifier { }; -InsertElementModifier::~InsertElementModifier() {} - struct CastModifier: public Modifier { CastModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {} - virtual ~CastModifier(); - virtual void Act() { Value *V = getRandomVal(); @@ -585,12 +555,9 @@ struct CastModifier: public Modifier { }; -CastModifier::~CastModifier() {} - struct SelectModifier: public Modifier { SelectModifier(BasicBlock *BB, PieceTable *PT, Random *R): Modifier(BB, PT, R) {} - virtual ~SelectModifier(); virtual void Act() { // Try a bunch of different select configuration until a valid one is found. @@ -612,12 +579,9 @@ struct SelectModifier: public Modifier { } }; -SelectModifier::~SelectModifier() {} struct CmpModifier: public Modifier { CmpModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {} - virtual ~CmpModifier(); - virtual void Act() { Value *Val0 = getRandomVal(); @@ -643,8 +607,6 @@ struct CmpModifier: public Modifier { } }; -CmpModifier::~CmpModifier() {} - void FillFunction(Function *F, Random &R) { // Create a legal entry block. BasicBlock *BB = BasicBlock::Create(F->getContext(), "BB", F); diff --git a/unittests/ADT/IntrusiveRefCntPtrTest.cpp b/unittests/ADT/IntrusiveRefCntPtrTest.cpp index 2be5aaf7368..0c8c4ca16dd 100644 --- a/unittests/ADT/IntrusiveRefCntPtrTest.cpp +++ b/unittests/ADT/IntrusiveRefCntPtrTest.cpp @@ -13,11 +13,9 @@ namespace llvm { struct VirtualRefCounted : public RefCountedBaseVPTR { - virtual void f(); + virtual void f() {} }; -void VirtualRefCounted::f() {} - // Run this test with valgrind to detect memory leaks. TEST(IntrusiveRefCntPtr, RefCountedBaseVPTRCopyDoesNotLeak) { VirtualRefCounted *V1 = new VirtualRefCounted; diff --git a/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp b/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp index e77fd3680bf..e4197ddced6 100644 --- a/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp +++ b/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp @@ -83,8 +83,14 @@ protected: UnsupportedOSs.push_back(Triple::Cygwin); } - virtual void SetUp(); - + virtual void SetUp() { + didCallAllocateCodeSection = false; + Module = 0; + Function = 0; + Engine = 0; + Error = 0; + } + virtual void TearDown() { if (Engine) LLVMDisposeExecutionEngine(Engine); @@ -151,14 +157,6 @@ protected: char *Error; }; -void MCJITCAPITest::SetUp() { - didCallAllocateCodeSection = false; - Module = 0; - Function = 0; - Engine = 0; - Error = 0; -} - TEST_F(MCJITCAPITest, simple_function) { SKIP_UNSUPPORTED_PLATFORM; diff --git a/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp b/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp index b01a85495bb..4d650e8dbaf 100644 --- a/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp +++ b/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp @@ -18,13 +18,7 @@ using namespace llvm; -class MCJITMultipleModuleTest : public testing::Test, - public MCJITTestBase { -public: - virtual ~MCJITMultipleModuleTest(); -}; - -MCJITMultipleModuleTest::~MCJITMultipleModuleTest() {} +class MCJITMultipleModuleTest : public testing::Test, public MCJITTestBase {}; namespace { diff --git a/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp b/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp index 3a86eb5f070..7ccd2546c06 100644 --- a/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp +++ b/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp @@ -21,13 +21,11 @@ using namespace llvm; class MCJITTest : public testing::Test, public MCJITTestBase { protected: - virtual void SetUp(); + virtual void SetUp() { + M.reset(createEmptyModule("
")); + } }; -void MCJITTest::SetUp() { - M.reset(createEmptyModule("
")); -} - namespace { // FIXME: Ensure creating an execution engine does not crash when constructed diff --git a/utils/TableGen/CodeGenSchedule.cpp b/utils/TableGen/CodeGenSchedule.cpp index a857a204170..001e97d1e11 100644 --- a/utils/TableGen/CodeGenSchedule.cpp +++ b/utils/TableGen/CodeGenSchedule.cpp @@ -38,15 +38,12 @@ static void dumpIdxVec(const SmallVectorImpl &V) { // (instrs a, b, ...) Evaluate and union all arguments. Identical to AddOp. struct InstrsOp : public SetTheory::Operator { - virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, - ArrayRef Loc); + void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, + ArrayRef Loc) { + ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts, Loc); + } }; -void InstrsOp::apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, - ArrayRef Loc) { - ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts, Loc); -} - // (instregex "OpcPat",...) Find all instructions matching an opcode pattern. // // TODO: Since this is a prefix match, perform a binary search over the @@ -59,37 +56,34 @@ struct InstRegexOp : public SetTheory::Operator { const CodeGenTarget &Target; InstRegexOp(const CodeGenTarget &t): Target(t) {} - virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, - ArrayRef Loc); -}; - -void InstRegexOp::apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, - ArrayRef Loc) { - SmallVector RegexList; - for (DagInit::const_arg_iterator - AI = Expr->arg_begin(), AE = Expr->arg_end(); AI != AE; ++AI) { - StringInit *SI = dyn_cast(*AI); - if (!SI) - PrintFatalError(Loc, "instregex requires pattern string: " - + Expr->getAsString()); - std::string pat = SI->getValue(); - // Implement a python-style prefix match. - if (pat[0] != '^') { - pat.insert(0, "^("); - pat.insert(pat.end(), ')'); - } - RegexList.push_back(new Regex(pat)); - } - for (CodeGenTarget::inst_iterator I = Target.inst_begin(), - E = Target.inst_end(); I != E; ++I) { - for (SmallVectorImpl::iterator - RI = RegexList.begin(), RE = RegexList.end(); RI != RE; ++RI) { - if ((*RI)->match((*I)->TheDef->getName())) - Elts.insert((*I)->TheDef); + void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, + ArrayRef Loc) { + SmallVector RegexList; + for (DagInit::const_arg_iterator + AI = Expr->arg_begin(), AE = Expr->arg_end(); AI != AE; ++AI) { + StringInit *SI = dyn_cast(*AI); + if (!SI) + PrintFatalError(Loc, "instregex requires pattern string: " + + Expr->getAsString()); + std::string pat = SI->getValue(); + // Implement a python-style prefix match. + if (pat[0] != '^') { + pat.insert(0, "^("); + pat.insert(pat.end(), ')'); + } + RegexList.push_back(new Regex(pat)); + } + for (CodeGenTarget::inst_iterator I = Target.inst_begin(), + E = Target.inst_end(); I != E; ++I) { + for (SmallVectorImpl::iterator + RI = RegexList.begin(), RE = RegexList.end(); RI != RE; ++RI) { + if ((*RI)->match((*I)->TheDef->getName())) + Elts.insert((*I)->TheDef); + } } + DeleteContainerPointers(RegexList); } - DeleteContainerPointers(RegexList); -} +}; /// CodeGenModels ctor interprets machine model records and populates maps. CodeGenSchedModels::CodeGenSchedModels(RecordKeeper &RK, diff --git a/utils/TableGen/InstrInfoEmitter.cpp b/utils/TableGen/InstrInfoEmitter.cpp index d3d9cc1fd62..51ce2a74c53 100644 --- a/utils/TableGen/InstrInfoEmitter.cpp +++ b/utils/TableGen/InstrInfoEmitter.cpp @@ -437,14 +437,13 @@ void InstrInfoEmitter::run(raw_ostream &OS) { OS << "namespace llvm {\n"; OS << "struct " << ClassName << " : public TargetInstrInfo {\n" << " explicit " << ClassName << "(int SO = -1, int DO = -1);\n" - << " virtual ~" << ClassName << "();\n" << "};\n"; OS << "} // End llvm namespace \n"; OS << "#endif // GET_INSTRINFO_HEADER\n\n"; - OS << "\n#ifdef GET_INSTRINFO_CTOR_DTOR\n"; - OS << "#undef GET_INSTRINFO_CTOR_DTOR\n"; + OS << "\n#ifdef GET_INSTRINFO_CTOR\n"; + OS << "#undef GET_INSTRINFO_CTOR\n"; OS << "namespace llvm {\n"; OS << "extern const MCInstrDesc " << TargetName << "Insts[];\n"; @@ -454,11 +453,10 @@ void InstrInfoEmitter::run(raw_ostream &OS) { << " : TargetInstrInfo(SO, DO) {\n" << " InitMCInstrInfo(" << TargetName << "Insts, " << TargetName << "InstrNameIndices, " << TargetName << "InstrNameData, " - << NumberedInstructions.size() << ");\n}\n" - << ClassName << "::~" << ClassName << "() {}\n"; + << NumberedInstructions.size() << ");\n}\n"; OS << "} // End llvm namespace \n"; - OS << "#endif // GET_INSTRINFO_CTOR_DTOR\n\n"; + OS << "#endif // GET_INSTRINFO_CTOR\n\n"; emitOperandNameMappings(OS, Target, NumberedInstructions); diff --git a/utils/TableGen/SetTheory.cpp b/utils/TableGen/SetTheory.cpp index 0df8c32d911..3e5c38cf0a5 100644 --- a/utils/TableGen/SetTheory.cpp +++ b/utils/TableGen/SetTheory.cpp @@ -27,16 +27,14 @@ typedef SetTheory::RecVec RecVec; // (add a, b, ...) Evaluate and union all arguments. struct AddOp : public SetTheory::Operator { - virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, - ArrayRef Loc) { + void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef Loc) { ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts, Loc); } }; // (sub Add, Sub, ...) Set difference. struct SubOp : public SetTheory::Operator { - virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, - ArrayRef Loc) { + void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef Loc) { if (Expr->arg_size() < 2) PrintFatalError(Loc, "Set difference needs at least two arguments: " + Expr->getAsString()); @@ -51,8 +49,7 @@ struct SubOp : public SetTheory::Operator { // (and S1, S2) Set intersection. struct AndOp : public SetTheory::Operator { - virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, - ArrayRef Loc) { + void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef Loc) { if (Expr->arg_size() != 2) PrintFatalError(Loc, "Set intersection requires two arguments: " + Expr->getAsString()); @@ -71,8 +68,7 @@ struct SetIntBinOp : public SetTheory::Operator { RecSet &Set, int64_t N, RecSet &Elts, ArrayRef Loc) =0; - virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, - ArrayRef Loc) { + void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef Loc) { if (Expr->arg_size() != 2) PrintFatalError(Loc, "Operator requires (Op Set, Int) arguments: " + Expr->getAsString()); @@ -88,9 +84,9 @@ struct SetIntBinOp : public SetTheory::Operator { // (shl S, N) Shift left, remove the first N elements. struct ShlOp : public SetIntBinOp { - virtual void apply2(SetTheory &ST, DagInit *Expr, - RecSet &Set, int64_t N, - RecSet &Elts, ArrayRef Loc) { + void apply2(SetTheory &ST, DagInit *Expr, + RecSet &Set, int64_t N, + RecSet &Elts, ArrayRef Loc) { if (N < 0) PrintFatalError(Loc, "Positive shift required: " + Expr->getAsString()); @@ -101,9 +97,9 @@ struct ShlOp : public SetIntBinOp { // (trunc S, N) Truncate after the first N elements. struct TruncOp : public SetIntBinOp { - virtual void apply2(SetTheory &ST, DagInit *Expr, - RecSet &Set, int64_t N, - RecSet &Elts, ArrayRef Loc) { + void apply2(SetTheory &ST, DagInit *Expr, + RecSet &Set, int64_t N, + RecSet &Elts, ArrayRef Loc) { if (N < 0) PrintFatalError(Loc, "Positive length required: " + Expr->getAsString()); @@ -119,9 +115,9 @@ struct RotOp : public SetIntBinOp { RotOp(bool Rev) : Reverse(Rev) {} - virtual void apply2(SetTheory &ST, DagInit *Expr, - RecSet &Set, int64_t N, - RecSet &Elts, ArrayRef Loc) { + void apply2(SetTheory &ST, DagInit *Expr, + RecSet &Set, int64_t N, + RecSet &Elts, ArrayRef Loc) { if (Reverse) N = -N; // N > 0 -> rotate left, N < 0 -> rotate right. @@ -138,9 +134,9 @@ struct RotOp : public SetIntBinOp { // (decimate S, N) Pick every N'th element of S. struct DecimateOp : public SetIntBinOp { - virtual void apply2(SetTheory &ST, DagInit *Expr, - RecSet &Set, int64_t N, - RecSet &Elts, ArrayRef Loc) { + void apply2(SetTheory &ST, DagInit *Expr, + RecSet &Set, int64_t N, + RecSet &Elts, ArrayRef Loc) { if (N <= 0) PrintFatalError(Loc, "Positive stride required: " + Expr->getAsString()); @@ -151,8 +147,7 @@ struct DecimateOp : public SetIntBinOp { // (interleave S1, S2, ...) Interleave elements of the arguments. struct InterleaveOp : public SetTheory::Operator { - virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, - ArrayRef Loc) { + void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef Loc) { // Evaluate the arguments individually. SmallVector Args(Expr->getNumArgs()); unsigned MaxSize = 0; @@ -170,8 +165,7 @@ struct InterleaveOp : public SetTheory::Operator { // (sequence "Format", From, To) Generate a sequence of records by name. struct SequenceOp : public SetTheory::Operator { - virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, - ArrayRef Loc) { + void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef Loc) { int Step = 1; if (Expr->arg_size() > 4) PrintFatalError(Loc, "Bad args to (sequence \"Format\", From, To): " + @@ -238,16 +232,15 @@ struct FieldExpander : public SetTheory::Expander { FieldExpander(StringRef fn) : FieldName(fn) {} - virtual void expand(SetTheory &ST, Record *Def, RecSet &Elts) { + void expand(SetTheory &ST, Record *Def, RecSet &Elts) { ST.evaluate(Def->getValueInit(FieldName), Elts, Def->getLoc()); } }; } // end anonymous namespace -// pin vtables to this file -void SetTheory::Operator::anchor() {} -void SetTheory::Expander::anchor() {} +void SetTheory::Operator::anchor() { } +void SetTheory::Expander::anchor() { } SetTheory::SetTheory() { addOperator("add", new AddOp); diff --git a/utils/TableGen/TGValueTypes.cpp b/utils/TableGen/TGValueTypes.cpp index 81c0d4c544f..3ac71a49147 100644 --- a/utils/TableGen/TGValueTypes.cpp +++ b/utils/TableGen/TGValueTypes.cpp @@ -35,11 +35,9 @@ public: } Type(TypeKind K) : Kind(K) {} virtual unsigned getSizeInBits() const = 0; - virtual ~Type(); + virtual ~Type() {} }; -Type::~Type() {} - } class ExtendedIntegerType : public Type { @@ -47,11 +45,10 @@ class ExtendedIntegerType : public Type { public: explicit ExtendedIntegerType(unsigned bits) : Type(TK_ExtendedIntegerType), BitWidth(bits) {} - virtual ~ExtendedIntegerType(); static bool classof(const Type *T) { return T->getKind() == TK_ExtendedIntegerType; } - virtual unsigned getSizeInBits() const { + unsigned getSizeInBits() const { return getBitWidth(); } unsigned getBitWidth() const { @@ -59,20 +56,16 @@ public: } }; -ExtendedIntegerType::~ExtendedIntegerType() {} - - class ExtendedVectorType : public Type { EVT ElementType; unsigned NumElements; public: ExtendedVectorType(EVT elty, unsigned num) : Type(TK_ExtendedVectorType), ElementType(elty), NumElements(num) {} - virtual ~ExtendedVectorType(); static bool classof(const Type *T) { return T->getKind() == TK_ExtendedVectorType; } - virtual unsigned getSizeInBits() const { + unsigned getSizeInBits() const { return getNumElements() * getElementType().getSizeInBits(); } EVT getElementType() const { @@ -83,9 +76,6 @@ public: } }; -ExtendedVectorType::~ExtendedVectorType() {} - - static std::map ExtendedIntegerTypeMap; static std::map, const Type *> diff --git a/utils/unittest/googletest/include/gtest/gtest-test-part.h b/utils/unittest/googletest/include/gtest/gtest-test-part.h index 98e8b844915..8aeea14984e 100644 --- a/utils/unittest/googletest/include/gtest/gtest-test-part.h +++ b/utils/unittest/googletest/include/gtest/gtest-test-part.h @@ -142,7 +142,7 @@ class GTEST_API_ TestPartResultArray { // This interface knows how to report a test part result. class TestPartResultReporterInterface { public: - virtual ~TestPartResultReporterInterface(); + virtual ~TestPartResultReporterInterface() {} virtual void ReportTestPartResult(const TestPartResult& result) = 0; }; diff --git a/utils/unittest/googletest/include/gtest/gtest.h b/utils/unittest/googletest/include/gtest/gtest.h index 07ed92b57c0..1734c4432e1 100644 --- a/utils/unittest/googletest/include/gtest/gtest.h +++ b/utils/unittest/googletest/include/gtest/gtest.h @@ -910,7 +910,7 @@ class GTEST_API_ TestCase { class Environment { public: // The d'tor is virtual as we need to subclass Environment. - virtual ~Environment(); + virtual ~Environment() {} // Override this to define how to set up the environment. virtual void SetUp() {} @@ -928,7 +928,7 @@ class Environment { // the order the corresponding events are fired. class TestEventListener { public: - virtual ~TestEventListener(); + virtual ~TestEventListener() {} // Fired before any test activity starts. virtual void OnTestProgramStart(const UnitTest& unit_test) = 0; @@ -980,7 +980,6 @@ class TestEventListener { // comments about each method please see the definition of TestEventListener // above. class EmptyTestEventListener : public TestEventListener { - virtual void anchor(); public: virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {} virtual void OnTestIterationStart(const UnitTest& /*unit_test*/, diff --git a/utils/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h b/utils/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h index 8d53c452807..7bac2bd872b 100644 --- a/utils/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h +++ b/utils/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h @@ -79,7 +79,7 @@ class GTEST_API_ DeathTest { static bool Create(const char* statement, const RE* regex, const char* file, int line, DeathTest** test); DeathTest(); - virtual ~DeathTest(); + virtual ~DeathTest() { } // A helper class that aborts a death test when it's deleted. class ReturnSentinel { @@ -139,7 +139,7 @@ class GTEST_API_ DeathTest { // Factory interface for death tests. May be mocked out for testing. class DeathTestFactory { public: - virtual ~DeathTestFactory(); + virtual ~DeathTestFactory() { } virtual bool Create(const char* statement, const RE* regex, const char* file, int line, DeathTest** test) = 0; }; diff --git a/utils/unittest/googletest/include/gtest/internal/gtest-internal.h b/utils/unittest/googletest/include/gtest/internal/gtest-internal.h index 63f72acdfb5..a94bf28421f 100644 --- a/utils/unittest/googletest/include/gtest/internal/gtest-internal.h +++ b/utils/unittest/googletest/include/gtest/internal/gtest-internal.h @@ -105,7 +105,6 @@ #if !GTEST_NO_LLVM_RAW_OSTREAM namespace llvm { class convertible_fwd_ostream : public std::ostream { - virtual void anchor(); raw_os_ostream ros_; public: @@ -537,7 +536,7 @@ GTEST_API_ TypeId GetTestTypeId(); // of a Test object. class TestFactoryBase { public: - virtual ~TestFactoryBase(); + virtual ~TestFactoryBase() {} // Creates a test instance to run. The instance is both created and destroyed // within TestInfoImpl::Run() diff --git a/utils/unittest/googletest/include/gtest/internal/gtest-param-util.h b/utils/unittest/googletest/include/gtest/internal/gtest-param-util.h index 3bb2ffb3556..0ef9718cf43 100644 --- a/utils/unittest/googletest/include/gtest/internal/gtest-param-util.h +++ b/utils/unittest/googletest/include/gtest/internal/gtest-param-util.h @@ -414,7 +414,7 @@ class TestMetaFactory // and calls RegisterTests() on each of them when asked. class ParameterizedTestCaseInfoBase { public: - virtual ~ParameterizedTestCaseInfoBase(); + virtual ~ParameterizedTestCaseInfoBase() {} // Base part of test case name for display purposes. virtual const string& GetTestCaseName() const = 0; diff --git a/utils/unittest/googletest/include/gtest/internal/gtest-port.h b/utils/unittest/googletest/include/gtest/internal/gtest-port.h index 32fd9c65bfe..58f6cafa75f 100644 --- a/utils/unittest/googletest/include/gtest/internal/gtest-port.h +++ b/utils/unittest/googletest/include/gtest/internal/gtest-port.h @@ -1116,7 +1116,7 @@ class Notification { // problem. class ThreadWithParamBase { public: - virtual ~ThreadWithParamBase(); + virtual ~ThreadWithParamBase() {} virtual void Run() = 0; }; @@ -1290,7 +1290,7 @@ typedef GTestMutexLock MutexLock; // ThreadLocalValueHolderBase. class ThreadLocalValueHolderBase { public: - virtual ~ThreadLocalValueHolderBase(); + virtual ~ThreadLocalValueHolderBase() {} }; // Called by pthread to delete thread-local data stored by diff --git a/utils/unittest/googletest/src/gtest-death-test.cc b/utils/unittest/googletest/src/gtest-death-test.cc index b9693d3a051..6c8b001ee23 100644 --- a/utils/unittest/googletest/src/gtest-death-test.cc +++ b/utils/unittest/googletest/src/gtest-death-test.cc @@ -300,8 +300,6 @@ DeathTest::DeathTest() { } } -DeathTest::~DeathTest() {} - // Creates and returns a death test by dispatching to the current // death test factory. bool DeathTest::Create(const char* statement, const RE* regex, diff --git a/utils/unittest/googletest/src/gtest-internal-inl.h b/utils/unittest/googletest/src/gtest-internal-inl.h index 1bae630127b..6554cfc07e6 100644 --- a/utils/unittest/googletest/src/gtest-internal-inl.h +++ b/utils/unittest/googletest/src/gtest-internal-inl.h @@ -408,7 +408,7 @@ GTEST_API_ FilePath GetCurrentExecutableName(); class OsStackTraceGetterInterface { public: OsStackTraceGetterInterface() {} - virtual ~OsStackTraceGetterInterface(); + virtual ~OsStackTraceGetterInterface() {} // Returns the current OS stack trace as a String. Parameters: // diff --git a/utils/unittest/googletest/src/gtest-port.cc b/utils/unittest/googletest/src/gtest-port.cc index 0719b0c3474..745956247a6 100644 --- a/utils/unittest/googletest/src/gtest-port.cc +++ b/utils/unittest/googletest/src/gtest-port.cc @@ -746,17 +746,5 @@ const char* StringFromGTestEnv(const char* flag, const char* default_value) { return value == NULL ? default_value : value; } -#if GTEST_HAS_PTHREAD -ThreadWithParamBase::~ThreadWithParamBase() {} -ThreadLocalValueHolderBase::~ThreadLocalValueHolderBase() {} -#endif -TestFactoryBase::~TestFactoryBase() {} - } // namespace internal } // namespace testing - -#if !GTEST_NO_LLVM_RAW_OSTREAM -namespace llvm { -void convertible_fwd_ostream::anchor() {} -} -#endif diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc index ca814d1abb1..9891928048a 100644 --- a/utils/unittest/googletest/src/gtest.cc +++ b/utils/unittest/googletest/src/gtest.cc @@ -4863,13 +4863,4 @@ void InitGoogleTest(int* argc, wchar_t** argv) { internal::InitGoogleTestImpl(argc, argv); } -Environment::~Environment() {} -TestPartResultReporterInterface::~TestPartResultReporterInterface() {} -TestEventListener::~TestEventListener() {} -void EmptyTestEventListener::anchor() {} -namespace internal { -OsStackTraceGetterInterface::~OsStackTraceGetterInterface() {} -ParameterizedTestCaseInfoBase::~ParameterizedTestCaseInfoBase() {} -} - } // namespace testing -- 2.34.1