revert r78048, it isn't worth using assertingvh here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78119 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2009-08-04 23:07:12 +00:00
parent 00e6df91db
commit 4f95d2bda4
4 changed files with 11 additions and 12 deletions

View File

@@ -38,7 +38,7 @@ class TypeSymbolTable;
template<typename ValueTy> class StringMapEntry; template<typename ValueTy> class StringMapEntry;
template <typename ValueTy = Value> template <typename ValueTy = Value>
class AssertingVH; class AssertingVH;
typedef StringMapEntry<AssertingVH<> > ValueName; typedef StringMapEntry<Value*> ValueName;
class raw_ostream; class raw_ostream;
class AssemblyAnnotationWriter; class AssemblyAnnotationWriter;
class ValueHandleBase; class ValueHandleBase;

View File

@@ -17,7 +17,6 @@
#include "llvm/Value.h" #include "llvm/Value.h"
#include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringMap.h"
#include "llvm/Support/DataTypes.h" #include "llvm/Support/DataTypes.h"
#include "llvm/Support/ValueHandle.h"
namespace llvm { namespace llvm {
template<typename ValueSubClass, typename ItemParentClass> template<typename ValueSubClass, typename ItemParentClass>
@@ -45,7 +44,7 @@ class ValueSymbolTable {
/// @{ /// @{
public: public:
/// @brief A mapping of names to values. /// @brief A mapping of names to values.
typedef StringMap<AssertingVH<> > ValueMap; typedef StringMap<Value*> ValueMap;
/// @brief An iterator over a ValueMap. /// @brief An iterator over a ValueMap.
typedef ValueMap::iterator iterator; typedef ValueMap::iterator iterator;

View File

@@ -1088,7 +1088,7 @@ static void WriteValueSymbolTable(const ValueSymbolTable &VST,
// VST_ENTRY: [valueid, namechar x N] // VST_ENTRY: [valueid, namechar x N]
// VST_BBENTRY: [bbid, namechar x N] // VST_BBENTRY: [bbid, namechar x N]
unsigned Code; unsigned Code;
if (isa<BasicBlock>(*SI->getValue())) { if (isa<BasicBlock>(SI->getValue())) {
Code = bitc::VST_CODE_BBENTRY; Code = bitc::VST_CODE_BBENTRY;
if (isChar6) if (isChar6)
AbbrevToUse = VST_BBENTRY_6_ABBREV; AbbrevToUse = VST_BBENTRY_6_ABBREV;

View File

@@ -57,14 +57,6 @@ Value::Value(const Type *ty, unsigned scid)
} }
Value::~Value() { Value::~Value() {
// If this value is named, destroy the name. This should not be in a symtab
// at this point.
if (Name)
Name->Destroy();
// There should be no uses of this object anymore, remove it.
LeakDetector::removeGarbageObject(this);
// Notify all ValueHandles (if present) that this value is going away. // Notify all ValueHandles (if present) that this value is going away.
if (HasValueHandle) if (HasValueHandle)
ValueHandleBase::ValueIsDeleted(this); ValueHandleBase::ValueIsDeleted(this);
@@ -84,6 +76,14 @@ Value::~Value() {
} }
#endif #endif
assert(use_empty() && "Uses remain when a value is destroyed!"); assert(use_empty() && "Uses remain when a value is destroyed!");
// If this value is named, destroy the name. This should not be in a symtab
// at this point.
if (Name)
Name->Destroy();
// There should be no uses of this object anymore, remove it.
LeakDetector::removeGarbageObject(this);
} }
/// hasNUses - Return true if this Value has exactly N users. /// hasNUses - Return true if this Value has exactly N users.