Make sure that at least one virtual method is defined in a .cpp file to avoid
authorChris Lattner <sabre@nondot.org>
Thu, 26 Feb 2004 07:24:18 +0000 (07:24 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 26 Feb 2004 07:24:18 +0000 (07:24 +0000)
having the compiler emit RTTI and vtables to EVERY translation unit.

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

include/Support/Annotation.h
include/llvm/AbstractTypeUser.h
include/llvm/Support/Annotation.h
lib/Support/Annotation.cpp
lib/VMCore/Type.cpp

index cee7ab7d8936ce8ef7c17d27031b263684a4394e..9bd442a6c96540e87c95546895aa2ee28069796b 100644 (file)
@@ -68,7 +68,7 @@ class Annotation {
   Annotation *Next;        // The next annotation in the linked list
 public:
   inline Annotation(AnnotationID id) : ID(id), Next(0) {}
-  virtual ~Annotation() {}  // Designed to be subclassed
+  virtual ~Annotation();  // Designed to be subclassed
 
   // getID - Return the unique ID# of this annotation
   inline AnnotationID getID() const { return ID; }
@@ -95,14 +95,7 @@ class Annotable {
   void operator=(const Annotable &);   // Do not implement
 public:
   Annotable() : AnnotationList(0) {}
-  virtual ~Annotable() {   // Virtual because it's designed to be subclassed...
-    Annotation *A = AnnotationList;
-    while (A) {
-      Annotation *Next = A->getNext();
-      delete A;
-      A = Next;
-    }
-  }
+  virtual ~Annotable();    // Virtual because it's designed to be subclassed...
 
   // getAnnotation - Search the list for annotations of the specified ID.  The
   // pointer returned is either null (if no annotations of the specified ID
index d21116539419235e99acfec25e859edb79116526..f039eb85862360f765080e90f705ad29eb09a060 100644 (file)
@@ -44,7 +44,7 @@ class DerivedType;
 
 class AbstractTypeUser {
 protected:
-  virtual ~AbstractTypeUser() {}                        // Derive from me
+  virtual ~AbstractTypeUser();                        // Derive from me
 public:
 
   /// refineAbstractType - The callback method invoked when an abstract type is
index cee7ab7d8936ce8ef7c17d27031b263684a4394e..9bd442a6c96540e87c95546895aa2ee28069796b 100644 (file)
@@ -68,7 +68,7 @@ class Annotation {
   Annotation *Next;        // The next annotation in the linked list
 public:
   inline Annotation(AnnotationID id) : ID(id), Next(0) {}
-  virtual ~Annotation() {}  // Designed to be subclassed
+  virtual ~Annotation();  // Designed to be subclassed
 
   // getID - Return the unique ID# of this annotation
   inline AnnotationID getID() const { return ID; }
@@ -95,14 +95,7 @@ class Annotable {
   void operator=(const Annotable &);   // Do not implement
 public:
   Annotable() : AnnotationList(0) {}
-  virtual ~Annotable() {   // Virtual because it's designed to be subclassed...
-    Annotation *A = AnnotationList;
-    while (A) {
-      Annotation *Next = A->getNext();
-      delete A;
-      A = Next;
-    }
-  }
+  virtual ~Annotable();    // Virtual because it's designed to be subclassed...
 
   // getAnnotation - Search the list for annotations of the specified ID.  The
   // pointer returned is either null (if no annotations of the specified ID
index bcd196da44881ab1fe5c73979866747ce6e17a58..45fd06f92e2fc4b14b22b6d044f71ce8027d374e 100644 (file)
 #include "Support/Annotation.h"
 using namespace llvm;
 
+Annotation::~Annotation() {}  // Designed to be subclassed
+
+Annotable::~Annotable() {   // Virtual because it's designed to be subclassed...
+  Annotation *A = AnnotationList;
+  while (A) {
+    Annotation *Next = A->getNext();
+    delete A;
+    A = Next;
+  }
+}
+
+
 typedef std::map<const std::string, unsigned> IDMapType;
 static unsigned IDCounter = 0;  // Unique ID counter
 
@@ -41,7 +53,6 @@ static void eraseFromFactMap(unsigned ID) {
   }
 }
 
-
 AnnotationID AnnotationManager::getID(const std::string &Name) {  // Name -> ID
   IDMapType::iterator I = getIDMap().find(Name);
   if (I == getIDMap().end()) {
index c863e52f9f5befa1f67a55e8d58370e13859764f..1d265e1dd20ee2da4c0d763aade3fe0d17a7cad2 100644 (file)
@@ -26,6 +26,7 @@ using namespace llvm;
 //
 //#define DEBUG_MERGE_TYPES 1
 
+AbstractTypeUser::~AbstractTypeUser() {}
 
 //===----------------------------------------------------------------------===//
 //                         Type Class Implementation