Simplify SelectorTable::constructSetterName() usage...

llvm-svn: 66551
This commit is contained in:
Steve Naroff 2009-03-10 17:24:38 +00:00
parent 869b6bfd0b
commit c7597f8efa
4 changed files with 17 additions and 14 deletions

View File

@ -435,13 +435,16 @@ public:
/// constructSetterName - Return the setter name for the given
/// identifier, i.e. "set" + Name where the initial character of Name
/// has been capitalized.
static IdentifierInfo *constructSetterName(IdentifierTable &Idents,
const IdentifierInfo *Name) {
static Selector constructSetterName(IdentifierTable &Idents,
SelectorTable &SelTable,
const IdentifierInfo *Name) {
llvm::SmallString<100> SelectorName;
SelectorName = "set";
SelectorName.append(Name->getName(), Name->getName()+Name->getLength());
SelectorName[3] = toupper(SelectorName[3]);
return &Idents.get(&SelectorName[0], &SelectorName[SelectorName.size()]);
IdentifierInfo *SetterName =
&Idents.get(&SelectorName[0], &SelectorName[SelectorName.size()]);
return SelTable.getUnarySelector(SetterName);
}
// Emit - Emit a SelectorTable to bitcode.

View File

@ -328,11 +328,12 @@ void Parser::ParseObjCInterfaceDeclList(DeclTy *interfaceDecl,
PP.getSelectorTable().getNullarySelector(SelName);
IdentifierInfo *SetterName = OCDS.getSetterName();
if (!SetterName)
SetterName =
SelectorTable::constructSetterName(PP.getIdentifierTable(),
FD.D.getIdentifier());
SetterName = FD.D.getIdentifier();
Selector SetterSel =
PP.getSelectorTable().getUnarySelector(SetterName);
SelectorTable::constructSetterName(PP.getIdentifierTable(),
PP.getSelectorTable(),
SetterName);
bool isOverridingProperty = false;
DeclTy *Property = Actions.ActOnProperty(CurScope, AtLoc, FD, OCDS,
GetterSel, SetterSel,

View File

@ -1886,10 +1886,9 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc,
// If we found a getter then this may be a valid dot-reference, we
// will look for the matching setter, in case it is needed.
IdentifierInfo *SetterName =
SelectorTable::constructSetterName(PP.getIdentifierTable(), &Member);
Selector SetterSel = PP.getSelectorTable().getUnarySelector(SetterName);
Selector SetterSel =
SelectorTable::constructSetterName(PP.getIdentifierTable(),
PP.getSelectorTable(), &Member);
ObjCMethodDecl *Setter = IFace->lookupInstanceMethod(SetterSel);
if (!Setter) {
// If this reference is in an @implementation, also check for 'private'

View File

@ -298,10 +298,10 @@ Action::OwningExprResult Sema::ActOnClassPropertyRefExpr(
}
// Look for the matching setter, in case it is needed.
IdentifierInfo *SetterName =
SelectorTable::constructSetterName(PP.getIdentifierTable(), &propertyName);
Selector SetterSel =
SelectorTable::constructSetterName(PP.getIdentifierTable(),
PP.getSelectorTable(), &propertyName);
Selector SetterSel = PP.getSelectorTable().getUnarySelector(SetterName);
ObjCMethodDecl *Setter = IFace->lookupClassMethod(SetterSel);
if (!Setter) {
// If this reference is in an @implementation, also check for 'private'