Fix Name Check

Avoid a potential assert by asking for record names as strings explicitly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142503 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Greene 2011-10-19 13:02:48 +00:00
parent 7474c29d90
commit 0615d6aac8

View File

@ -1629,12 +1629,12 @@ public:
return I == Defs.end() ? 0 : I->second;
}
void addClass(Record *R) {
assert(getClass(R->getName()) == 0 && "Class already exists!");
Classes.insert(std::make_pair(R->getName(), R));
assert(getClass(R->getNameInitAsString()) == 0 && "Class already exists!");
Classes.insert(std::make_pair(R->getNameInitAsString(), R));
}
void addDef(Record *R) {
assert(getDef(R->getName()) == 0 && "Def already exists!");
Defs.insert(std::make_pair(R->getName(), R));
assert(getDef(R->getNameInitAsString()) == 0 && "Def already exists!");
Defs.insert(std::make_pair(R->getNameInitAsString(), R));
}
/// removeClass - Remove, but do not delete, the specified record.