diff options
Diffstat (limited to 'contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp')
| -rw-r--r-- | contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp | 16 | 
1 files changed, 9 insertions, 7 deletions
diff --git a/contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp b/contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp index 60ad035570c8..2f48ea237cdf 100644 --- a/contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp +++ b/contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp @@ -2469,7 +2469,8 @@ bool Sema::DiagnoseDependentMemberLookup(const LookupResult &R) {  bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,                                 CorrectionCandidateCallback &CCC,                                 TemplateArgumentListInfo *ExplicitTemplateArgs, -                               ArrayRef<Expr *> Args, TypoExpr **Out) { +                               ArrayRef<Expr *> Args, DeclContext *LookupCtx, +                               TypoExpr **Out) {    DeclarationName Name = R.getLookupName();    unsigned diagnostic = diag::err_undeclared_var_use; @@ -2485,7 +2486,8 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,    // unqualified lookup.  This is useful when (for example) the    // original lookup would not have found something because it was a    // dependent name. -  DeclContext *DC = SS.isEmpty() ? CurContext : nullptr; +  DeclContext *DC = +      LookupCtx ? LookupCtx : (SS.isEmpty() ? CurContext : nullptr);    while (DC) {      if (isa<CXXRecordDecl>(DC)) {        LookupQualifiedName(R, DC); @@ -2528,12 +2530,12 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,            emitEmptyLookupTypoDiagnostic(TC, *this, SS, Name, TypoLoc, Args,                                          diagnostic, diagnostic_suggest);          }, -        nullptr, CTK_ErrorRecovery); +        nullptr, CTK_ErrorRecovery, LookupCtx);      if (*Out)        return true; -  } else if (S && -             (Corrected = CorrectTypo(R.getLookupNameInfo(), R.getLookupKind(), -                                      S, &SS, CCC, CTK_ErrorRecovery))) { +  } else if (S && (Corrected = +                       CorrectTypo(R.getLookupNameInfo(), R.getLookupKind(), S, +                                   &SS, CCC, CTK_ErrorRecovery, LookupCtx))) {      std::string CorrectedStr(Corrected.getAsString(getLangOpts()));      bool DroppedSpecifier =          Corrected.WillReplaceSpecifier() && Name.getAsString() == CorrectedStr; @@ -2823,7 +2825,7 @@ Sema::ActOnIdExpression(Scope *S, CXXScopeSpec &SS,      // a template name, but we happen to have always already looked up the name      // before we get here if it must be a template name.      if (DiagnoseEmptyLookup(S, SS, R, CCC ? *CCC : DefaultValidator, nullptr, -                            std::nullopt, &TE)) { +                            std::nullopt, nullptr, &TE)) {        if (TE && KeywordReplacement) {          auto &State = getTypoExprState(TE);          auto BestTC = State.Consumer->getNextCorrection();  | 
