зеркало из https://github.com/microsoft/clang-1.git
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:
Родитель
da83bac90a
Коммит
edc66f3ab0
|
@ -203,15 +203,11 @@ Parser::DeclTy *Parser::ParseObjCAtInterfaceDeclaration(
|
||||||
/// has been capitalized.
|
/// has been capitalized.
|
||||||
static IdentifierInfo *constructSetterName(IdentifierTable &Idents,
|
static IdentifierInfo *constructSetterName(IdentifierTable &Idents,
|
||||||
const IdentifierInfo *Name) {
|
const IdentifierInfo *Name) {
|
||||||
unsigned N = Name->getLength();
|
llvm::SmallString<100> SelectorName;
|
||||||
char *SelectorName = new char[3 + N];
|
SelectorName += "set";
|
||||||
memcpy(SelectorName, "set", 3);
|
SelectorName.append(Name->getName(), Name->getName()+Name->getLength());
|
||||||
memcpy(&SelectorName[3], Name->getName(), N);
|
|
||||||
SelectorName[3] = toupper(SelectorName[3]);
|
SelectorName[3] = toupper(SelectorName[3]);
|
||||||
|
return &Idents.get(&SelectorName[0], &SelectorName[SelectorName.size()]);
|
||||||
IdentifierInfo *Setter = &Idents.get(SelectorName, &SelectorName[3 + N]);
|
|
||||||
delete[] SelectorName;
|
|
||||||
return Setter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// objc-interface-decl-list:
|
/// objc-interface-decl-list:
|
||||||
|
|
Загрузка…
Ссылка в новой задаче