[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

@@ -747,7 +747,7 @@ public:
getScopeInfo().addToScope(D, *this, diagnoseRedefinitions);
}
ValueDecl *lookupInScope(DeclName Name) {
ValueDecl *lookupInScope(DeclNameRef Name) {
if (Context.LangOpts.DisableParserLookup)
return nullptr;
@@ -990,7 +990,8 @@ public:
/// Parse the arguments inside the @differentiable attribute.
bool parseDifferentiableAttributeArguments(
bool &linear, SmallVectorImpl<ParsedAutoDiffParameter> &params,
Optional<DeclNameWithLoc> &jvpSpec, Optional<DeclNameWithLoc> &vjpSpec,
Optional<DeclNameRefWithLoc> &jvpSpec,
Optional<DeclNameRefWithLoc> &vjpSpec,
TrailingWhereClause *&whereClause);
/// Parse a differentiation parameters clause.
@@ -1421,10 +1422,10 @@ public:
/// \param loc Will be populated with the location of the name.
/// \param diag The diagnostic to emit if this is not a name.
/// \param allowOperators Whether to allow operator basenames too.
DeclBaseName parseUnqualifiedDeclBaseName(bool afterDot, DeclNameLoc &loc,
const Diagnostic &diag,
bool allowOperators=false,
bool allowDeinitAndSubscript=false);
DeclNameRef parseUnqualifiedDeclBaseName(bool afterDot, DeclNameLoc &loc,
const Diagnostic &diag,
bool allowOperators=false,
bool allowDeinitAndSubscript=false);
/// Parse an unqualified-decl-name.
///
@@ -1438,11 +1439,11 @@ public:
/// \param diag The diagnostic to emit if this is not a name.
/// \param allowOperators Whether to allow operator basenames too.
/// \param allowZeroArgCompoundNames Whether to allow empty argument lists.
DeclName parseUnqualifiedDeclName(bool afterDot, DeclNameLoc &loc,
const Diagnostic &diag,
bool allowOperators=false,
bool allowZeroArgCompoundNames=false,
bool allowDeinitAndSubscript=false);
DeclNameRef parseUnqualifiedDeclName(bool afterDot, DeclNameLoc &loc,
const Diagnostic &diag,
bool allowOperators=false,
bool allowZeroArgCompoundNames=false,
bool allowDeinitAndSubscript=false);
Expr *parseExprIdentifier();
Expr *parseExprEditorPlaceholder(Token PlaceholderTok,

View File

@@ -47,7 +47,7 @@ private:
unsigned ResolvableDepth = 0;
public:
ValueDecl *lookupValueName(DeclName Name);
ValueDecl *lookupValueName(DeclNameRef Name);
Scope *getCurrentScope() const { return CurScope; }
@@ -159,7 +159,7 @@ public:
}
};
inline ValueDecl *ScopeInfo::lookupValueName(DeclName Name) {
inline ValueDecl *ScopeInfo::lookupValueName(DeclNameRef Name) {
// FIXME: this check can go away when SIL parser parses everything in
// a toplevel scope.
if (!CurScope)
@@ -169,7 +169,8 @@ inline ValueDecl *ScopeInfo::lookupValueName(DeclName Name) {
// If we found nothing, or we found a decl at the top-level, return nothing.
// We ignore results at the top-level because we may have overloading that
// will be resolved properly by name binding.
std::pair<unsigned, ValueDecl *> Res = HT.lookup(CurScope->HTScope, Name);
std::pair<unsigned, ValueDecl *> Res = HT.lookup(CurScope->HTScope,
Name.getFullName());
if (Res.first < ResolvableDepth)
return 0;
return Res.second;