Switch ValueDecl::getObjCSelector() and friends over to ObjCSelector.

Formatting names into strings repeatedly, and using those for semantic
analysis, is generally considered poor form. Additionally, use the
camelCase utilities to perform the string manipulation we need, and
cache results on the ObjCAttr so we don't repeatedly do string
manipulation.

Swift SVN r16334
This commit is contained in:
Doug Gregor
2014-04-14 22:02:51 +00:00
parent 204c7006c4
commit 53b84c121e
9 changed files with 157 additions and 155 deletions

View File

@@ -151,7 +151,8 @@ getDynamicResultSignature(ValueDecl *decl,
Type type;
if (auto func = dyn_cast<FuncDecl>(decl)) {
// Handle functions.
selector = func->getObjCSelector(buffer);
// FIXME: Use ObjCSelector here!
selector = func->getObjCSelector().getString(buffer);
type = decl->getType()->castTo<AnyFunctionType>()->getResult();
// Append a '+' for static methods, '-' for instance methods. This
@@ -165,11 +166,11 @@ getDynamicResultSignature(ValueDecl *decl,
selector = buffer.str();
} else if (auto asd = dyn_cast<AbstractStorageDecl>(decl)) {
// Handle properties and subscripts. Only the getter matters.
selector = asd->getObjCGetterSelector(buffer);
selector = asd->getObjCGetterSelector().getString(buffer);
type = asd->getType();
} else if (auto ctor = dyn_cast<ConstructorDecl>(decl)) {
// Handle constructors.
selector = ctor->getObjCSelector(buffer);
selector = ctor->getObjCSelector().getString(buffer);
type = decl->getType()->castTo<AnyFunctionType>()->getResult();
} else {
llvm_unreachable("Dynamic lookup found a non-[objc] result");