[weak vtables] Remove a bunch of weak vtables
authorJuergen Ributzka <juergen@apple.com>
Fri, 15 Nov 2013 22:34:48 +0000 (22:34 +0000)
committerJuergen Ributzka <juergen@apple.com>
Fri, 15 Nov 2013 22:34:48 +0000 (22:34 +0000)
This patch removes most of the trivial cases of weak vtables by pinning them to
a single object file.

Differential Revision: http://llvm-reviews.chandlerc.com/D2068

Reviewed by Andy

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194865 91177308-0d34-0410-b5e6-96231b3b80d8

115 files changed:
examples/ExceptionDemo/ExceptionDemo.cpp
examples/Kaleidoscope/Chapter2/toy.cpp
examples/Kaleidoscope/Chapter3/toy.cpp
examples/Kaleidoscope/Chapter4/toy.cpp
examples/Kaleidoscope/Chapter5/toy.cpp
examples/Kaleidoscope/Chapter6/toy.cpp
examples/Kaleidoscope/Chapter7/toy.cpp
include/llvm/CodeGen/MachineRegisterInfo.h
include/llvm/CodeGen/MachineScheduler.h
include/llvm/ExecutionEngine/ObjectBuffer.h
include/llvm/ExecutionEngine/ObjectCache.h
include/llvm/ExecutionEngine/ObjectImage.h
include/llvm/MC/MCAtom.h
include/llvm/MC/MCStreamer.h
include/llvm/MC/MCWinCOFFObjectWriter.h
include/llvm/Support/CommandLine.h
include/llvm/Support/ValueHandle.h
include/llvm/Support/YAMLParser.h
include/llvm/Support/YAMLTraits.h
lib/CodeGen/MachineRegisterInfo.cpp
lib/CodeGen/MachineScheduler.cpp
lib/CodeGen/RegAllocBase.cpp
lib/CodeGen/RegAllocBase.h
lib/ExecutionEngine/ExecutionEngine.cpp
lib/ExecutionEngine/RuntimeDyld/JITRegistrar.h
lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h
lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
lib/IR/AttributeImpl.h
lib/IR/Attributes.cpp
lib/IR/Metadata.cpp
lib/IR/Value.cpp
lib/MC/MCAtom.cpp
lib/MC/MCStreamer.cpp
lib/MC/WinCOFFObjectWriter.cpp
lib/Support/CommandLine.cpp
lib/Support/ErrorHandling.cpp
lib/Support/YAMLParser.cpp
lib/Support/YAMLTraits.cpp
lib/Target/AArch64/AArch64InstrInfo.cpp
lib/Target/AArch64/AArch64Subtarget.cpp
lib/Target/AArch64/AArch64Subtarget.h
lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp
lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.h
lib/Target/ARM/ARMBaseInstrInfo.cpp
lib/Target/Hexagon/CMakeLists.txt
lib/Target/Hexagon/HexagonInstrInfo.cpp
lib/Target/Hexagon/HexagonInstrInfo.h
lib/Target/Hexagon/HexagonMachineFunctionInfo.cpp [new file with mode: 0644]
lib/Target/Hexagon/HexagonMachineFunctionInfo.h
lib/Target/Hexagon/HexagonSubtarget.cpp
lib/Target/Hexagon/HexagonSubtarget.h
lib/Target/Hexagon/MCTargetDesc/HexagonMCAsmInfo.cpp
lib/Target/Hexagon/MCTargetDesc/HexagonMCAsmInfo.h
lib/Target/MSP430/MSP430InstrInfo.cpp
lib/Target/MSP430/MSP430InstrInfo.h
lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp
lib/Target/Mips/MipsInstrInfo.cpp
lib/Target/Mips/MipsInstrInfo.h
lib/Target/Mips/MipsTargetStreamer.h
lib/Target/NVPTX/NVPTXISelLowering.cpp
lib/Target/NVPTX/NVPTXInstrInfo.cpp
lib/Target/NVPTX/NVPTXInstrInfo.h
lib/Target/NVPTX/NVPTXSection.h
lib/Target/NVPTX/NVPTXSubtarget.cpp
lib/Target/NVPTX/NVPTXSubtarget.h
lib/Target/NVPTX/NVPTXTargetObjectFile.h
lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
lib/Target/PowerPC/PPCInstrInfo.cpp
lib/Target/PowerPC/PPCInstrInfo.h
lib/Target/PowerPC/PPCTargetStreamer.h
lib/Target/R600/AMDGPUInstrInfo.cpp
lib/Target/R600/AMDGPUInstrInfo.h
lib/Target/R600/AMDGPUMachineFunction.cpp
lib/Target/R600/AMDGPUMachineFunction.h
lib/Target/R600/MCTargetDesc/AMDGPUMCCodeEmitter.cpp [new file with mode: 0644]
lib/Target/R600/MCTargetDesc/AMDGPUMCCodeEmitter.h
lib/Target/R600/MCTargetDesc/CMakeLists.txt
lib/Target/R600/R600InstrInfo.cpp
lib/Target/R600/R600MachineFunctionInfo.cpp
lib/Target/R600/R600MachineFunctionInfo.h
lib/Target/R600/SIMachineFunctionInfo.cpp
lib/Target/R600/SIMachineFunctionInfo.h
lib/Target/Sparc/SparcInstrInfo.cpp
lib/Target/Sparc/SparcInstrInfo.h
lib/Target/SystemZ/CMakeLists.txt
lib/Target/SystemZ/SystemZInstrInfo.cpp
lib/Target/SystemZ/SystemZInstrInfo.h
lib/Target/SystemZ/SystemZMachineFunctionInfo.cpp [new file with mode: 0644]
lib/Target/SystemZ/SystemZMachineFunctionInfo.h
lib/Target/SystemZ/SystemZSubtarget.cpp
lib/Target/SystemZ/SystemZSubtarget.h
lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp
lib/Target/X86/X86InstrInfo.cpp
lib/Target/X86/X86InstrInfo.h
lib/Target/XCore/XCoreInstrInfo.cpp
lib/Target/XCore/XCoreInstrInfo.h
tools/llvm-stress/llvm-stress.cpp
unittests/ADT/IntrusiveRefCntPtrTest.cpp
unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp
unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp
unittests/ExecutionEngine/MCJIT/MCJITTest.cpp
utils/TableGen/CodeGenSchedule.cpp
utils/TableGen/InstrInfoEmitter.cpp
utils/TableGen/SetTheory.cpp
utils/TableGen/TGValueTypes.cpp
utils/unittest/googletest/include/gtest/gtest-test-part.h
utils/unittest/googletest/include/gtest/gtest.h
utils/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h
utils/unittest/googletest/include/gtest/internal/gtest-internal.h
utils/unittest/googletest/include/gtest/internal/gtest-param-util.h
utils/unittest/googletest/include/gtest/internal/gtest-port.h
utils/unittest/googletest/src/gtest-death-test.cc
utils/unittest/googletest/src/gtest-internal-inl.h
utils/unittest/googletest/src/gtest-port.cc
utils/unittest/googletest/src/gtest.cc

index 61b175091b7fb140f30d8313e56143eb6e46bf7d..c935206b81186a0d2b05954f30fcb9b20d672202 100644 (file)
@@ -1577,9 +1577,11 @@ public:
                                  std::runtime_error::operator=(toCopy)));
   }
 
                                  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
 
 /// Throws foreign C++ exception.
 /// @param ignoreIt unused parameter that allows function to match implied
index 2dc6711eed7d993dcc25ba6e5d352253d0e356b1..43eeb1c2cd2fcd66eb8bb397bf5da16e19e16bb9 100644 (file)
@@ -79,28 +79,39 @@ static int gettok() {
 /// ExprAST - Base class for all expression nodes.
 class ExprAST {
 public:
 /// 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) {}
 /// 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) {}
 /// 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) {}
 /// 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;
 /// CallExprAST - Expression class for function calls.
 class CallExprAST : public ExprAST {
   std::string Callee;
@@ -108,8 +119,11 @@ class CallExprAST : public ExprAST {
 public:
   CallExprAST(const std::string &callee, std::vector<ExprAST*> &args)
     : Callee(callee), Args(args) {}
 public:
   CallExprAST(const std::string &callee, std::vector<ExprAST*> &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).
 /// 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).
index 0fb64e3a54dc71554e034d63f320528e6e24399b..d25aa5d4d7fee577616800512f7c6ae8ad958b65 100644 (file)
@@ -84,10 +84,12 @@ static int gettok() {
 /// ExprAST - Base class for all expression nodes.
 class ExprAST {
 public:
 /// ExprAST - Base class for all expression nodes.
 class ExprAST {
 public:
-  virtual ~ExprAST() {}
+  virtual ~ExprAST();
   virtual Value *Codegen() = 0;
 };
 
   virtual Value *Codegen() = 0;
 };
 
+ExprAST::~ExprAST() {}
+
 /// NumberExprAST - Expression class for numeric literals like "1.0".
 class NumberExprAST : public ExprAST {
   double Val;
 /// NumberExprAST - Expression class for numeric literals like "1.0".
 class NumberExprAST : public ExprAST {
   double Val;
index 0e41cc14ead882815d6184a50ed9b8f0548f08ce..a52b5552a291d185c81a918ae3d23de36b508305 100644 (file)
@@ -91,10 +91,12 @@ static int gettok() {
 /// ExprAST - Base class for all expression nodes.
 class ExprAST {
 public:
 /// ExprAST - Base class for all expression nodes.
 class ExprAST {
 public:
-  virtual ~ExprAST() {}
+  virtual ~ExprAST();
   virtual Value *Codegen() = 0;
 };
 
   virtual Value *Codegen() = 0;
 };
 
+ExprAST::~ExprAST() {}
+
 /// NumberExprAST - Expression class for numeric literals like "1.0".
 class NumberExprAST : public ExprAST {
   double Val;
 /// NumberExprAST - Expression class for numeric literals like "1.0".
 class NumberExprAST : public ExprAST {
   double Val;
index d5a88a5a6938ed26f1a6460bbcd45b69899f49eb..2770a380b7e77e0cc68eea2367727a254364d401 100644 (file)
@@ -100,10 +100,12 @@ static int gettok() {
 /// ExprAST - Base class for all expression nodes.
 class ExprAST {
 public:
 /// ExprAST - Base class for all expression nodes.
 class ExprAST {
 public:
-  virtual ~ExprAST() {}
+  virtual ~ExprAST();
   virtual Value *Codegen() = 0;
 };
 
   virtual Value *Codegen() = 0;
 };
 
+ExprAST::~ExprAST() {}
+
 /// NumberExprAST - Expression class for numeric literals like "1.0".
 class NumberExprAST : public ExprAST {
   double Val;
 /// NumberExprAST - Expression class for numeric literals like "1.0".
 class NumberExprAST : public ExprAST {
   double Val;
index 4d6a128cba242908680bd87987f88a4f4f37c203..2a0f212ef414ebee1f1ac8f34d4172b6fb3bc23d 100644 (file)
@@ -105,10 +105,12 @@ static int gettok() {
 /// ExprAST - Base class for all expression nodes.
 class ExprAST {
 public:
 /// ExprAST - Base class for all expression nodes.
 class ExprAST {
 public:
-  virtual ~ExprAST() {}
+  virtual ~ExprAST();
   virtual Value *Codegen() = 0;
 };
 
   virtual Value *Codegen() = 0;
 };
 
+ExprAST::~ExprAST() {}
+
 /// NumberExprAST - Expression class for numeric literals like "1.0".
 class NumberExprAST : public ExprAST {
   double Val;
 /// NumberExprAST - Expression class for numeric literals like "1.0".
 class NumberExprAST : public ExprAST {
   double Val;
index beb0c0099cc653f07bbe102f75acbffdc41b8b10..00628010d6076e7230316efe281597388fcdb812 100644 (file)
@@ -109,10 +109,12 @@ static int gettok() {
 /// ExprAST - Base class for all expression nodes.
 class ExprAST {
 public:
 /// ExprAST - Base class for all expression nodes.
 class ExprAST {
 public:
-  virtual ~ExprAST() {}
+  virtual ~ExprAST();
   virtual Value *Codegen() = 0;
 };
 
   virtual Value *Codegen() = 0;
 };
 
+ExprAST::~ExprAST() {}
+
 /// NumberExprAST - Expression class for numeric literals like "1.0".
 class NumberExprAST : public ExprAST {
   double Val;
 /// NumberExprAST - Expression class for numeric literals like "1.0".
 class NumberExprAST : public ExprAST {
   double Val;
index 736a0a2b7572bf2bf19476775f71aabfc636fc40..58ca907316acc3dcc1bc1f2301af85c9fe5e7679 100644 (file)
@@ -30,8 +30,9 @@ class PSetIterator;
 class MachineRegisterInfo {
 public:
   class Delegate {
 class MachineRegisterInfo {
 public:
   class Delegate {
+    virtual void anchor();
   public:
   public:
-    virtual void MRI_NoteNewVirtualRegister(unsigned Reg) {}
+    virtual void MRI_NoteNewVirtualRegister(unsigned Reg) = 0;
 
     virtual ~Delegate() {}
   };
 
     virtual ~Delegate() {}
   };
index e6af370855e8d4279414aaa0884e8f56999bd0f1..77828953347c6315d7bf911e936a8005b537b40e 100644 (file)
@@ -164,6 +164,7 @@ struct MachineSchedPolicy {
 /// Initialization sequence:
 ///   initPolicy -> shouldTrackPressure -> initialize(DAG) -> registerRoots
 class MachineSchedStrategy {
 /// Initialization sequence:
 ///   initPolicy -> shouldTrackPressure -> initialize(DAG) -> registerRoots
 class MachineSchedStrategy {
+  virtual void anchor();
 public:
   virtual ~MachineSchedStrategy() {}
 
 public:
   virtual ~MachineSchedStrategy() {}
 
@@ -262,6 +263,7 @@ public:
 
 /// Mutate the DAG as a postpass after normal DAG building.
 class ScheduleDAGMutation {
 
 /// Mutate the DAG as a postpass after normal DAG building.
 class ScheduleDAGMutation {
+  virtual void anchor();
 public:
   virtual ~ScheduleDAGMutation() {}
 
 public:
   virtual ~ScheduleDAGMutation() {}
 
index 32de40464a5fd591f10a25b0ecc09cdc0d0d5ed2..51051c9d188fb9818b60af347aec86842a961016 100644 (file)
@@ -33,7 +33,6 @@ class ObjectBuffer {
 public:
   ObjectBuffer() {}
   ObjectBuffer(MemoryBuffer* Buf) : Buffer(Buf) {}
 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,
 
   /// getMemBuffer - Like MemoryBuffer::getMemBuffer() this function
   /// returns a pointer to an object that is owned by the caller. However,
@@ -58,7 +57,6 @@ protected:
 class ObjectBufferStream : public ObjectBuffer {
 public:
   ObjectBufferStream() : OS(SV) {}
 class ObjectBufferStream : public ObjectBuffer {
 public:
   ObjectBufferStream() : OS(SV) {}
-  virtual ~ObjectBufferStream() {}
 
   raw_ostream &getOStream() { return OS; }
   void flush()
 
   raw_ostream &getOStream() { return OS; }
   void flush()
index 6f55e4391e61910a7ce5ccbe6d42bf5384708659..d1849dfc3bf652d38c7f50d7794b95059851df40 100644 (file)
@@ -20,6 +20,7 @@ class Module;
 /// ExecutionEngine for the purpose of avoiding compilation for Modules that
 /// have already been compiled and an object file is available.
 class ObjectCache {
 /// 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() { }
 
 public:
   ObjectCache() { }
 
index 9fddca7e33c8568ae53eae1f2e954f185f42c311..076f4b1146c10b317d77bf0c19211904060774cb 100644 (file)
@@ -25,6 +25,7 @@ namespace llvm {
 class ObjectImage {
   ObjectImage() LLVM_DELETED_FUNCTION;
   ObjectImage(const ObjectImage &other) LLVM_DELETED_FUNCTION;
 class ObjectImage {
   ObjectImage() LLVM_DELETED_FUNCTION;
   ObjectImage(const ObjectImage &other) LLVM_DELETED_FUNCTION;
+  virtual void anchor();
 
 protected:
   OwningPtr<ObjectBuffer> Buffer;
 
 protected:
   OwningPtr<ObjectBuffer> Buffer;
index 4758588ac37e40a9da22f60e6ca5c0b88ce2715c..eab32d691fa84d96dc1726467139b6010a7713dd 100644 (file)
@@ -32,6 +32,7 @@ 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 {
 /// \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() {}
 
 public:
   virtual ~MCAtom() {}
 
index 04af407a445e3535f2bd0f36b7d99a1906b1465e..0b1fe6ec01291ac8047895d5054cf8c80eb1c148 100644 (file)
@@ -76,6 +76,7 @@ public:
 // FIXME: declared here because it is used from
 // lib/CodeGen/AsmPrinter/ARMException.cpp.
 class ARMTargetStreamer : public MCTargetStreamer {
 // 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;
 public:
   virtual void emitFnStart() = 0;
   virtual void emitFnEnd() = 0;
index f13e7d5480267bc1a9c1208244f17a1dd695fda7..e79e4bc83de1372793c53f68d6d001c00d36d6d4 100644 (file)
@@ -19,6 +19,8 @@ namespace llvm {
   class MCWinCOFFObjectTargetWriter {
     const unsigned Machine;
 
   class MCWinCOFFObjectTargetWriter {
     const unsigned Machine;
 
+    virtual void anchor();
+
   protected:
     MCWinCOFFObjectTargetWriter(unsigned Machine_);
 
   protected:
     MCWinCOFFObjectTargetWriter(unsigned Machine_);
 
index c0bfbae0370e7d31f393c0abd069739f7c02caea..4efb6a67cf62b4066ac0643217190cdc15e5f0a5 100644 (file)
@@ -350,6 +350,9 @@ struct cat {
 struct GenericOptionValue {
   virtual ~GenericOptionValue() {}
   virtual bool compare(const GenericOptionValue &V) const = 0;
 struct GenericOptionValue {
   virtual ~GenericOptionValue() {}
   virtual bool compare(const GenericOptionValue &V) const = 0;
+
+private:
+  virtual void anchor();
 };
 
 template<class DataType> struct OptionValue;
 };
 
 template<class DataType> struct OptionValue;
@@ -1752,6 +1755,7 @@ void getRegisteredOptions(StringMap<Option*> &Map);
 /// \brief Saves strings in the inheritor's stable storage and returns a stable
 /// raw character pointer.
 class StringSaver {
 /// \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.
 public:
   virtual const char *SaveString(const char *Str) = 0;
   virtual ~StringSaver() {};  // Pacify -Wnon-virtual-dtor.
index b49341c3ffb66baf1da52f59c71840f4b489f26b..bc02ba31b9b9aae9bacf91f4447d7f604bf73a8b 100644 (file)
@@ -339,6 +339,7 @@ public:
 /// rearrange itself when the pointer changes).  Unlike ValueHandleBase, this
 /// class has a vtable and a virtual destructor.
 class CallbackVH : public ValueHandleBase {
 /// 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) {}
 protected:
   CallbackVH(const CallbackVH &RHS)
     : ValueHandleBase(Callback, RHS) {}
@@ -365,13 +366,13 @@ public:
   ///
   /// All implementations must remove the reference from this object to the
   /// Value that's being destroyed.
   ///
   /// All implementations must remove the reference from this object to the
   /// Value that's being destroyed.
-  virtual void deleted();
+  virtual void deleted() { setValPtr(NULL); }
 
   /// 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.
 
   /// 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
 };
 
 } // End llvm namespace
index 0e780bab121db6d265d8fa1ee891a024c8c2e9c9..702044936c62680d8958bed6a57e2b805c3ec34a 100644 (file)
@@ -105,6 +105,7 @@ private:
 
 /// @brief Abstract base class for all Nodes.
 class Node {
 
 /// @brief Abstract base class for all Nodes.
 class Node {
+   virtual void anchor();
 public:
   enum NodeKind {
     NK_Null,
 public:
   enum NodeKind {
     NK_Null,
@@ -175,6 +176,7 @@ private:
 /// Example:
 ///   !!null null
 class NullNode : public Node {
 /// Example:
 ///   !!null null
 class NullNode : public Node {
+  virtual void anchor();
 public:
   NullNode(OwningPtr<Document> &D)
       : Node(NK_Null, D, StringRef(), StringRef()) {}
 public:
   NullNode(OwningPtr<Document> &D)
       : Node(NK_Null, D, StringRef(), StringRef()) {}
@@ -190,6 +192,7 @@ public:
 /// Example:
 ///   Adena
 class ScalarNode : public Node {
 /// Example:
 ///   Adena
 class ScalarNode : public Node {
+  virtual void anchor();
 public:
   ScalarNode(OwningPtr<Document> &D, StringRef Anchor, StringRef Tag,
              StringRef Val)
 public:
   ScalarNode(OwningPtr<Document> &D, StringRef Anchor, StringRef Tag,
              StringRef Val)
@@ -231,6 +234,7 @@ private:
 /// Example:
 ///   Section: .text
 class KeyValueNode : public Node {
 /// Example:
 ///   Section: .text
 class KeyValueNode : public Node {
+  virtual void anchor();
 public:
   KeyValueNode(OwningPtr<Document> &D)
     : Node(NK_KeyValue, D, StringRef(), StringRef())
 public:
   KeyValueNode(OwningPtr<Document> &D)
     : Node(NK_KeyValue, D, StringRef(), StringRef())
@@ -342,6 +346,7 @@ void skip(CollectionType &C) {
 ///   Name: _main
 ///   Scope: Global
 class MappingNode : public Node {
 ///   Name: _main
 ///   Scope: Global
 class MappingNode : public Node {
+  virtual void anchor();
 public:
   enum MappingType {
     MT_Block,
 public:
   enum MappingType {
     MT_Block,
@@ -391,6 +396,7 @@ private:
 ///   - Hello
 ///   - World
 class SequenceNode : public Node {
 ///   - Hello
 ///   - World
 class SequenceNode : public Node {
+  virtual void anchor();
 public:
   enum SequenceType {
     ST_Block,
 public:
   enum SequenceType {
     ST_Block,
@@ -446,6 +452,7 @@ private:
 /// Example:
 ///   *AnchorName
 class AliasNode : public Node {
 /// Example:
 ///   *AnchorName
 class AliasNode : public Node {
+  virtual void anchor();
 public:
   AliasNode(OwningPtr<Document> &D, StringRef Val)
     : Node(NK_Alias, D, StringRef(), StringRef()), Name(Val) {}
 public:
   AliasNode(OwningPtr<Document> &D, StringRef Val)
     : Node(NK_Alias, D, StringRef(), StringRef()), Name(Val) {}
index d6eeaace7bf7c478838cfdde9b842efef8c32dea..4c271e035fae887dd6db36fee092675b75f6071d 100644 (file)
@@ -723,6 +723,7 @@ private:
   virtual bool canElideEmptySequence();
 
   class HNode {
   virtual bool canElideEmptySequence();
 
   class HNode {
+    virtual void anchor();
   public:
     HNode(Node *n) : _node(n) { }
     virtual ~HNode() { }
   public:
     HNode(Node *n) : _node(n) { }
     virtual ~HNode() { }
@@ -732,9 +733,9 @@ private:
   };
 
   class EmptyHNode : public HNode {
   };
 
   class EmptyHNode : public HNode {
+    virtual void anchor();
   public:
     EmptyHNode(Node *n) : HNode(n) { }
   public:
     EmptyHNode(Node *n) : HNode(n) { }
-    virtual ~EmptyHNode() {}
     static inline bool classof(const HNode *n) {
       return NullNode::classof(n->_node);
     }
     static inline bool classof(const HNode *n) {
       return NullNode::classof(n->_node);
     }
@@ -742,9 +743,9 @@ private:
   };
 
   class ScalarHNode : public HNode {
   };
 
   class ScalarHNode : public HNode {
+    virtual void anchor();
   public:
     ScalarHNode(Node *n, StringRef s) : HNode(n), _value(s) { }
   public:
     ScalarHNode(Node *n, StringRef s) : HNode(n), _value(s) { }
-    virtual ~ScalarHNode() { }
 
     StringRef value() const { return _value; }
 
 
     StringRef value() const { return _value; }
 
@@ -757,6 +758,7 @@ private:
   };
 
   class MapHNode : public HNode {
   };
 
   class MapHNode : public HNode {
+    virtual void anchor();
   public:
     MapHNode(Node *n) : HNode(n) { }
     virtual ~MapHNode();
   public:
     MapHNode(Node *n) : HNode(n) { }
     virtual ~MapHNode();
@@ -775,6 +777,7 @@ private:
   };
 
   class SequenceHNode : public HNode {
   };
 
   class SequenceHNode : public HNode {
+    virtual void anchor();
   public:
     SequenceHNode(Node *n) : HNode(n) { }
     virtual ~SequenceHNode();
   public:
     SequenceHNode(Node *n) : HNode(n) { }
     virtual ~SequenceHNode();
index ce7d567cc2927d330e1a498fe91dbbf183642a34..7dad84db4542536f8156e7ec0914afd82179647f 100644 (file)
@@ -19,6 +19,9 @@
 
 using namespace llvm;
 
 
 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);
 MachineRegisterInfo::MachineRegisterInfo(const TargetMachine &TM)
   : TM(TM), TheDelegate(0), IsSSA(true), TracksLiveness(true) {
   VRegInfo.reserve(256);
index 3144dfe4d391bcf1690c113749562d2f4b86b013..df756ba6e3f9e7bf6e5ce4c2cc19ae8b98ab7a32 100644 (file)
@@ -72,6 +72,10 @@ static cl::opt<bool> VerifyScheduling("verify-misched", cl::Hidden,
 // DAG subtrees must have at least this many nodes.
 static const unsigned MinSubtreeSize = 8;
 
 // 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
 //===----------------------------------------------------------------------===//
 //===----------------------------------------------------------------------===//
 // Machine Instruction Scheduling Pass and Registry
 //===----------------------------------------------------------------------===//
index b94ce4d33f761db860fac256659c62e86487545f..3a4d5462a8a0a29ba0fd11c4d70db4152f386779 100644 (file)
@@ -50,6 +50,9 @@ bool RegAllocBase::VerifyEnabled = false;
 //                         RegAllocBase Implementation
 //===----------------------------------------------------------------------===//
 
 //                         RegAllocBase Implementation
 //===----------------------------------------------------------------------===//
 
+// pin vtable to this file
+void RegAllocBase::anchor() {}
+
 void RegAllocBase::init(VirtRegMap &vrm,
                         LiveIntervals &lis,
                         LiveRegMatrix &mat) {
 void RegAllocBase::init(VirtRegMap &vrm,
                         LiveIntervals &lis,
                         LiveRegMatrix &mat) {
index 9c0029837d02d814b2d2c59264cce61c7be7062e..c17a8d96ef6a303e1500eb7832c38ada8265a44c 100644 (file)
@@ -57,6 +57,7 @@ class Spiller;
 /// live range splitting. They must also override enqueue/dequeue to provide an
 /// assignment order.
 class RegAllocBase {
 /// 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;
 protected:
   const TargetRegisterInfo *TRI;
   MachineRegisterInfo *MRI;
index 73bd43ba51530a2c3f3207249659929438876de8..16128be782938598e4ace0a544cfaef99c878813 100644 (file)
@@ -15,6 +15,7 @@
 #define DEBUG_TYPE "jit"
 #include "llvm/ExecutionEngine/ExecutionEngine.h"
 #include "llvm/ExecutionEngine/JITMemoryManager.h"
 #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"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ExecutionEngine/GenericValue.h"
@@ -39,6 +40,9 @@ using namespace llvm;
 STATISTIC(NumInitBytes, "Number of bytes of global vars initialized");
 STATISTIC(NumGlobals  , "Number of global vars initialized");
 
 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,
 ExecutionEngine *(*ExecutionEngine::JITCtor)(
   Module *M,
   std::string *ErrorStr,
index 69e9dbe490d62302f2a489b5fff07af176618af5..6a514ea3ec3b1ba0b123461fbc774fcd7c2fe7f2 100644 (file)
@@ -16,6 +16,7 @@ namespace llvm {
 
 /// Global access point for the JIT debugging interface.
 class JITRegistrar {
 
 /// Global access point for the JIT debugging interface.
 class JITRegistrar {
+  virtual void anchor();
 public:
   /// Instantiates the JIT service.
   JITRegistrar() {}
 public:
   /// Instantiates the JIT service.
   JITRegistrar() {}
index 89350cc5b621611aef779cdd790ce2309d9e130e..9cbde5daede5ef487832a8ad9bcbefd9b2c50053 100644 (file)
@@ -23,6 +23,7 @@ namespace llvm {
 class ObjectImageCommon : public ObjectImage {
   ObjectImageCommon(); // = delete
   ObjectImageCommon(const ObjectImageCommon &other); // = delete
 class ObjectImageCommon : public ObjectImage {
   ObjectImageCommon(); // = delete
   ObjectImageCommon(const ObjectImageCommon &other); // = delete
+  virtual void anchor();
 
 protected:
   object::ObjectFile *ObjFile;
 
 protected:
   object::ObjectFile *ObjFile;
index 2c068be970e19fdfa6071d3f1f5f7578a0539a8b..9641a57756fc86e9e97a96bb812d7edeb2f5e508 100644 (file)
@@ -13,6 +13,7 @@
 
 #define DEBUG_TYPE "dyld"
 #include "llvm/ExecutionEngine/RuntimeDyld.h"
 
 #define DEBUG_TYPE "dyld"
 #include "llvm/ExecutionEngine/RuntimeDyld.h"
+#include "JITRegistrar.h"
 #include "ObjectImageCommon.h"
 #include "RuntimeDyldELF.h"
 #include "RuntimeDyldImpl.h"
 #include "ObjectImageCommon.h"
 #include "RuntimeDyldELF.h"
 #include "RuntimeDyldImpl.h"
@@ -28,6 +29,11 @@ using namespace llvm::object;
 // Empty out-of-line virtual destructor as the key function.
 RuntimeDyldImpl::~RuntimeDyldImpl() {}
 
 // 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() {
 namespace llvm {
 
 void RuntimeDyldImpl::registerEHFrames() {
index 9da3f9659e035ac397fb572b91e399a2a41ecb2d..2d2604449a2e85f8609a871ce05abcec9002e011 100644 (file)
@@ -46,8 +46,6 @@ protected:
   AttributeImpl(AttrEntryKind KindID) : KindID(KindID) {}
 
 public:
   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; }
   bool isEnumAttribute() const { return KindID == EnumAttrEntry; }
   bool isAlignAttribute() const { return KindID == AlignAttrEntry; }
   bool isStringAttribute() const { return KindID == StringAttrEntry; }
index bcd324c4ffa45f9731a3ebc0964b560fa8633e1f..f876778c45cd33d582046b0a0e90bd4e827b296c 100644 (file)
@@ -286,8 +286,6 @@ bool Attribute::operator<(Attribute A) const {
 // AttributeImpl Definition
 //===----------------------------------------------------------------------===//
 
 // AttributeImpl Definition
 //===----------------------------------------------------------------------===//
 
-AttributeImpl::~AttributeImpl() {}
-
 bool AttributeImpl::hasAttribute(Attribute::AttrKind A) const {
   if (isStringAttribute()) return false;
   return getKindAsEnum() == A;
 bool AttributeImpl::hasAttribute(Attribute::AttrKind A) const {
   if (isStringAttribute()) return false;
   return getKindAsEnum() == A;
index bd4d9c0a077453c3f809c662b67245b9dca7f9c3..ef0660da86401fd0b509402f7e0cc4781d6b29ad 100644 (file)
@@ -65,7 +65,7 @@ class MDNodeOperand : public CallbackVH {
 
 public:
   MDNodeOperand(Value *V) : CallbackVH(V) {}
 
 public:
   MDNodeOperand(Value *V) : CallbackVH(V) {}
-  ~MDNodeOperand() {}
+  virtual ~MDNodeOperand();
 
   void set(Value *V) {
     unsigned IsFirst = this->getValPtrInt();
 
   void set(Value *V) {
     unsigned IsFirst = this->getValPtrInt();
@@ -82,6 +82,8 @@ public:
 };
 } // end namespace llvm.
 
 };
 } // end namespace llvm.
 
+MDNodeOperand::~MDNodeOperand() {}
+
 
 void MDNodeOperand::deleted() {
   getParent()->replaceOperand(this, 0);
 
 void MDNodeOperand::deleted() {
   getParent()->replaceOperand(this, 0);
index 35808a658b411d45b0cbca1b6c290f0702173abe..a56272ffe68d5db1783db5318269e2b5ab47ecb5 100644 (file)
@@ -735,9 +735,5 @@ void ValueHandleBase::ValueIsRAUWd(Value *Old, Value *New) {
 #endif
 }
 
 #endif
 }
 
-// Default implementation for CallbackVH.
-void CallbackVH::allUsesReplacedWith(Value *) {}
-
-void CallbackVH::deleted() {
-  setValPtr(NULL);
-}
+// pin vtable to this file
+void CallbackVH::anchor() {}
index d0a64c300843f976e0bd0ac8a4f8486a9b64a947..3da1ba3ae7a30bdc1d0446a9ccc5d70c2e0219ca 100644 (file)
@@ -14,6 +14,9 @@
 
 using namespace llvm;
 
 
 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);
 }
 void MCAtom::remap(uint64_t NewBegin, uint64_t NewEnd) {
   Parent->remap(this, NewBegin, NewEnd);
 }
index 2be89e95e706fd29f0b03e4a6504ba31496e6636..0616a4daf12f93692422396d44190f8c470f664b 100644 (file)
@@ -22,7 +22,9 @@
 #include <cstdlib>
 using namespace llvm;
 
 #include <cstdlib>
 using namespace llvm;
 
+// pin vtables to this file
 MCTargetStreamer::~MCTargetStreamer() {}
 MCTargetStreamer::~MCTargetStreamer() {}
+void ARMTargetStreamer::anchor() {}
 
 MCStreamer::MCStreamer(MCContext &Ctx, MCTargetStreamer *TargetStreamer)
     : Context(Ctx), TargetStreamer(TargetStreamer), EmitEHFrame(true),
 
 MCStreamer::MCStreamer(MCContext &Ctx, MCTargetStreamer *TargetStreamer)
     : Context(Ctx), TargetStreamer(TargetStreamer), EmitEHFrame(true),
index 32523173ee6eb135380d1a20239de64b3f294880..270456ca8acae0feffbfdb5ce51b41a4208b1d57 100644 (file)
@@ -138,7 +138,7 @@ public:
   symbol_map  SymbolMap;
 
   WinCOFFObjectWriter(MCWinCOFFObjectTargetWriter *MOTW, raw_ostream &OS);
   symbol_map  SymbolMap;
 
   WinCOFFObjectWriter(MCWinCOFFObjectTargetWriter *MOTW, raw_ostream &OS);
-  ~WinCOFFObjectWriter();
+  virtual ~WinCOFFObjectWriter();
 
   COFFSymbol *createSymbol(StringRef Name);
   COFFSymbol *GetOrCreateCOFFSymbol(const MCSymbol * Symbol);
 
   COFFSymbol *createSymbol(StringRef Name);
   COFFSymbol *GetOrCreateCOFFSymbol(const MCSymbol * Symbol);
@@ -898,6 +898,9 @@ MCWinCOFFObjectTargetWriter::MCWinCOFFObjectTargetWriter(unsigned Machine_) :
   Machine(Machine_) {
 }
 
   Machine(Machine_) {
 }
 
+// pin vtable to this file
+void MCWinCOFFObjectTargetWriter::anchor() {}
+
 //------------------------------------------------------------------------------
 // WinCOFFObjectWriter factory function
 
 //------------------------------------------------------------------------------
 // WinCOFFObjectWriter factory function
 
index a47af2729f359f4b4aff07abd3ccd543d10441c2..c25b08e628bd6e966cb67da9bad50e2254a578c7 100644 (file)
@@ -60,6 +60,7 @@ TEMPLATE_INSTANTIATION(class opt<char>);
 TEMPLATE_INSTANTIATION(class opt<bool>);
 } } // end namespace llvm::cl
 
 TEMPLATE_INSTANTIATION(class opt<bool>);
 } } // end namespace llvm::cl
 
+void GenericOptionValue::anchor() {}
 void OptionValue<boolOrDefault>::anchor() {}
 void OptionValue<std::string>::anchor() {}
 void Option::anchor() {}
 void OptionValue<boolOrDefault>::anchor() {}
 void OptionValue<std::string>::anchor() {}
 void Option::anchor() {}
@@ -73,6 +74,7 @@ void parser<double>::anchor() {}
 void parser<float>::anchor() {}
 void parser<std::string>::anchor() {}
 void parser<char>::anchor() {}
 void parser<float>::anchor() {}
 void parser<std::string>::anchor() {}
 void parser<char>::anchor() {}
+void StringSaver::anchor() {}
 
 //===----------------------------------------------------------------------===//
 
 
 //===----------------------------------------------------------------------===//
 
index 1eafb96fde0949b319db038a1e1d5d99195e7f8c..b91be9d600a41e4ad0b473bddaacd9b9a519d539 100644 (file)
@@ -17,6 +17,7 @@
 #include "llvm/ADT/Twine.h"
 #include "llvm/Config/config.h"
 #include "llvm/Support/Debug.h"
 #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"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/Threading.h"
 #include "llvm/Support/raw_ostream.h"
@@ -119,3 +120,4 @@ void LLVMInstallFatalErrorHandler(LLVMFatalErrorHandler Handler) {
 void LLVMResetFatalErrorHandler() {
   remove_fatal_error_handler();
 }
 void LLVMResetFatalErrorHandler() {
   remove_fatal_error_handler();
 }
+
index 9e506128bc2b52cb596feb2129b07b83c2db9873..38303b4c01513ab8abd5d2aaf194d8ba570b5df6 100644 (file)
@@ -96,6 +96,15 @@ static EncodingInfo getUnicodeEncoding(StringRef Input) {
 
 namespace llvm {
 namespace yaml {
 
 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<Token> {
   enum TokenKind {
 /// Token - A single YAML token.
 struct Token : ilist_node<Token> {
   enum TokenKind {
index f103ed8bcbe073ae87d37ac824175b2eecb1beda..c20ce888ad3fcb364c5faf4f0110ac3310f83b6a 100644 (file)
@@ -59,6 +59,13 @@ void Input::setDiagHandler(SourceMgr::DiagHandlerTy Handler, void *Ctxt) {
   SrcMgr.setDiagHandler(Handler, 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;
 }
 bool Input::outputting() const {
   return false;
 }
index 14daab33ecfb0b95546adea136dfe628be58fc6a..706d0b05e06ca5ae1e9fef92a3b1ffc8c841e00f 100644 (file)
@@ -29,7 +29,7 @@
 
 #include <algorithm>
 
 
 #include <algorithm>
 
-#define GET_INSTRINFO_CTOR
+#define GET_INSTRINFO_CTOR_DTOR
 #include "AArch64GenInstrInfo.inc"
 
 using namespace llvm;
 #include "AArch64GenInstrInfo.inc"
 
 using namespace llvm;
index eece389302e7d921092ad2d2dcbe2ff14e7dd5aa..4da529434b1136c60b52c08cade2c31e06d8046c 100644 (file)
@@ -25,6 +25,9 @@
 
 using namespace llvm;
 
 
 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) {
 AArch64Subtarget::AArch64Subtarget(StringRef TT, StringRef CPU, StringRef FS)
     : AArch64GenSubtargetInfo(TT, CPU, FS), HasFPARMv8(false), HasNEON(false),
       HasCrypto(false), TargetTriple(TT), CPUString(CPU) {
index 57eb187c9d1f439ba3264de45b4083682200b02a..bbfd3bc7dfac9d095d724572ec92ea76246d6cd5 100644 (file)
@@ -27,6 +27,7 @@ class StringRef;
 class GlobalValue;
 
 class AArch64Subtarget : public AArch64GenSubtargetInfo {
 class GlobalValue;
 
 class AArch64Subtarget : public AArch64GenSubtargetInfo {
+  virtual void anchor();
 protected:
   bool HasFPARMv8;
   bool HasNEON;
 protected:
   bool HasFPARMv8;
   bool HasNEON;
index dd12e2c08c5a765f0d31be09b61f57de5da867e4..d0015022d8ed9182a98a152e8aa7a4728a14fc5a 100644 (file)
@@ -37,3 +37,5 @@ AArch64ELFMCAsmInfo::AArch64ELFMCAsmInfo() {
   // Exceptions handling
   ExceptionsType = ExceptionHandling::DwarfCFI;
 }
   // Exceptions handling
   ExceptionsType = ExceptionHandling::DwarfCFI;
 }
+
+void AArch64ELFMCAsmInfo::anchor() {}
index ae0a674fa8324dcd5e2ca3b3482cc96a7b15e295..67158c6b36767589dc4ad895e3972a5b4d6eaf95 100644 (file)
 
 namespace llvm {
 
 
 namespace llvm {
 
-  struct AArch64ELFMCAsmInfo : public MCAsmInfoELF {
-    explicit AArch64ELFMCAsmInfo();
-  };
+struct AArch64ELFMCAsmInfo : public MCAsmInfoELF {
+  explicit AArch64ELFMCAsmInfo();
+
+private:
+  virtual void anchor();
+};
 
 } // namespace llvm
 
 
 } // namespace llvm
 
index b76ef9671bba75673219dd2a3a75baaebb737ccd..b2dd9d85e52a67440fcd41d47149c76c0aaa2e81 100644 (file)
@@ -37,7 +37,7 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 
-#define GET_INSTRINFO_CTOR
+#define GET_INSTRINFO_CTOR_DTOR
 #include "ARMGenInstrInfo.inc"
 
 using namespace llvm;
 #include "ARMGenInstrInfo.inc"
 
 using namespace llvm;
index 2b797910e435cbae0736aad3cffe44fa2986da11..ae3c9ebc2555dbc7a2a5b89aaaf4469248d86b4e 100644 (file)
@@ -17,6 +17,7 @@ add_llvm_target(HexagonCodeGen
   HexagonFrameLowering.cpp
   HexagonHardwareLoops.cpp
   HexagonFixupHwLoops.cpp
   HexagonFrameLowering.cpp
   HexagonHardwareLoops.cpp
   HexagonFixupHwLoops.cpp
+  HexagonMachineFunctionInfo.cpp
   HexagonMachineScheduler.cpp
   HexagonMCInstLower.cpp
   HexagonInstrInfo.cpp
   HexagonMachineScheduler.cpp
   HexagonMCInstLower.cpp
   HexagonInstrInfo.cpp
index 5af645c7cb6527cdec1ec96d5cbde6da1355fb51..7d5b284188c552cda7d1baea797e5706624e23c4 100644 (file)
@@ -26,7 +26,7 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/raw_ostream.h"
-#define GET_INSTRINFO_CTOR
+#define GET_INSTRINFO_CTOR_DTOR
 #define GET_INSTRMAP_INFO
 #include "HexagonGenInstrInfo.inc"
 #include "HexagonGenDFAPacketizer.inc"
 #define GET_INSTRMAP_INFO
 #include "HexagonGenInstrInfo.inc"
 #include "HexagonGenDFAPacketizer.inc"
@@ -55,6 +55,8 @@ const int Hexagon_MEMH_AUTOINC_MIN = -16;
 const int Hexagon_MEMB_AUTOINC_MAX = 7;
 const int Hexagon_MEMB_AUTOINC_MIN = -8;
 
 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),
 
 HexagonInstrInfo::HexagonInstrInfo(HexagonSubtarget &ST)
   : HexagonGenInstrInfo(Hexagon::ADJCALLSTACKDOWN, Hexagon::ADJCALLSTACKUP),
index 3c28df438d17a98a022d17fe463114bc9cada367..7679b5f04e28043af3db9ebcccfe810768863d8d 100644 (file)
@@ -30,6 +30,8 @@ class HexagonInstrInfo : public HexagonGenInstrInfo {
   const HexagonSubtarget &Subtarget;
   typedef unsigned Opcode_t;
 
   const HexagonSubtarget &Subtarget;
   typedef unsigned Opcode_t;
 
+  virtual void anchor();
+
 public:
   explicit HexagonInstrInfo(HexagonSubtarget &ST);
 
 public:
   explicit HexagonInstrInfo(HexagonSubtarget &ST);
 
diff --git a/lib/Target/Hexagon/HexagonMachineFunctionInfo.cpp b/lib/Target/Hexagon/HexagonMachineFunctionInfo.cpp
new file mode 100644 (file)
index 0000000..9579c8b
--- /dev/null
@@ -0,0 +1,16 @@
+//= 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() {}
+
index bd7b26a619065294cd89719252412fd089affa49..c68416c20bca36df2bc0d6a9a07ea9ed7574e232 100644 (file)
@@ -1,4 +1,4 @@
-//=- HexagonMachineFuctionInfo.h - Hexagon machine function info --*- C++ -*-=//
+//=- HexagonMachineFunctionInfo.h - Hexagon machine function info -*- C++ -*-=//
 //
 //                     The LLVM Compiler Infrastructure
 //
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -10,6 +10,7 @@
 #ifndef HexagonMACHINEFUNCTIONINFO_H
 #define HexagonMACHINEFUNCTIONINFO_H
 
 #ifndef HexagonMACHINEFUNCTIONINFO_H
 #define HexagonMACHINEFUNCTIONINFO_H
 
+#include <map>
 #include "llvm/CodeGen/MachineFunction.h"
 
 namespace llvm {
 #include "llvm/CodeGen/MachineFunction.h"
 
 namespace llvm {
@@ -33,6 +34,7 @@ class HexagonMachineFunctionInfo : public MachineFunctionInfo {
 
   std::map<const MachineInstr*, unsigned> PacketInfo;
 
 
   std::map<const MachineInstr*, unsigned> PacketInfo;
 
+  virtual void anchor();
 
 public:
   HexagonMachineFunctionInfo() : SRetReturnReg(0), HasClobberLR(0),
 
 public:
   HexagonMachineFunctionInfo() : SRetReturnReg(0), HasClobberLR(0),
index 07d5ce1d8ab0d87918637f6d225fdad002277c69..a0a7c3d640755ade978dd9a0e79e916ceb30273d 100644 (file)
@@ -86,3 +86,4 @@ HexagonSubtarget::HexagonSubtarget(StringRef TT, StringRef CPU, StringRef FS):
     ModeIEEERndNear = false;
 }
 
     ModeIEEERndNear = false;
 }
 
+HexagonSubtarget::~HexagonSubtarget() {}
index 76a8fba195f3126e6903ea1f0832d6377f1484f4..e8711103d0d972742701e3277e78f059f5d68424 100644 (file)
@@ -42,6 +42,7 @@ public:
 
 public:
   HexagonSubtarget(StringRef TT, StringRef CPU, StringRef FS);
 
 public:
   HexagonSubtarget(StringRef TT, StringRef CPU, StringRef FS);
+  virtual ~HexagonSubtarget();
 
   /// getInstrItins - Return the instruction itineraies based on subtarget
   /// selection.
 
   /// getInstrItins - Return the instruction itineraies based on subtarget
   /// selection.
index b9fef0ce4d72d4a3b9f83cd590da029cbf846434..fa13008ae89f0833a70eb97f6cccb8629bf899c1 100644 (file)
@@ -15,6 +15,9 @@
 
 using namespace llvm;
 
 
 using namespace llvm;
 
+// pin vtable to this file
+void HexagonMCAsmInfo::anchor() {}
+
 HexagonMCAsmInfo::HexagonMCAsmInfo(StringRef TT) {
   Data16bitsDirective = "\t.half\t";
   Data32bitsDirective = "\t.word\t";
 HexagonMCAsmInfo::HexagonMCAsmInfo(StringRef TT) {
   Data16bitsDirective = "\t.half\t";
   Data32bitsDirective = "\t.word\t";
index b2c1d377a326b1cb240e458157e369c0b296cce4..bd8cb7637af7e123384a2285725fa29ecbf0075a 100644 (file)
@@ -19,6 +19,7 @@
 
 namespace llvm {
   class HexagonMCAsmInfo : public MCAsmInfoELF {
 
 namespace llvm {
   class HexagonMCAsmInfo : public MCAsmInfoELF {
+    virtual void anchor();
   public:
     explicit HexagonMCAsmInfo(StringRef TT);
   };
   public:
     explicit HexagonMCAsmInfo(StringRef TT);
   };
index c8505946dfaa818a763f6985dde518d1af521225..f0695a7f7c268a68252e41a96f413bfefaf1ee7c 100644 (file)
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/TargetRegistry.h"
 
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/TargetRegistry.h"
 
-#define GET_INSTRINFO_CTOR
+#define GET_INSTRINFO_CTOR_DTOR
 #include "MSP430GenInstrInfo.inc"
 
 using namespace llvm;
 
 #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) {}
 MSP430InstrInfo::MSP430InstrInfo(MSP430TargetMachine &tm)
   : MSP430GenInstrInfo(MSP430::ADJCALLSTACKDOWN, MSP430::ADJCALLSTACKUP),
     RI(tm) {}
index d79f99245e715a0de1d1f44573dc4bca29a3d35e..ad2b8cc7cd45d12c71a2667ae14b01e2315b9f6d 100644 (file)
@@ -42,6 +42,7 @@ namespace MSP430II {
 
 class MSP430InstrInfo : public MSP430GenInstrInfo {
   const MSP430RegisterInfo RI;
 
 class MSP430InstrInfo : public MSP430GenInstrInfo {
   const MSP430RegisterInfo RI;
+  virtual void anchor();
 public:
   explicit MSP430InstrInfo(MSP430TargetMachine &TM);
 
 public:
   explicit MSP430InstrInfo(MSP430TargetMachine &TM);
 
index 6c48053615edd89d4fd97fa53df172e6f6fc5353..3d417a88e4851b60caeee4b9970d2aac6d881aa8 100644 (file)
@@ -42,6 +42,9 @@ using namespace llvm;
 static cl::opt<bool> PrintHackDirectives("print-hack-directives",
                                          cl::init(false), cl::Hidden);
 
 static cl::opt<bool> 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;
 static std::string ParseMipsTriple(StringRef TT, StringRef CPU) {
   std::string MipsArchFeature;
   size_t DashPosition = 0;
index 7b04a9a375983820cc6e76562c49b6a136975e3c..a36dcc8995d77a20926b6fbbf995e91e81b65a63 100644 (file)
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/TargetRegistry.h"
 
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/TargetRegistry.h"
 
-#define GET_INSTRINFO_CTOR
+#define GET_INSTRINFO_CTOR_DTOR
 #include "MipsGenInstrInfo.inc"
 
 using namespace llvm;
 
 #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) {}
 MipsInstrInfo::MipsInstrInfo(MipsTargetMachine &tm, unsigned UncondBr)
   : MipsGenInstrInfo(Mips::ADJCALLSTACKDOWN, Mips::ADJCALLSTACKUP),
     TM(tm), UncondBrOpc(UncondBr) {}
index b6480ef337618aae326b3f4f3205386eeab255db..d9ac961cd33c897c9dc43308db9f83b238014a24 100644 (file)
@@ -27,6 +27,7 @@
 namespace llvm {
 
 class MipsInstrInfo : public MipsGenInstrInfo {
 namespace llvm {
 
 class MipsInstrInfo : public MipsGenInstrInfo {
+  virtual void anchor();
 protected:
   MipsTargetMachine &TM;
   unsigned UncondBrOpc;
 protected:
   MipsTargetMachine &TM;
   unsigned UncondBrOpc;
index fb9f5ef9e0eaf04fd2eae9aafb845753be0f84f6..237017a3d202e65c2b93ac738ad1c02c9dd6fe7b 100644 (file)
@@ -14,6 +14,7 @@
 
 namespace llvm {
 class MipsTargetStreamer : public MCTargetStreamer {
 
 namespace llvm {
 class MipsTargetStreamer : public MCTargetStreamer {
+  virtual void anchor();
 public:
   virtual void emitMipsHackELFFlags(unsigned Flags) = 0;
   virtual void emitMipsHackSTOCG(MCSymbol *Sym, unsigned Val) = 0;
 public:
   virtual void emitMipsHackELFFlags(unsigned Flags) = 0;
   virtual void emitMipsHackSTOCG(MCSymbol *Sym, unsigned Val) = 0;
index 7ff43bf2310b0ed0c484a4d5ff9afd5e7ae15687..756b15e18fb09cf4e30932fee1842d2b9f446b78 100644 (file)
@@ -2288,3 +2288,29 @@ void NVPTXTargetLowering::ReplaceNodeResults(
     return;
   }
 }
     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;
+}
index 1f54d3e6ed39a952bb55979d165a85a88e4ba391..ce5b5d5ffb33e7f32f5767a9c0ce22d1b8f9e3f2 100644 (file)
@@ -14,7 +14,7 @@
 #include "NVPTX.h"
 #include "NVPTXInstrInfo.h"
 #include "NVPTXTargetMachine.h"
 #include "NVPTX.h"
 #include "NVPTXInstrInfo.h"
 #include "NVPTXTargetMachine.h"
-#define GET_INSTRINFO_CTOR
+#define GET_INSTRINFO_CTOR_DTOR
 #include "NVPTXGenInstrInfo.inc"
 #include "llvm/IR/Function.h"
 #include "llvm/ADT/STLExtras.h"
 #include "NVPTXGenInstrInfo.inc"
 #include "llvm/IR/Function.h"
 #include "llvm/ADT/STLExtras.h"
@@ -24,6 +24,9 @@
 
 using namespace llvm;
 
 
 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()) {}
 // FIXME: Add the subtarget support on this constructor.
 NVPTXInstrInfo::NVPTXInstrInfo(NVPTXTargetMachine &tm)
     : NVPTXGenInstrInfo(), TM(tm), RegInfo(*TM.getSubtargetImpl()) {}
index b1972e9b72546c80b8261365bfa8b5617ea31772..600fc5c60a1bf42f376430bdc4771a33bf2b0b27 100644 (file)
@@ -26,6 +26,7 @@ namespace llvm {
 class NVPTXInstrInfo : public NVPTXGenInstrInfo {
   NVPTXTargetMachine &TM;
   const NVPTXRegisterInfo RegInfo;
 class NVPTXInstrInfo : public NVPTXGenInstrInfo {
   NVPTXTargetMachine &TM;
   const NVPTXRegisterInfo RegInfo;
+  virtual void anchor();
 public:
   explicit NVPTXInstrInfo(NVPTXTargetMachine &TM);
 
 public:
   explicit NVPTXInstrInfo(NVPTXTargetMachine &TM);
 
index e57ace92e850f9c434e35a58feca939ba2e54b7f..f8a692e9b1a36f8115f9f9b9b040673549a18478 100644 (file)
@@ -24,10 +24,10 @@ namespace llvm {
 /// the ASMPrint interface.
 ///
 class NVPTXSection : public MCSection {
 /// the ASMPrint interface.
 ///
 class NVPTXSection : public MCSection {
-
+  virtual void anchor();
 public:
   NVPTXSection(SectionVariant V, SectionKind K) : MCSection(V, K) {}
 public:
   NVPTXSection(SectionVariant V, SectionKind K) : MCSection(V, K) {}
-  ~NVPTXSection() {}
+  virtual ~NVPTXSection() {}
 
   /// Override this as NVPTX has its own way of printing switching
   /// to a section.
 
   /// Override this as NVPTX has its own way of printing switching
   /// to a section.
index c4d0d6e4193dab9513dc2125262d7d98db353d32..3e5bcf79dd654941673b5db726d7e6f84da91bb4 100644 (file)
@@ -20,6 +20,9 @@
 using namespace llvm;
 
 
 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),
 NVPTXSubtarget::NVPTXSubtarget(const std::string &TT, const std::string &CPU,
                                const std::string &FS, bool is64Bit)
     : NVPTXGenSubtargetInfo(TT, CPU, FS), Is64Bit(is64Bit), PTXVersion(0),
index 670077daaa69e30aebf65ab99e774139de585994..a18392034163b7bd4004aafe47fea09a7ff8981f 100644 (file)
@@ -36,6 +36,8 @@ class NVPTXSubtarget : public NVPTXGenSubtargetInfo {
   // SM version x.y is represented as 10*x+y, e.g. 3.1 == 31
   unsigned int SmVersion;
 
   // 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.
 public:
   /// This constructor initializes the data members to match that
   /// of the specified module.
index 1449f52a966c84db485cbc2f2e5e92c443bd9967..2a7394b79ae610d85cd1ba492211120db68282d8 100644 (file)
@@ -44,28 +44,7 @@ public:
     DwarfMacroInfoSection = 0;
   }
 
     DwarfMacroInfoSection = 0;
   }
 
-  ~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 ~NVPTXTargetObjectFile();
 
   virtual void Initialize(MCContext &ctx, const TargetMachine &TM) {
     TargetLoweringObjectFile::Initialize(ctx, TM);
 
   virtual void Initialize(MCContext &ctx, const TargetMachine &TM) {
     TargetLoweringObjectFile::Initialize(ctx, TM);
index 5c08de1ccf39c541eba0512614facdda2a33664e..8f4e224219af9f80fcb3285385230f7a3bedc180 100644 (file)
@@ -37,6 +37,9 @@
 
 using namespace llvm;
 
 
 using namespace llvm;
 
+// pin vtable to this file
+PPCTargetStreamer::~PPCTargetStreamer() {}
+
 static MCInstrInfo *createPPCMCInstrInfo() {
   MCInstrInfo *X = new MCInstrInfo();
   InitPPCMCInstrInfo(X);
 static MCInstrInfo *createPPCMCInstrInfo() {
   MCInstrInfo *X = new MCInstrInfo();
   InitPPCMCInstrInfo(X);
index 375daee59e9cae7a19a12b0ba7684f0d73ffde0e..102057193e2a96e4ee8ca68434d522216aa00424 100644 (file)
@@ -33,7 +33,7 @@
 #include "llvm/Support/raw_ostream.h"
 
 #define GET_INSTRMAP_INFO
 #include "llvm/Support/raw_ostream.h"
 
 #define GET_INSTRMAP_INFO
-#define GET_INSTRINFO_CTOR
+#define GET_INSTRINFO_CTOR_DTOR
 #include "PPCGenInstrInfo.inc"
 
 using namespace llvm;
 #include "PPCGenInstrInfo.inc"
 
 using namespace llvm;
@@ -45,6 +45,9 @@ opt<bool> DisableCTRLoopAnal("disable-ppc-ctrloop-analysis", cl::Hidden,
 static cl::opt<bool> DisableCmpOpt("disable-ppc-cmp-opt",
 cl::desc("Disable compare instruction optimization"), cl::Hidden);
 
 static cl::opt<bool> 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()) {}
 PPCInstrInfo::PPCInstrInfo(PPCTargetMachine &tm)
   : PPCGenInstrInfo(PPC::ADJCALLSTACKDOWN, PPC::ADJCALLSTACKUP),
     TM(tm), RI(*TM.getSubtargetImpl()) {}
index bd72a4d9e519e84006d575f42e98918e6f224b55..f140c41a2a89a874606c58fd316c537c27de0b6e 100644 (file)
@@ -78,6 +78,7 @@ class PPCInstrInfo : public PPCGenInstrInfo {
                             const TargetRegisterClass *RC,
                             SmallVectorImpl<MachineInstr*> &NewMIs,
                             bool &NonRI, bool &SpillsVRS) const;
                             const TargetRegisterClass *RC,
                             SmallVectorImpl<MachineInstr*> &NewMIs,
                             bool &NonRI, bool &SpillsVRS) const;
+  virtual void anchor();
 public:
   explicit PPCInstrInfo(PPCTargetMachine &TM);
 
 public:
   explicit PPCInstrInfo(PPCTargetMachine &TM);
 
index 3ecd8a8b0a423ad758c22da5cdf6a44c0cee9267..e876be16a9b3284bd56339a76d77ca33b5d0b283 100644 (file)
@@ -15,6 +15,7 @@
 namespace llvm {
 class PPCTargetStreamer : public MCTargetStreamer {
 public:
 namespace llvm {
 class PPCTargetStreamer : public MCTargetStreamer {
 public:
+  virtual ~PPCTargetStreamer();
   virtual void emitTCEntry(const MCSymbol &S) = 0;
 };
 }
   virtual void emitTCEntry(const MCSymbol &S) = 0;
 };
 }
index 1b2e131fb9cbbf05dff38a89a02acdb6e07d25d6..3a859cf407a0cd00b6dee48b65f9a9fcac9633c8 100644 (file)
 #include "llvm/CodeGen/MachineInstrBuilder.h"
 #include "llvm/CodeGen/MachineRegisterInfo.h"
 
 #include "llvm/CodeGen/MachineInstrBuilder.h"
 #include "llvm/CodeGen/MachineRegisterInfo.h"
 
-#define GET_INSTRINFO_CTOR
+#define GET_INSTRINFO_CTOR_DTOR
 #define GET_INSTRINFO_NAMED_OPS
 #define GET_INSTRMAP_INFO
 #include "AMDGPUGenInstrInfo.inc"
 
 using namespace llvm;
 
 #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) { }
 
 AMDGPUInstrInfo::AMDGPUInstrInfo(TargetMachine &tm)
   : AMDGPUGenInstrInfo(-1,-1), RI(tm), TM(tm) { }
 
index 6378fdd1eb4059cbd1e900b806078c0a26135f60..ce5b58c6923f943ff05a72a2698a69b2726389d8 100644 (file)
@@ -43,6 +43,7 @@ private:
   const AMDGPURegisterInfo RI;
   bool getNextBranchInstr(MachineBasicBlock::iterator &iter,
                           MachineBasicBlock &MBB) const;
   const AMDGPURegisterInfo RI;
   bool getNextBranchInstr(MachineBasicBlock::iterator &iter,
                           MachineBasicBlock &MBB) const;
+  virtual void anchor();
 protected:
   TargetMachine &TM;
 public:
 protected:
   TargetMachine &TM;
 public:
index f2342b0e8854ba11ea8cbc300b594047c47b7c6e..d4531012c84da1b2d88109e9814240e4d52ee729 100644 (file)
@@ -6,6 +6,9 @@ using namespace llvm;
 
 static const char *const ShaderTypeAttribute = "ShaderType";
 
 
 static const char *const ShaderTypeAttribute = "ShaderType";
 
+// pin vtable to this file
+void AMDGPUMachineFunction::anchor() {}
+
 AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) :
     MachineFunctionInfo() {
   ShaderType = ShaderType::COMPUTE;
 AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) :
     MachineFunctionInfo() {
   ShaderType = ShaderType::COMPUTE;
index fe80ce3f015f35999e8887e7b5be142a3f381641..fea0b39e91e5ffca1d845cc5fef73cbb7f37a3ae 100644 (file)
@@ -19,6 +19,7 @@
 namespace llvm {
 
 class AMDGPUMachineFunction : public MachineFunctionInfo {
 namespace llvm {
 
 class AMDGPUMachineFunction : public MachineFunctionInfo {
+  virtual void anchor();
 public:
   AMDGPUMachineFunction(const MachineFunction &MF);
   unsigned ShaderType;
 public:
   AMDGPUMachineFunction(const MachineFunction &MF);
   unsigned ShaderType;
diff --git a/lib/Target/R600/MCTargetDesc/AMDGPUMCCodeEmitter.cpp b/lib/Target/R600/MCTargetDesc/AMDGPUMCCodeEmitter.cpp
new file mode 100644 (file)
index 0000000..521b3b3
--- /dev/null
@@ -0,0 +1,21 @@
+//===-- 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() {}
+
index cd3a7ce65aa5f8b7eed5057c8894758519296b42..d8cf64adb91bd2cf550410f234a518abb2d77efe 100644 (file)
@@ -24,6 +24,7 @@ class MCInst;
 class MCOperand;
 
 class AMDGPUMCCodeEmitter : public MCCodeEmitter {
 class MCOperand;
 
 class AMDGPUMCCodeEmitter : public MCCodeEmitter {
+  virtual void anchor();
 public:
 
   uint64_t getBinaryCodeForInstr(const MCInst &MI,
 public:
 
   uint64_t getBinaryCodeForInstr(const MCInst &MI,
index 3ccdf420601d09b94f335c0d61bac64e969d4fc0..98f6925d9fb2bc608e3d6d19737fb8f83b4bbae4 100644 (file)
@@ -2,6 +2,7 @@
 add_llvm_library(LLVMR600Desc
   AMDGPUAsmBackend.cpp
   AMDGPUELFObjectWriter.cpp
 add_llvm_library(LLVMR600Desc
   AMDGPUAsmBackend.cpp
   AMDGPUELFObjectWriter.cpp
+  AMDGPUMCCodeEmitter.cpp
   AMDGPUMCTargetDesc.cpp
   AMDGPUMCAsmInfo.cpp
   R600MCCodeEmitter.cpp
   AMDGPUMCTargetDesc.cpp
   AMDGPUMCAsmInfo.cpp
   R600MCCodeEmitter.cpp
index 3987b2d436c5fde9c3596e30d295f016db8a1a5f..8436d5ffed63ab9b066fd389f45107c472229ea2 100644 (file)
@@ -23,7 +23,7 @@
 #include "llvm/CodeGen/MachineInstrBuilder.h"
 #include "llvm/CodeGen/MachineRegisterInfo.h"
 
 #include "llvm/CodeGen/MachineInstrBuilder.h"
 #include "llvm/CodeGen/MachineRegisterInfo.h"
 
-#define GET_INSTRINFO_CTOR
+#define GET_INSTRINFO_CTOR_DTOR
 #include "AMDGPUGenDFAPacketizer.inc"
 
 using namespace llvm;
 #include "AMDGPUGenDFAPacketizer.inc"
 
 using namespace llvm;
index 018b4036336345c034645ea803102dfdc579307f..d0d35cf0efe4d3c00a5e7ecf974d3bcf282180f2 100644 (file)
@@ -12,7 +12,9 @@
 
 using namespace llvm;
 
 
 using namespace llvm;
 
-R600MachineFunctionInfo::R600MachineFunctionInfo(const MachineFunction &MF)
-  : AMDGPUMachineFunction(MF) { }
 
 
+// pin vtable to this file
+void R600MachineFunctionInfo::anchor() {}
 
 
+R600MachineFunctionInfo::R600MachineFunctionInfo(const MachineFunction &MF)
+  : AMDGPUMachineFunction(MF) { }
index f23d9b78b3118ff1df37334c04b12ddfac24c6b8..c1bec0aae7e48602afa4443c047ab7f33b08b9d2 100644 (file)
@@ -21,6 +21,7 @@
 namespace llvm {
 
 class R600MachineFunctionInfo : public AMDGPUMachineFunction {
 namespace llvm {
 
 class R600MachineFunctionInfo : public AMDGPUMachineFunction {
+  virtual void anchor();
 public:
   R600MachineFunctionInfo(const MachineFunction &MF);
   SmallVector<unsigned, 4> LiveOuts;
 public:
   R600MachineFunctionInfo(const MachineFunction &MF);
   SmallVector<unsigned, 4> LiveOuts;
index ee0e30755f017ed7f8f773303ef701be76728fe7..2f66360d83cb38b85a0d4d81aa89a7e6798bc27a 100644 (file)
 
 using namespace llvm;
 
 
 using namespace llvm;
 
+
+// pin vtable to this file
+void SIMachineFunctionInfo::anchor() {}
+
 SIMachineFunctionInfo::SIMachineFunctionInfo(const MachineFunction &MF)
   : AMDGPUMachineFunction(MF),
     PSInputAddr(0) { }
 SIMachineFunctionInfo::SIMachineFunctionInfo(const MachineFunction &MF)
   : AMDGPUMachineFunction(MF),
     PSInputAddr(0) { }
index 6da9f7f9a14d5c5e1f9dec17635d603dd8da9753..2f1961cafdb4c271aa09630f5fbfc440c029c466 100644 (file)
@@ -22,6 +22,7 @@ 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 {
 /// 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;
 public:
   SIMachineFunctionInfo(const MachineFunction &MF);
   unsigned PSInputAddr;
index 93d7b56501f0b70238fb3d4a3259d05f7df0b757..5e5e37a778af074a43d67a648b0226d14725691d 100644 (file)
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/TargetRegistry.h"
 
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/TargetRegistry.h"
 
-#define GET_INSTRINFO_CTOR
+#define GET_INSTRINFO_CTOR_DTOR
 #include "SparcGenInstrInfo.inc"
 
 using namespace llvm;
 
 #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) {
 SparcInstrInfo::SparcInstrInfo(SparcSubtarget &ST)
   : SparcGenInstrInfo(SP::ADJCALLSTACKDOWN, SP::ADJCALLSTACKUP),
     RI(ST), Subtarget(ST) {
index d0b220b73d404ebe4038ab3d8d940c74be8fd7ff..a86cbcb1c4ba1a0c7948116279ad1371785a082c 100644 (file)
@@ -37,6 +37,7 @@ namespace SPII {
 class SparcInstrInfo : public SparcGenInstrInfo {
   const SparcRegisterInfo RI;
   const SparcSubtarget& Subtarget;
 class SparcInstrInfo : public SparcGenInstrInfo {
   const SparcRegisterInfo RI;
   const SparcSubtarget& Subtarget;
+  virtual void anchor();
 public:
   explicit SparcInstrInfo(SparcSubtarget &ST);
 
 public:
   explicit SparcInstrInfo(SparcSubtarget &ST);
 
index 8a4eaa35e92553149a4f1f7a00021fa0b337bda8..d21c0a8086fb4f543060c96c749efb5bd3fec8fe 100644 (file)
@@ -21,6 +21,7 @@ add_llvm_target(SystemZCodeGen
   SystemZISelLowering.cpp
   SystemZInstrInfo.cpp
   SystemZLongBranch.cpp
   SystemZISelLowering.cpp
   SystemZInstrInfo.cpp
   SystemZLongBranch.cpp
+  SystemZMachineFunctionInfo.cpp
   SystemZMCInstLower.cpp
   SystemZRegisterInfo.cpp
   SystemZSelectionDAGInfo.cpp
   SystemZMCInstLower.cpp
   SystemZRegisterInfo.cpp
   SystemZSelectionDAGInfo.cpp
index 2ebbc0d81ae3c5521f57576acd0315e6022c31eb..67aacf3551fb0b6c2c20a39cb6ec412d20c47611 100644 (file)
@@ -17,7 +17,7 @@
 #include "llvm/CodeGen/LiveVariables.h"
 #include "llvm/CodeGen/MachineRegisterInfo.h"
 
 #include "llvm/CodeGen/LiveVariables.h"
 #include "llvm/CodeGen/MachineRegisterInfo.h"
 
-#define GET_INSTRINFO_CTOR
+#define GET_INSTRINFO_CTOR_DTOR
 #define GET_INSTRMAP_INFO
 #include "SystemZGenInstrInfo.inc"
 
 #define GET_INSTRMAP_INFO
 #include "SystemZGenInstrInfo.inc"
 
@@ -37,6 +37,9 @@ static bool isHighReg(unsigned int Reg) {
   return false;
 }
 
   return false;
 }
 
+// pin vtable to this file
+void SystemZInstrInfo::anchor() {}
+
 SystemZInstrInfo::SystemZInstrInfo(SystemZTargetMachine &tm)
   : SystemZGenInstrInfo(SystemZ::ADJCALLSTACKDOWN, SystemZ::ADJCALLSTACKUP),
     RI(tm), TM(tm) {
 SystemZInstrInfo::SystemZInstrInfo(SystemZTargetMachine &tm)
   : SystemZGenInstrInfo(SystemZ::ADJCALLSTACKDOWN, SystemZ::ADJCALLSTACKUP),
     RI(tm), TM(tm) {
index 7978be42c90f8b2bfe2d2471ac17af9c8672214b..be4c8fe2add235f354e37530895d9b03e9d1fcc3 100644 (file)
@@ -127,6 +127,7 @@ class SystemZInstrInfo : public SystemZGenInstrInfo {
   void emitGRX32Move(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
                      DebugLoc DL, unsigned DestReg, unsigned SrcReg,
                      unsigned LowLowOpcode, unsigned Size, bool KillSrc) const;
   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);
   
 public:
   explicit SystemZInstrInfo(SystemZTargetMachine &TM);
diff --git a/lib/Target/SystemZ/SystemZMachineFunctionInfo.cpp b/lib/Target/SystemZ/SystemZMachineFunctionInfo.cpp
new file mode 100644 (file)
index 0000000..00572d0
--- /dev/null
@@ -0,0 +1,17 @@
+//== 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() {}
+
index 69c269137e09e496c040c4884b01bb185ef6dd9c..509cef6d6465e14790d2061d81d91957579637c6 100644 (file)
@@ -23,6 +23,8 @@ class SystemZMachineFunctionInfo : public MachineFunctionInfo {
   unsigned RegSaveFrameIndex;
   bool ManipulatesSP;
 
   unsigned RegSaveFrameIndex;
   bool ManipulatesSP;
 
+  virtual void anchor();
+
 public:
   explicit SystemZMachineFunctionInfo(MachineFunction &MF)
     : LowSavedGPR(0), HighSavedGPR(0), VarArgsFirstGPR(0), VarArgsFirstFPR(0),
 public:
   explicit SystemZMachineFunctionInfo(MachineFunction &MF)
     : LowSavedGPR(0), HighSavedGPR(0), VarArgsFirstGPR(0), VarArgsFirstFPR(0),
index 474192099f22fc6120e2d8d3b9ef36d9643a8b10..b9a9db2aa773f2f9b7c65a5ca78f6d9b06bf5697 100644 (file)
@@ -18,6 +18,9 @@
 
 using namespace llvm;
 
 
 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)
 SystemZSubtarget::SystemZSubtarget(const std::string &TT,
                                    const std::string &CPU,
                                    const std::string &FS)
index 74d3f90ad74d05919aa10898dd70d45fb8676668..5817491d4585dad880dd1565da4e4eb78967aa18 100644 (file)
@@ -26,6 +26,7 @@ class GlobalValue;
 class StringRef;
 
 class SystemZSubtarget : public SystemZGenSubtargetInfo {
 class StringRef;
 
 class SystemZSubtarget : public SystemZGenSubtargetInfo {
+  virtual void anchor();
 protected:
   bool HasDistinctOps;
   bool HasLoadStoreOnCond;
 protected:
   bool HasDistinctOps;
   bool HasLoadStoreOnCond;
index ed64a32eeff2aecfd950212490aefa493275ab91..6da414287cfcb57ea7ca911e59050c63503f7ddb 100644 (file)
@@ -27,7 +27,7 @@ namespace {
 
   public:
     X86WinCOFFObjectWriter(bool Is64Bit_);
 
   public:
     X86WinCOFFObjectWriter(bool Is64Bit_);
-    ~X86WinCOFFObjectWriter();
+    virtual ~X86WinCOFFObjectWriter();
 
     virtual unsigned getRelocType(const MCValue &Target,
                                   const MCFixup &Fixup,
 
     virtual unsigned getRelocType(const MCValue &Target,
                                   const MCFixup &Fixup,
index 0a668a899111d17dbe0ec5e3e86dc4c5f0f5cc76..304d92261465e285b1dc01faf776fb2b10dd6733 100644 (file)
@@ -36,7 +36,7 @@
 #include "llvm/Target/TargetOptions.h"
 #include <limits>
 
 #include "llvm/Target/TargetOptions.h"
 #include <limits>
 
-#define GET_INSTRINFO_CTOR
+#define GET_INSTRINFO_CTOR_DTOR
 #include "X86GenInstrInfo.inc"
 
 using namespace llvm;
 #include "X86GenInstrInfo.inc"
 
 using namespace llvm;
@@ -92,6 +92,9 @@ struct X86OpTblEntry {
   uint16_t Flags;
 };
 
   uint16_t Flags;
 };
 
+// pin vtable to this file
+void X86InstrInfo::anchor() {}
+
 X86InstrInfo::X86InstrInfo(X86TargetMachine &tm)
   : X86GenInstrInfo((tm.getSubtarget<X86Subtarget>().is64Bit()
                      ? X86::ADJCALLSTACKDOWN64
 X86InstrInfo::X86InstrInfo(X86TargetMachine &tm)
   : X86GenInstrInfo((tm.getSubtarget<X86Subtarget>().is64Bit()
                      ? X86::ADJCALLSTACKDOWN64
index 532e7805ad5e1d7893434973b29c807432c66688..600e3922a71e161b6714b9c43480836c01035762 100644 (file)
@@ -152,6 +152,8 @@ class X86InstrInfo : public X86GenInstrInfo {
                             MemOp2RegOpTableType &M2RTable,
                             unsigned RegOp, unsigned MemOp, unsigned Flags);
 
                             MemOp2RegOpTableType &M2RTable,
                             unsigned RegOp, unsigned MemOp, unsigned Flags);
 
+  virtual void anchor();
+
 public:
   explicit X86InstrInfo(X86TargetMachine &tm);
 
 public:
   explicit X86InstrInfo(X86TargetMachine &tm);
 
index d6b8c2d5ede8e771200c14cfaced83f5505bb922..71939650d9e920297f5989e17999c8d0cf4bb08d 100644 (file)
@@ -22,7 +22,7 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/TargetRegistry.h"
 
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/TargetRegistry.h"
 
-#define GET_INSTRINFO_CTOR
+#define GET_INSTRINFO_CTOR_DTOR
 #include "XCoreGenInstrInfo.inc"
 
 namespace llvm {
 #include "XCoreGenInstrInfo.inc"
 
 namespace llvm {
@@ -39,6 +39,10 @@ namespace XCore {
 
 using namespace llvm;
 
 
 using namespace llvm;
 
+
+// pin vtable to this file
+void XCoreInstrInfo::anchor() {}
+
 XCoreInstrInfo::XCoreInstrInfo()
   : XCoreGenInstrInfo(XCore::ADJCALLSTACKDOWN, XCore::ADJCALLSTACKUP),
     RI() {
 XCoreInstrInfo::XCoreInstrInfo()
   : XCoreGenInstrInfo(XCore::ADJCALLSTACKDOWN, XCore::ADJCALLSTACKUP),
     RI() {
index 51d66a1f20dbeec448e2870a297ac1291ce5dc7f..4429b07e41ed58185ef3c8d5712ede5fa3cceeea 100644 (file)
@@ -24,6 +24,7 @@ namespace llvm {
 
 class XCoreInstrInfo : public XCoreGenInstrInfo {
   const XCoreRegisterInfo RI;
 
 class XCoreInstrInfo : public XCoreGenInstrInfo {
   const XCoreRegisterInfo RI;
+  virtual void anchor();
 public:
   XCoreInstrInfo();
 
 public:
   XCoreInstrInfo();
 
index 15f7abf70e9f709db1cc6259c801dfcf063e2b57..d262a69d9327a790a24fe0569b3199b1a105498c 100644 (file)
@@ -128,7 +128,7 @@ public:
     BB(Block),PT(PT),Ran(R),Context(BB->getContext()) {}
 
   /// virtual D'tor to silence warnings.
     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;
 
   /// Add a new instruction.
   virtual void Act() = 0;
@@ -285,8 +285,11 @@ protected:
   LLVMContext &Context;
 };
 
   LLVMContext &Context;
 };
 
+Modifier::~Modifier() {}
+
 struct LoadModifier: public Modifier {
   LoadModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
 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();
   virtual void Act() {
     // Try to use predefined pointers. If non exist, use undef pointer value;
     Value *Ptr = getRandomPointerValue();
@@ -295,8 +298,11 @@ struct LoadModifier: public Modifier {
   }
 };
 
   }
 };
 
+LoadModifier::~LoadModifier() {}
+
 struct StoreModifier: public Modifier {
   StoreModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
 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();
   virtual void Act() {
     // Try to use predefined pointers. If non exist, use undef pointer value;
     Value *Ptr = getRandomPointerValue();
@@ -313,8 +319,11 @@ struct StoreModifier: public Modifier {
   }
 };
 
   }
 };
 
+StoreModifier::~StoreModifier() {}
+
 struct BinModifier: public Modifier {
   BinModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
 struct BinModifier: public Modifier {
   BinModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
+  virtual ~BinModifier();
 
   virtual void Act() {
     Value *Val0 = getRandomVal();
 
   virtual void Act() {
     Value *Val0 = getRandomVal();
@@ -356,9 +365,13 @@ struct BinModifier: public Modifier {
   }
 };
 
   }
 };
 
+BinModifier::~BinModifier() {}
+
 /// Generate constant values.
 struct ConstModifier: public Modifier {
   ConstModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
 /// 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();
 
   virtual void Act() {
     Type *Ty = pickType();
 
@@ -403,8 +416,11 @@ struct ConstModifier: public Modifier {
   }
 };
 
   }
 };
 
+ConstModifier::~ConstModifier() {}
+
 struct AllocaModifier: public Modifier {
   AllocaModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R){}
 struct AllocaModifier: public Modifier {
   AllocaModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R){}
+  virtual ~AllocaModifier();
 
   virtual void Act() {
     Type *Tp = pickType();
 
   virtual void Act() {
     Type *Tp = pickType();
@@ -412,9 +428,12 @@ struct AllocaModifier: public Modifier {
   }
 };
 
   }
 };
 
+AllocaModifier::~AllocaModifier() {}
+
 struct ExtractElementModifier: public Modifier {
   ExtractElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
     Modifier(BB, PT, R) {}
 struct ExtractElementModifier: public Modifier {
   ExtractElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
     Modifier(BB, PT, R) {}
+  virtual ~ExtractElementModifier();
 
   virtual void Act() {
     Value *Val0 = getRandomVectorValue();
 
   virtual void Act() {
     Value *Val0 = getRandomVectorValue();
@@ -426,8 +445,12 @@ struct ExtractElementModifier: public Modifier {
   }
 };
 
   }
 };
 
+ExtractElementModifier::~ExtractElementModifier() {}
+
 struct ShuffModifier: public Modifier {
   ShuffModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
 struct ShuffModifier: public Modifier {
   ShuffModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
+  virtual ~ShuffModifier();
+
   virtual void Act() {
 
     Value *Val0 = getRandomVectorValue();
   virtual void Act() {
 
     Value *Val0 = getRandomVectorValue();
@@ -453,9 +476,12 @@ struct ShuffModifier: public Modifier {
   }
 };
 
   }
 };
 
+ShuffModifier::~ShuffModifier() {}
+
 struct InsertElementModifier: public Modifier {
   InsertElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
     Modifier(BB, PT, R) {}
 struct InsertElementModifier: public Modifier {
   InsertElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
     Modifier(BB, PT, R) {}
+  virtual ~InsertElementModifier();
 
   virtual void Act() {
     Value *Val0 = getRandomVectorValue();
 
   virtual void Act() {
     Value *Val0 = getRandomVectorValue();
@@ -470,8 +496,12 @@ struct InsertElementModifier: public Modifier {
 
 };
 
 
 };
 
+InsertElementModifier::~InsertElementModifier() {}
+
 struct CastModifier: public Modifier {
   CastModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
 struct CastModifier: public Modifier {
   CastModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
+  virtual ~CastModifier();
+
   virtual void Act() {
 
     Value *V = getRandomVal();
   virtual void Act() {
 
     Value *V = getRandomVal();
@@ -555,9 +585,12 @@ struct CastModifier: public Modifier {
 
 };
 
 
 };
 
+CastModifier::~CastModifier() {}
+
 struct SelectModifier: public Modifier {
   SelectModifier(BasicBlock *BB, PieceTable *PT, Random *R):
     Modifier(BB, PT, R) {}
 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.
 
   virtual void Act() {
     // Try a bunch of different select configuration until a valid one is found.
@@ -579,9 +612,12 @@ struct SelectModifier: public Modifier {
   }
 };
 
   }
 };
 
+SelectModifier::~SelectModifier() {}
 
 struct CmpModifier: public Modifier {
   CmpModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
 
 struct CmpModifier: public Modifier {
   CmpModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
+  virtual ~CmpModifier();
+
   virtual void Act() {
 
     Value *Val0 = getRandomVal();
   virtual void Act() {
 
     Value *Val0 = getRandomVal();
@@ -607,6 +643,8 @@ 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);
 void FillFunction(Function *F, Random &R) {
   // Create a legal entry block.
   BasicBlock *BB = BasicBlock::Create(F->getContext(), "BB", F);
index 0c8c4ca16dd736709b1ffe3ab7326b853a4378f1..2be5aaf7368c0bda7b1cfb7a2497ce6d79e6e7f2 100644 (file)
 namespace llvm {
 
 struct VirtualRefCounted : public RefCountedBaseVPTR {
 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;
 // Run this test with valgrind to detect memory leaks.
 TEST(IntrusiveRefCntPtr, RefCountedBaseVPTRCopyDoesNotLeak) {
   VirtualRefCounted *V1 = new VirtualRefCounted;
index e4197ddced618d8954b662d30b9cee6d3275232c..e77fd3680bfd2a90098c9d9858188f244c1ca42a 100644 (file)
@@ -83,14 +83,8 @@ protected:
     UnsupportedOSs.push_back(Triple::Cygwin);
   }
   
     UnsupportedOSs.push_back(Triple::Cygwin);
   }
   
-  virtual void SetUp() {
-    didCallAllocateCodeSection = false;
-    Module = 0;
-    Function = 0;
-    Engine = 0;
-    Error = 0;
-  }
-  
+  virtual void SetUp();
+
   virtual void TearDown() {
     if (Engine)
       LLVMDisposeExecutionEngine(Engine);
   virtual void TearDown() {
     if (Engine)
       LLVMDisposeExecutionEngine(Engine);
@@ -157,6 +151,14 @@ protected:
   char *Error;
 };
 
   char *Error;
 };
 
+void MCJITCAPITest::SetUp() {
+  didCallAllocateCodeSection = false;
+  Module = 0;
+  Function = 0;
+  Engine = 0;
+  Error = 0;
+}
+
 TEST_F(MCJITCAPITest, simple_function) {
   SKIP_UNSUPPORTED_PLATFORM;
   
 TEST_F(MCJITCAPITest, simple_function) {
   SKIP_UNSUPPORTED_PLATFORM;
   
index 4d650e8dbafa235d0834993297fde4834c16975b..b01a85495bb3d2583da56069e05badfd686c6b61 100644 (file)
 
 using namespace llvm;
 
 
 using namespace llvm;
 
-class MCJITMultipleModuleTest : public testing::Test, public MCJITTestBase {};
+class MCJITMultipleModuleTest : public testing::Test,
+                                public MCJITTestBase {
+public:
+  virtual ~MCJITMultipleModuleTest();
+};
+
+MCJITMultipleModuleTest::~MCJITMultipleModuleTest() {}
 
 namespace {
 
 
 namespace {
 
index 7ccd2546c063b0250427b85261db3d56465239ae..3a86eb5f0701b19b2570029a787bba39f638ca79 100644 (file)
@@ -21,11 +21,13 @@ using namespace llvm;
 class MCJITTest : public testing::Test, public MCJITTestBase {
 protected:
 
 class MCJITTest : public testing::Test, public MCJITTestBase {
 protected:
 
-  virtual void SetUp() {
-    M.reset(createEmptyModule("<main>"));
-  }
+  virtual void SetUp();
 };
 
 };
 
+void MCJITTest::SetUp() {
+  M.reset(createEmptyModule("<main>"));
+}
+
 namespace {
 
 // FIXME: Ensure creating an execution engine does not crash when constructed
 namespace {
 
 // FIXME: Ensure creating an execution engine does not crash when constructed
index 001e97d1e1168fd0fc85d66234a044f8f63c8eeb..a857a2041709d69cb69e8d1059499f6f666759ed 100644 (file)
@@ -38,12 +38,15 @@ static void dumpIdxVec(const SmallVectorImpl<unsigned> &V) {
 
 // (instrs a, b, ...) Evaluate and union all arguments. Identical to AddOp.
 struct InstrsOp : public SetTheory::Operator {
 
 // (instrs a, b, ...) Evaluate and union all arguments. Identical to AddOp.
 struct InstrsOp : public SetTheory::Operator {
-  void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
-             ArrayRef<SMLoc> Loc) {
-    ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts, Loc);
-  }
+  virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
+                     ArrayRef<SMLoc> Loc);
 };
 
 };
 
+void InstrsOp::apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
+                     ArrayRef<SMLoc> 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
 // (instregex "OpcPat",...) Find all instructions matching an opcode pattern.
 //
 // TODO: Since this is a prefix match, perform a binary search over the
@@ -56,34 +59,37 @@ struct InstRegexOp : public SetTheory::Operator {
   const CodeGenTarget &Target;
   InstRegexOp(const CodeGenTarget &t): Target(t) {}
 
   const CodeGenTarget &Target;
   InstRegexOp(const CodeGenTarget &t): Target(t) {}
 
-  void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
-             ArrayRef<SMLoc> Loc) {
-    SmallVector<Regex*, 4> RegexList;
-    for (DagInit::const_arg_iterator
-           AI = Expr->arg_begin(), AE = Expr->arg_end(); AI != AE; ++AI) {
-      StringInit *SI = dyn_cast<StringInit>(*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<Regex*>::iterator
-             RI = RegexList.begin(), RE = RegexList.end(); RI != RE; ++RI) {
-        if ((*RI)->match((*I)->TheDef->getName()))
-          Elts.insert((*I)->TheDef);
-      }
+  virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
+                     ArrayRef<SMLoc> Loc);
+};
+
+void InstRegexOp::apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
+                       ArrayRef<SMLoc> Loc) {
+  SmallVector<Regex*, 4> RegexList;
+  for (DagInit::const_arg_iterator
+       AI = Expr->arg_begin(), AE = Expr->arg_end(); AI != AE; ++AI) {
+    StringInit *SI = dyn_cast<StringInit>(*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<Regex*>::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,
 
 /// CodeGenModels ctor interprets machine model records and populates maps.
 CodeGenSchedModels::CodeGenSchedModels(RecordKeeper &RK,
index af26353d01c27e8eb11b4f5bd8d83a6168f000ca..9e0b74e793c2d121caa2344220fda599f56165dd 100644 (file)
@@ -408,13 +408,14 @@ 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"
   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";
 
      << "};\n";
   OS << "} // End llvm namespace \n";
 
   OS << "#endif // GET_INSTRINFO_HEADER\n\n";
 
-  OS << "\n#ifdef GET_INSTRINFO_CTOR\n";
-  OS << "#undef GET_INSTRINFO_CTOR\n";
+  OS << "\n#ifdef GET_INSTRINFO_CTOR_DTOR\n";
+  OS << "#undef GET_INSTRINFO_CTOR_DTOR\n";
 
   OS << "namespace llvm {\n";
   OS << "extern const MCInstrDesc " << TargetName << "Insts[];\n";
 
   OS << "namespace llvm {\n";
   OS << "extern const MCInstrDesc " << TargetName << "Insts[];\n";
@@ -424,10 +425,11 @@ void InstrInfoEmitter::run(raw_ostream &OS) {
      << "  : TargetInstrInfo(SO, DO) {\n"
      << "  InitMCInstrInfo(" << TargetName << "Insts, "
      << TargetName << "InstrNameIndices, " << TargetName << "InstrNameData, "
      << "  : TargetInstrInfo(SO, DO) {\n"
      << "  InitMCInstrInfo(" << TargetName << "Insts, "
      << TargetName << "InstrNameIndices, " << TargetName << "InstrNameData, "
-     << NumberedInstructions.size() << ");\n}\n";
+     << NumberedInstructions.size() << ");\n}\n"
+     << ClassName << "::~" << ClassName << "() {}\n";
   OS << "} // End llvm namespace \n";
 
   OS << "} // End llvm namespace \n";
 
-  OS << "#endif // GET_INSTRINFO_CTOR\n\n";
+  OS << "#endif // GET_INSTRINFO_CTOR_DTOR\n\n";
 
   emitOperandNameMappings(OS, Target, NumberedInstructions);
 }
 
   emitOperandNameMappings(OS, Target, NumberedInstructions);
 }
index 3e5c38cf0a51bf45e919ebda3834353d14f36df8..0df8c32d9114bba5d93a5f920bd38ebf50e9c3ab 100644 (file)
@@ -27,14 +27,16 @@ typedef SetTheory::RecVec RecVec;
 
 // (add a, b, ...) Evaluate and union all arguments.
 struct AddOp : public SetTheory::Operator {
 
 // (add a, b, ...) Evaluate and union all arguments.
 struct AddOp : public SetTheory::Operator {
-  void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef<SMLoc> Loc) {
+  virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
+                     ArrayRef<SMLoc> Loc) {
     ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts, Loc);
   }
 };
 
 // (sub Add, Sub, ...) Set difference.
 struct SubOp : public SetTheory::Operator {
     ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts, Loc);
   }
 };
 
 // (sub Add, Sub, ...) Set difference.
 struct SubOp : public SetTheory::Operator {
-  void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef<SMLoc> Loc) {
+  virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
+                     ArrayRef<SMLoc> Loc) {
     if (Expr->arg_size() < 2)
       PrintFatalError(Loc, "Set difference needs at least two arguments: " +
         Expr->getAsString());
     if (Expr->arg_size() < 2)
       PrintFatalError(Loc, "Set difference needs at least two arguments: " +
         Expr->getAsString());
@@ -49,7 +51,8 @@ struct SubOp : public SetTheory::Operator {
 
 // (and S1, S2) Set intersection.
 struct AndOp : public SetTheory::Operator {
 
 // (and S1, S2) Set intersection.
 struct AndOp : public SetTheory::Operator {
-  void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef<SMLoc> Loc) {
+  virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
+                     ArrayRef<SMLoc> Loc) {
     if (Expr->arg_size() != 2)
       PrintFatalError(Loc, "Set intersection requires two arguments: " +
         Expr->getAsString());
     if (Expr->arg_size() != 2)
       PrintFatalError(Loc, "Set intersection requires two arguments: " +
         Expr->getAsString());
@@ -68,7 +71,8 @@ struct SetIntBinOp : public SetTheory::Operator {
                      RecSet &Set, int64_t N,
                      RecSet &Elts, ArrayRef<SMLoc> Loc) =0;
 
                      RecSet &Set, int64_t N,
                      RecSet &Elts, ArrayRef<SMLoc> Loc) =0;
 
-  void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef<SMLoc> Loc) {
+  virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
+                     ArrayRef<SMLoc> Loc) {
     if (Expr->arg_size() != 2)
       PrintFatalError(Loc, "Operator requires (Op Set, Int) arguments: " +
         Expr->getAsString());
     if (Expr->arg_size() != 2)
       PrintFatalError(Loc, "Operator requires (Op Set, Int) arguments: " +
         Expr->getAsString());
@@ -84,9 +88,9 @@ struct SetIntBinOp : public SetTheory::Operator {
 
 // (shl S, N) Shift left, remove the first N elements.
 struct ShlOp : public SetIntBinOp {
 
 // (shl S, N) Shift left, remove the first N elements.
 struct ShlOp : public SetIntBinOp {
-  void apply2(SetTheory &ST, DagInit *Expr,
-             RecSet &Set, int64_t N,
-             RecSet &Elts, ArrayRef<SMLoc> Loc) {
+  virtual void apply2(SetTheory &ST, DagInit *Expr,
+                      RecSet &Set, int64_t N,
+                      RecSet &Elts, ArrayRef<SMLoc> Loc) {
     if (N < 0)
       PrintFatalError(Loc, "Positive shift required: " +
         Expr->getAsString());
     if (N < 0)
       PrintFatalError(Loc, "Positive shift required: " +
         Expr->getAsString());
@@ -97,9 +101,9 @@ struct ShlOp : public SetIntBinOp {
 
 // (trunc S, N) Truncate after the first N elements.
 struct TruncOp : public SetIntBinOp {
 
 // (trunc S, N) Truncate after the first N elements.
 struct TruncOp : public SetIntBinOp {
-  void apply2(SetTheory &ST, DagInit *Expr,
-             RecSet &Set, int64_t N,
-             RecSet &Elts, ArrayRef<SMLoc> Loc) {
+  virtual void apply2(SetTheory &ST, DagInit *Expr,
+                      RecSet &Set, int64_t N,
+                      RecSet &Elts, ArrayRef<SMLoc> Loc) {
     if (N < 0)
       PrintFatalError(Loc, "Positive length required: " +
         Expr->getAsString());
     if (N < 0)
       PrintFatalError(Loc, "Positive length required: " +
         Expr->getAsString());
@@ -115,9 +119,9 @@ struct RotOp : public SetIntBinOp {
 
   RotOp(bool Rev) : Reverse(Rev) {}
 
 
   RotOp(bool Rev) : Reverse(Rev) {}
 
-  void apply2(SetTheory &ST, DagInit *Expr,
-             RecSet &Set, int64_t N,
-             RecSet &Elts, ArrayRef<SMLoc> Loc) {
+  virtual void apply2(SetTheory &ST, DagInit *Expr,
+                      RecSet &Set, int64_t N,
+                      RecSet &Elts, ArrayRef<SMLoc> Loc) {
     if (Reverse)
       N = -N;
     // N > 0 -> rotate left, N < 0 -> rotate right.
     if (Reverse)
       N = -N;
     // N > 0 -> rotate left, N < 0 -> rotate right.
@@ -134,9 +138,9 @@ struct RotOp : public SetIntBinOp {
 
 // (decimate S, N) Pick every N'th element of S.
 struct DecimateOp : public SetIntBinOp {
 
 // (decimate S, N) Pick every N'th element of S.
 struct DecimateOp : public SetIntBinOp {
-  void apply2(SetTheory &ST, DagInit *Expr,
-             RecSet &Set, int64_t N,
-             RecSet &Elts, ArrayRef<SMLoc> Loc) {
+  virtual void apply2(SetTheory &ST, DagInit *Expr,
+                      RecSet &Set, int64_t N,
+                      RecSet &Elts, ArrayRef<SMLoc> Loc) {
     if (N <= 0)
       PrintFatalError(Loc, "Positive stride required: " +
         Expr->getAsString());
     if (N <= 0)
       PrintFatalError(Loc, "Positive stride required: " +
         Expr->getAsString());
@@ -147,7 +151,8 @@ struct DecimateOp : public SetIntBinOp {
 
 // (interleave S1, S2, ...) Interleave elements of the arguments.
 struct InterleaveOp : public SetTheory::Operator {
 
 // (interleave S1, S2, ...) Interleave elements of the arguments.
 struct InterleaveOp : public SetTheory::Operator {
-  void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef<SMLoc> Loc) {
+  virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
+                     ArrayRef<SMLoc> Loc) {
     // Evaluate the arguments individually.
     SmallVector<RecSet, 4> Args(Expr->getNumArgs());
     unsigned MaxSize = 0;
     // Evaluate the arguments individually.
     SmallVector<RecSet, 4> Args(Expr->getNumArgs());
     unsigned MaxSize = 0;
@@ -165,7 +170,8 @@ struct InterleaveOp : public SetTheory::Operator {
 
 // (sequence "Format", From, To) Generate a sequence of records by name.
 struct SequenceOp : public SetTheory::Operator {
 
 // (sequence "Format", From, To) Generate a sequence of records by name.
 struct SequenceOp : public SetTheory::Operator {
-  void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef<SMLoc> Loc) {
+  virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
+                     ArrayRef<SMLoc> Loc) {
     int Step = 1;
     if (Expr->arg_size() > 4)
       PrintFatalError(Loc, "Bad args to (sequence \"Format\", From, To): " +
     int Step = 1;
     if (Expr->arg_size() > 4)
       PrintFatalError(Loc, "Bad args to (sequence \"Format\", From, To): " +
@@ -232,15 +238,16 @@ struct FieldExpander : public SetTheory::Expander {
 
   FieldExpander(StringRef fn) : FieldName(fn) {}
 
 
   FieldExpander(StringRef fn) : FieldName(fn) {}
 
-  void expand(SetTheory &ST, Record *Def, RecSet &Elts) {
+  virtual void expand(SetTheory &ST, Record *Def, RecSet &Elts) {
     ST.evaluate(Def->getValueInit(FieldName), Elts, Def->getLoc());
   }
 };
 } // end anonymous namespace
 
     ST.evaluate(Def->getValueInit(FieldName), Elts, Def->getLoc());
   }
 };
 } // end anonymous namespace
 
-void SetTheory::Operator::anchor() { }
+// pin vtables to this file
+void SetTheory::Operator::anchor() {}
+void SetTheory::Expander::anchor() {}
 
 
-void SetTheory::Expander::anchor() { }
 
 SetTheory::SetTheory() {
   addOperator("add", new AddOp);
 
 SetTheory::SetTheory() {
   addOperator("add", new AddOp);
index 3ac71a49147f41ce1ce7970d4a07b6534ce119ac..81c0d4c544fc99f17f43b870db6e390886f63ff4 100644 (file)
@@ -35,9 +35,11 @@ public:
   }
   Type(TypeKind K) : Kind(K) {}
   virtual unsigned getSizeInBits() const = 0;
   }
   Type(TypeKind K) : Kind(K) {}
   virtual unsigned getSizeInBits() const = 0;
-  virtual ~Type() {}
+  virtual ~Type();
 };
 
 };
 
+Type::~Type() {}
+
 }
 
 class ExtendedIntegerType : public Type {
 }
 
 class ExtendedIntegerType : public Type {
@@ -45,10 +47,11 @@ class ExtendedIntegerType : public Type {
 public:
   explicit ExtendedIntegerType(unsigned bits)
     : Type(TK_ExtendedIntegerType), BitWidth(bits) {}
 public:
   explicit ExtendedIntegerType(unsigned bits)
     : Type(TK_ExtendedIntegerType), BitWidth(bits) {}
+  virtual ~ExtendedIntegerType();
   static bool classof(const Type *T) {
     return T->getKind() == TK_ExtendedIntegerType;
   }
   static bool classof(const Type *T) {
     return T->getKind() == TK_ExtendedIntegerType;
   }
-  unsigned getSizeInBits() const {
+  virtual unsigned getSizeInBits() const {
     return getBitWidth();
   }
   unsigned getBitWidth() const {
     return getBitWidth();
   }
   unsigned getBitWidth() const {
@@ -56,16 +59,20 @@ public:
   }
 };
 
   }
 };
 
+ExtendedIntegerType::~ExtendedIntegerType() {}
+
+
 class ExtendedVectorType : public Type {
   EVT ElementType;
   unsigned NumElements;
 public:
   ExtendedVectorType(EVT elty, unsigned num)
     : Type(TK_ExtendedVectorType), ElementType(elty), NumElements(num) {}
 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;
   }
   static bool classof(const Type *T) {
     return T->getKind() == TK_ExtendedVectorType;
   }
-  unsigned getSizeInBits() const {
+  virtual unsigned getSizeInBits() const {
     return getNumElements() * getElementType().getSizeInBits();
   }
   EVT getElementType() const {
     return getNumElements() * getElementType().getSizeInBits();
   }
   EVT getElementType() const {
@@ -76,6 +83,9 @@ public:
   }
 };
 
   }
 };
 
+ExtendedVectorType::~ExtendedVectorType() {}
+
+
 static std::map<unsigned, const Type *>
   ExtendedIntegerTypeMap;
 static std::map<std::pair<uintptr_t, uintptr_t>, const Type *>
 static std::map<unsigned, const Type *>
   ExtendedIntegerTypeMap;
 static std::map<std::pair<uintptr_t, uintptr_t>, const Type *>
index 8aeea14984e06f90f4eebf6b78e6e473c470393f..98e8b844915d17aff9336835e01cc04e1c17af70 100644 (file)
@@ -142,7 +142,7 @@ class GTEST_API_ TestPartResultArray {
 // This interface knows how to report a test part result.
 class TestPartResultReporterInterface {
  public:
 // This interface knows how to report a test part result.
 class TestPartResultReporterInterface {
  public:
-  virtual ~TestPartResultReporterInterface() {}
+  virtual ~TestPartResultReporterInterface();
 
   virtual void ReportTestPartResult(const TestPartResult& result) = 0;
 };
 
   virtual void ReportTestPartResult(const TestPartResult& result) = 0;
 };
index 1734c4432e1c49b4093962140f0ff474edf11dd2..07ed92b57c0dca8caa1520c6cf680cec116cb53c 100644 (file)
@@ -910,7 +910,7 @@ class GTEST_API_ TestCase {
 class Environment {
  public:
   // The d'tor is virtual as we need to subclass Environment.
 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() {}
 
   // 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:
 // 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;
 
   // Fired before any test activity starts.
   virtual void OnTestProgramStart(const UnitTest& unit_test) = 0;
@@ -980,6 +980,7 @@ class TestEventListener {
 // comments about each method please see the definition of TestEventListener
 // above.
 class EmptyTestEventListener : public 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*/,
  public:
   virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}
   virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,
index 7bac2bd872bb28772288f9d7d8e905d97b0a39f4..8d53c4528078bf9ba6c181b8a711961dcb5588da 100644 (file)
@@ -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();
   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 {
 
   // 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:
 // 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;
 };
   virtual bool Create(const char* statement, const RE* regex,
                       const char* file, int line, DeathTest** test) = 0;
 };
index a94bf28421fb4e363874b588d4b7fb76b11a5406..63f72acdfb572592997bf02e5c879b932cdf5bfd 100644 (file)
 #if !GTEST_NO_LLVM_RAW_OSTREAM
 namespace llvm {
 class convertible_fwd_ostream : public std::ostream {
 #if !GTEST_NO_LLVM_RAW_OSTREAM
 namespace llvm {
 class convertible_fwd_ostream : public std::ostream {
+  virtual void anchor();
   raw_os_ostream ros_;
 
 public:
   raw_os_ostream ros_;
 
 public:
@@ -536,7 +537,7 @@ GTEST_API_ TypeId GetTestTypeId();
 // of a Test object.
 class TestFactoryBase {
  public:
 // 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()
 
   // Creates a test instance to run. The instance is both created and destroyed
   // within TestInfoImpl::Run()
index 0ef9718cf43a926d399ccd597c51fc9cb5476a60..3bb2ffb3556666eddd434588ef3179c2ade697b4 100644 (file)
@@ -414,7 +414,7 @@ class TestMetaFactory
 // and calls RegisterTests() on each of them when asked.
 class ParameterizedTestCaseInfoBase {
  public:
 // 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;
 
   // Base part of test case name for display purposes.
   virtual const string& GetTestCaseName() const = 0;
index 58f6cafa75fb1f911858eca78e6466d92e26e029..32fd9c65bfeabdc94473896a06c8fbe9d6e2fe4b 100644 (file)
@@ -1116,7 +1116,7 @@ class Notification {
 // problem.
 class ThreadWithParamBase {
  public:
 // problem.
 class ThreadWithParamBase {
  public:
-  virtual ~ThreadWithParamBase() {}
+  virtual ~ThreadWithParamBase();
   virtual void Run() = 0;
 };
 
   virtual void Run() = 0;
 };
 
@@ -1290,7 +1290,7 @@ typedef GTestMutexLock MutexLock;
 // ThreadLocalValueHolderBase.
 class ThreadLocalValueHolderBase {
  public:
 // ThreadLocalValueHolderBase.
 class ThreadLocalValueHolderBase {
  public:
-  virtual ~ThreadLocalValueHolderBase() {}
+  virtual ~ThreadLocalValueHolderBase();
 };
 
 // Called by pthread to delete thread-local data stored by
 };
 
 // Called by pthread to delete thread-local data stored by
index 82453f20fd5ee1a70cf0ddde07858a2be8400129..b66325e2b6216e0d10bac9ee27793ab07bd5ab9c 100644 (file)
@@ -300,6 +300,8 @@ 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,
 // Creates and returns a death test by dispatching to the current
 // death test factory.
 bool DeathTest::Create(const char* statement, const RE* regex,
@@ -733,6 +735,8 @@ DeathTest::TestRole WindowsDeathTest::AssumeRole() {
 }
 # else  // We are not on Windows.
 
 }
 # else  // We are not on Windows.
 
+DeathTestFactory::~DeathTestFactory() {}
+
 // ForkingDeathTest provides implementations for most of the abstract
 // methods of the DeathTest interface.  Only the AssumeRole method is
 // left undefined.
 // ForkingDeathTest provides implementations for most of the abstract
 // methods of the DeathTest interface.  Only the AssumeRole method is
 // left undefined.
index 6554cfc07e619a79971822f7c6693e8fedaf4281..1bae630127b52a449e0d0d26f9abb5ff42d7b35f 100644 (file)
@@ -408,7 +408,7 @@ GTEST_API_ FilePath GetCurrentExecutableName();
 class OsStackTraceGetterInterface {
  public:
   OsStackTraceGetterInterface() {}
 class OsStackTraceGetterInterface {
  public:
   OsStackTraceGetterInterface() {}
-  virtual ~OsStackTraceGetterInterface() {}
+  virtual ~OsStackTraceGetterInterface();
 
   // Returns the current OS stack trace as a String.  Parameters:
   //
 
   // Returns the current OS stack trace as a String.  Parameters:
   //
index 745956247a6e0b67682af7d3abc1f0d10585d8ed..382985e6b858530cd072b51f97ef1ae566a06e89 100644 (file)
@@ -746,5 +746,15 @@ const char* StringFromGTestEnv(const char* flag, const char* default_value) {
   return value == NULL ? default_value : value;
 }
 
   return value == NULL ? default_value : value;
 }
 
+ThreadWithParamBase::~ThreadWithParamBase() {}
+ThreadLocalValueHolderBase::~ThreadLocalValueHolderBase() {}
+TestFactoryBase::~TestFactoryBase() {}
+
 }  // namespace internal
 }  // namespace testing
 }  // namespace internal
 }  // namespace testing
+
+#if !GTEST_NO_LLVM_RAW_OSTREAM
+namespace llvm {
+void convertible_fwd_ostream::anchor() {}
+}
+#endif
index 9891928048aba2c86101acf3a420ec79e8e4bf9c..ca814d1abb172a377720bcecf321fd0ef29b6426 100644 (file)
@@ -4863,4 +4863,13 @@ void InitGoogleTest(int* argc, wchar_t** argv) {
   internal::InitGoogleTestImpl(argc, argv);
 }
 
   internal::InitGoogleTestImpl(argc, argv);
 }
 
+Environment::~Environment() {}
+TestPartResultReporterInterface::~TestPartResultReporterInterface() {}
+TestEventListener::~TestEventListener() {}
+void EmptyTestEventListener::anchor() {}
+namespace internal {
+OsStackTraceGetterInterface::~OsStackTraceGetterInterface() {}
+ParameterizedTestCaseInfoBase::~ParameterizedTestCaseInfoBase() {}
+}
+
 }  // namespace testing
 }  // namespace testing