[NFC] Thread DeclNameRef through most of the compiler

This huge commit contains as many of the mechanical changes as possible.
This commit is contained in:
Brent Royal-Gordon
2019-12-10 19:46:10 -08:00
parent da88512eda
commit addbe3e5ed
66 changed files with 505 additions and 464 deletions

View File

@@ -232,7 +232,7 @@ getDynamicResultSignature(ValueDecl *decl) {
llvm_unreachable("Not a valid @objc member");
}
LookupResult &ConstraintSystem::lookupMember(Type base, DeclName name) {
LookupResult &ConstraintSystem::lookupMember(Type base, DeclNameRef name) {
// Check whether we've already performed this lookup.
auto &result = MemberLookups[{base, name}];
if (result) return *result;
@@ -2048,8 +2048,10 @@ std::pair<Type, bool> ConstraintSystem::adjustTypeOfOverloadReference(
// Attempt to lookup a member with a give name in the root type and
// assign result to the leaf type of the keypath.
bool isSubscriptRef = locator->isSubscriptMemberRef();
DeclName memberName =
isSubscriptRef ? DeclBaseName::createSubscript() : choice.getName();
DeclNameRef memberName = isSubscriptRef
? DeclNameRef::createSubscript()
// FIXME: Should propagate name-as-written through.
: DeclNameRef_(choice.getName());
auto *memberRef = Constraint::createMember(
*this, ConstraintKind::ValueMember, LValueType::get(rootTy), memberTy,
@@ -2958,7 +2960,9 @@ bool ConstraintSystem::diagnoseAmbiguity(ArrayRef<Solution> solutions) {
// depth-first numbering of expressions.
if (bestOverload) {
auto &overload = diff.overloads[*bestOverload];
auto name = getOverloadChoiceName(overload.choices);
// FIXME: We would prefer to emit the name as written, but that information
// is not sufficiently centralized in the AST.
auto name = DeclNameRef_(getOverloadChoiceName(overload.choices));
auto anchor = simplifyLocatorToAnchor(overload.locator);
// Emit the ambiguity diagnostic.