diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-05-25 15:20:47 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-05-25 15:20:47 +0000 |
commit | 875510805fd8fc2bfd2651b8f6e1f127cf3e616a (patch) | |
tree | 3528f1a878215339eaf49f1f4fdbbd5f2ca6cbbd | |
parent | 9231ac8b6f2c3f9877bdb7a223f7392061258ab6 (diff) | |
download | external_llvm-875510805fd8fc2bfd2651b8f6e1f127cf3e616a.zip external_llvm-875510805fd8fc2bfd2651b8f6e1f127cf3e616a.tar.gz external_llvm-875510805fd8fc2bfd2651b8f6e1f127cf3e616a.tar.bz2 |
Made it illegal to pass a Type* through one of the Value* interfaces. The
SymbolTable will now assert if this is done. This didn't find any incorrect
usage of SymbolTable but will prevent future mistakes until Type != Value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13755 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/VMCore/SymbolTable.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/VMCore/SymbolTable.cpp b/lib/VMCore/SymbolTable.cpp index dc2900e..9e6a77b 100644 --- a/lib/VMCore/SymbolTable.cpp +++ b/lib/VMCore/SymbolTable.cpp @@ -93,6 +93,7 @@ Type* SymbolTable::lookupType( const std::string& Name ) const { // Remove a value void SymbolTable::remove(Value *N) { assert(N->hasName() && "Value doesn't have name!"); + assert(!isa<Type>(N) && "Can't remove types through this interface."); if (InternallyInconsistent) return; plane_iterator PI = pmap.find(N->getType()); @@ -109,6 +110,7 @@ Value *SymbolTable::removeEntry(plane_iterator Plane, value_iterator Entry) { Entry != Plane->second.end() && "Invalid entry to remove!"); Value *Result = Entry->second; + assert(!isa<Type>(Result) && "Can't remove types through this interface."); const Type *Ty = Result->getType(); #if DEBUG_SYMBOL_TABLE dump(); @@ -181,6 +183,7 @@ Type* SymbolTable::removeEntry(type_iterator Entry) { // insertEntry - Insert a value into the symbol table with the specified name. void SymbolTable::insertEntry(const std::string &Name, const Type *VTy, Value *V) { + assert(!isa<Type>(V) && "Can't insert types through this interface."); // Check to see if there is a naming conflict. If so, rename this value! if (lookup(VTy, Name)) { std::string UniqueName = getUniqueName(VTy, Name); @@ -259,6 +262,7 @@ unsigned SymbolTable::type_size(const Type *Ty) const { // Get the name of a value std::string SymbolTable::get_name( const Value* V ) const { + assert(!isa<Type>(V) && "Can't get name of types through this interface."); value_const_iterator VI = this->value_begin( V->getType() ); value_const_iterator VE = this->value_end( V->getType() ); |