template<typename ValueTy> class StringMapEntry;
template <typename ValueTy = Value>
class AssertingVH;
-typedef StringMapEntry<Value*> ValueName;
+typedef StringMapEntry<AssertingVH<> > ValueName;
class raw_ostream;
class AssemblyAnnotationWriter;
class ValueHandleBase;
#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>
/// @{
public:
/// @brief A mapping of names to values.
- typedef StringMap<Value*> ValueMap;
+ typedef StringMap<AssertingVH<> > ValueMap;
/// @brief An iterator over a ValueMap.
typedef ValueMap::iterator iterator;
// 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;
}
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);
}
#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.