Commit a1f9b051 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Fixed possible crash in CheckName

Done with: Erik Verbruggen
parent c7cd56c5
......@@ -378,12 +378,14 @@ bool CheckName::visit(TemplateIdAST *ast)
bool CheckName::visit(ObjCSelectorWithoutArgumentsAST *ast)
{
std::vector<Name *> names;
Identifier *id = control()->findOrInsertIdentifier(spell(ast->name_token));
NameId *nameId = control()->nameId(id);
names.push_back(nameId);
_name = control()->selectorNameId(&names[0], names.size(), false);
ast->selector_name = _name;
if (ast->name_token) {
std::vector<Name *> names;
Identifier *id = control()->findOrInsertIdentifier(spell(ast->name_token));
NameId *nameId = control()->nameId(id);
names.push_back(nameId);
_name = control()->selectorNameId(&names[0], names.size(), false);
ast->selector_name = _name;
}
return false;
}
......@@ -392,9 +394,14 @@ bool CheckName::visit(ObjCSelectorWithArgumentsAST *ast)
{
std::vector<Name *> names;
for (ObjCSelectorArgumentListAST *it = ast->selector_argument_list; it; it = it->next) {
Identifier *id = control()->findOrInsertIdentifier(spell(it->value->name_token));
NameId *nameId = control()->nameId(id);
names.push_back(nameId);
if (it->value->name_token) {
Identifier *id = control()->findOrInsertIdentifier(spell(it->value->name_token));
NameId *nameId = control()->nameId(id);
names.push_back(nameId);
} else {
// we have an incomplete name due, probably due to error recovery. So, back out completely
return false;
}
}
if (!names.empty()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment