revert r78048, it isn't worth using assertingvh here.
authorChris Lattner <sabre@nondot.org>
Tue, 4 Aug 2009 23:07:12 +0000 (23:07 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 4 Aug 2009 23:07:12 +0000 (23:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78119 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Value.h
include/llvm/ValueSymbolTable.h
lib/Bitcode/Writer/BitcodeWriter.cpp
lib/VMCore/Value.cpp

index 83a523233bae7016c440bfe26bff9fc90a7f334c..3881e351da5277c66a8d75a6e6b354b6fd528616 100644 (file)
@@ -38,7 +38,7 @@ class TypeSymbolTable;
 template<typename ValueTy> class StringMapEntry;
 template <typename ValueTy = Value>
 class AssertingVH;
-typedef StringMapEntry<AssertingVH<> > ValueName;
+typedef StringMapEntry<Value*> ValueName;
 class raw_ostream;
 class AssemblyAnnotationWriter;
 class ValueHandleBase;
index 9b4ccbaf8f30121416548dc437aeba42f2ba8d07..4f8ebe800172a1b30a879753eef10f36170b8d79 100644 (file)
@@ -17,7 +17,6 @@
 #include "llvm/Value.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/Support/DataTypes.h"
-#include "llvm/Support/ValueHandle.h"
 
 namespace llvm {
   template<typename ValueSubClass, typename ItemParentClass>
@@ -45,7 +44,7 @@ class ValueSymbolTable {
 /// @{
 public:
   /// @brief A mapping of names to values.
-  typedef StringMap<AssertingVH<> > ValueMap;
+  typedef StringMap<Value*> ValueMap;
 
   /// @brief An iterator over a ValueMap.
   typedef ValueMap::iterator iterator;
index a5c28fcc763ae970c9ee363f34b3b5fa22e88c82..cb181d2810b94a784c6ef2933cd5e404245efdfa 100644 (file)
@@ -1088,7 +1088,7 @@ static void WriteValueSymbolTable(const ValueSymbolTable &VST,
     // VST_ENTRY:   [valueid, namechar x N]
     // VST_BBENTRY: [bbid, namechar x N]
     unsigned Code;
-    if (isa<BasicBlock>(*SI->getValue())) {
+    if (isa<BasicBlock>(SI->getValue())) {
       Code = bitc::VST_CODE_BBENTRY;
       if (isChar6)
         AbbrevToUse = VST_BBENTRY_6_ABBREV;
index 8710b9461e89f43755ae5a80a4aa1c0fbf3a8d80..2cdd55217cc4133c1af6495513b7c0073e4db3aa 100644 (file)
@@ -57,14 +57,6 @@ Value::Value(const Type *ty, unsigned scid)
 }
 
 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.
   if (HasValueHandle)
     ValueHandleBase::ValueIsDeleted(this);
@@ -84,6 +76,14 @@ Value::~Value() {
   }
 #endif
   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.