Revert "Disable LeakSanitizer in TableGen binaries, see PR18325"
[oota-llvm.git] / utils / TableGen / TGValueTypes.cpp
index 07400cf7447b528a187f5c90f1b645a8e7539c91..f4893f50a6ff86032509a8b998f4cf39e5ae33d7 100644 (file)
@@ -35,11 +35,15 @@ public:
   }
   Type(TypeKind K) : Kind(K) {}
   virtual unsigned getSizeInBits() const = 0;
-  virtual ~Type() {}
+  virtual ~Type();
 };
 
+// Provide out-of-line definition to prevent weak vtable.
+Type::~Type() {}
+
 }
 
+namespace {
 class ExtendedIntegerType : public Type {
   unsigned BitWidth;
 public:
@@ -47,8 +51,8 @@ public:
     : Type(TK_ExtendedIntegerType), BitWidth(bits) {}
   static bool classof(const Type *T) {
     return T->getKind() == TK_ExtendedIntegerType;
-  };
-  unsigned getSizeInBits() const {
+  }
+  virtual unsigned getSizeInBits() const {
     return getBitWidth();
   }
   unsigned getBitWidth() const {
@@ -64,8 +68,8 @@ public:
     : Type(TK_ExtendedVectorType), ElementType(elty), NumElements(num) {}
   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 {
@@ -75,6 +79,7 @@ public:
     return NumElements;
   }
 };
+} // end anonymous namespace
 
 static std::map<unsigned, const Type *>
   ExtendedIntegerTypeMap;