mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Tighten up checking on SymbolTable interface to make it illegal to pass a
Type* where a Value* is expected. llvm-svn: 13794
This commit is contained in:
parent
edff018f18
commit
e4f0ec88eb
@ -165,8 +165,9 @@ public:
|
|||||||
/// @brief Insert a constant or type.
|
/// @brief Insert a constant or type.
|
||||||
inline void insert(const std::string &Name, Value *Val) {
|
inline void insert(const std::string &Name, Value *Val) {
|
||||||
assert(Val && "Can't insert null type into symbol table!");
|
assert(Val && "Can't insert null type into symbol table!");
|
||||||
assert((isa<Type>(Val) || isa<Constant>(Val)) &&
|
assert(!isa<Type>(Val) && "Cannot insert types with this interface!");
|
||||||
"Can only insert types and constants into a symbol table!");
|
assert(isa<Constant>(Val) &&
|
||||||
|
"Can only insert constants into a symbol table!");
|
||||||
insertEntry(Name, Val->getType(), Val);
|
insertEntry(Name, Val->getType(), Val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,6 +202,7 @@ public:
|
|||||||
/// @brief Remove a constant or type from the symbol table.
|
/// @brief Remove a constant or type from the symbol table.
|
||||||
inline Value* remove(const std::string &Name, Value *Val) {
|
inline Value* remove(const std::string &Name, Value *Val) {
|
||||||
assert(Val && "Can't remove null value from symbol table!");
|
assert(Val && "Can't remove null value from symbol table!");
|
||||||
|
assert(!isa<Type>(Val) && "Can't remove types with this interface!");
|
||||||
plane_iterator PI = pmap.find(Val->getType());
|
plane_iterator PI = pmap.find(Val->getType());
|
||||||
return removeEntry(PI, PI->second.find(Name));
|
return removeEntry(PI, PI->second.find(Name));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user