Use smallstring instead of new[]'ing a string. This simplifies

the code and speeds it up.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59604 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2008-11-19 07:41:27 +00:00
Родитель da83bac90a
Коммит edc66f3ab0
1 изменённых файлов: 4 добавлений и 8 удалений

Просмотреть файл

@ -203,15 +203,11 @@ Parser::DeclTy *Parser::ParseObjCAtInterfaceDeclaration(
/// has been capitalized.
static IdentifierInfo *constructSetterName(IdentifierTable &Idents,
const IdentifierInfo *Name) {
unsigned N = Name->getLength();
char *SelectorName = new char[3 + N];
memcpy(SelectorName, "set", 3);
memcpy(&SelectorName[3], Name->getName(), N);
llvm::SmallString<100> SelectorName;
SelectorName += "set";
SelectorName.append(Name->getName(), Name->getName()+Name->getLength());
SelectorName[3] = toupper(SelectorName[3]);
IdentifierInfo *Setter = &Idents.get(SelectorName, &SelectorName[3 + N]);
delete[] SelectorName;
return Setter;
return &Idents.get(&SelectorName[0], &SelectorName[SelectorName.size()]);
}
/// objc-interface-decl-list: