From 1cd4c7294c9873d7208aab5227bc27cdf8011b2e Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 26 Feb 2004 07:24:18 +0000 Subject: Make sure that at least one virtual method is defined in a .cpp file to avoid 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 | 11 ++--------- include/llvm/AbstractTypeUser.h | 2 +- include/llvm/Support/Annotation.h | 11 ++--------- lib/Support/Annotation.cpp | 13 ++++++++++++- lib/VMCore/Type.cpp | 1 + 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/include/Support/Annotation.h b/include/Support/Annotation.h index cee7ab7..9bd442a 100644 --- a/include/Support/Annotation.h +++ b/include/Support/Annotation.h @@ -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 diff --git a/include/llvm/AbstractTypeUser.h b/include/llvm/AbstractTypeUser.h index d211165..f039eb8 100644 --- a/include/llvm/AbstractTypeUser.h +++ b/include/llvm/AbstractTypeUser.h @@ -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 diff --git a/include/llvm/Support/Annotation.h b/include/llvm/Support/Annotation.h index cee7ab7..9bd442a 100644 --- a/include/llvm/Support/Annotation.h +++ b/include/llvm/Support/Annotation.h @@ -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 diff --git a/lib/Support/Annotation.cpp b/lib/Support/Annotation.cpp index bcd196d..45fd06f 100644 --- a/lib/Support/Annotation.cpp +++ b/lib/Support/Annotation.cpp @@ -15,6 +15,18 @@ #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 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()) { diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index c863e52..1d265e1 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -26,6 +26,7 @@ using namespace llvm; // //#define DEBUG_MERGE_TYPES 1 +AbstractTypeUser::~AbstractTypeUser() {} //===----------------------------------------------------------------------===// // Type Class Implementation -- cgit v1.1