[clang] 30725ef - Fix build after removing delayed typo expression
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 13 04:13:34 PDT 2025
Author: Aaron Ballman
Date: 2025-06-13T07:12:41-04:00
New Revision: 30725efe671bc82bf9095a575aece60fc40fbef5
URL: https://github.com/llvm/llvm-project/commit/30725efe671bc82bf9095a575aece60fc40fbef5
DIFF: https://github.com/llvm/llvm-project/commit/30725efe671bc82bf9095a575aece60fc40fbef5.diff
LOG: Fix build after removing delayed typo expression
This addresses issues found by:
https://lab.llvm.org/buildbot/#/builders/64/builds/4220
https://lab.llvm.org/buildbot/#/builders/51/builds/17890
Added:
Modified:
clang/lib/Parse/ParseExpr.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaExprCXX.cpp
Removed:
################################################################################
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index a27a44455b621..3cf3d4ea7d705 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -513,7 +513,6 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) {
}
}
- ExprResult OrigLHS = LHS;
if (!LHS.isInvalid()) {
// Combine the LHS and RHS into the LHS (e.g. build AST).
if (TernaryMiddle.isInvalid()) {
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index b7031bc8c0220..413eff4aa294a 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -2446,42 +2446,6 @@ Sema::DecomposeUnqualifiedId(const UnqualifiedId &Id,
}
}
-static void emitEmptyLookupTypoDiagnostic(const TypoCorrection &TC,
- Sema &SemaRef, const CXXScopeSpec &SS,
- DeclarationName Typo,
- SourceRange TypoRange,
- unsigned DiagnosticID,
- unsigned DiagnosticSuggestID) {
- DeclContext *Ctx =
- SS.isEmpty() ? nullptr : SemaRef.computeDeclContext(SS, false);
- if (!TC) {
- // Emit a special diagnostic for failed member lookups.
- // FIXME: computing the declaration context might fail here (?)
- if (Ctx)
- SemaRef.Diag(TypoRange.getBegin(), diag::err_no_member)
- << Typo << Ctx << TypoRange;
- else
- SemaRef.Diag(TypoRange.getBegin(), DiagnosticID) << Typo << TypoRange;
- return;
- }
-
- std::string CorrectedStr = TC.getAsString(SemaRef.getLangOpts());
- bool DroppedSpecifier =
- TC.WillReplaceSpecifier() && Typo.getAsString() == CorrectedStr;
- unsigned NoteID = TC.getCorrectionDeclAs<ImplicitParamDecl>()
- ? diag::note_implicit_param_decl
- : diag::note_previous_decl;
- if (!Ctx)
- SemaRef.diagnoseTypo(
- TC, SemaRef.PDiag(DiagnosticSuggestID) << Typo << TypoRange,
- SemaRef.PDiag(NoteID));
- else
- SemaRef.diagnoseTypo(TC,
- SemaRef.PDiag(diag::err_no_member_suggest)
- << Typo << Ctx << DroppedSpecifier << TypoRange,
- SemaRef.PDiag(NoteID));
-}
-
bool Sema::DiagnoseDependentMemberLookup(const LookupResult &R) {
// During a default argument instantiation the CurContext points
// to a CXXMethodDecl; but we can't apply a this-> fixit inside a
@@ -14922,18 +14886,6 @@ static void checkObjCPointerIntrospection(Sema &S, ExprResult &L, ExprResult &R,
}
}
-static NamedDecl *getDeclFromExpr(Expr *E) {
- if (!E)
- return nullptr;
- if (auto *DRE = dyn_cast<DeclRefExpr>(E))
- return DRE->getDecl();
- if (auto *ME = dyn_cast<MemberExpr>(E))
- return ME->getMemberDecl();
- if (auto *IRE = dyn_cast<ObjCIvarRefExpr>(E))
- return IRE->getDecl();
- return nullptr;
-}
-
// This helper function promotes a binary operator's operands (which are of a
// half vector type) to a vector of floats and then truncates the result to
// a vector of either half or short.
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index c653cb56351cb..ba52e8f8932d3 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -7647,51 +7647,6 @@ static void CheckIfAnyEnclosingLambdasMustCaptureAnyPotentialCaptures(
CurrentLSI->clearPotentialCaptures();
}
-static ExprResult attemptRecovery(Sema &SemaRef,
- const TypoCorrectionConsumer &Consumer,
- const TypoCorrection &TC) {
- LookupResult R(SemaRef, Consumer.getLookupResult().getLookupNameInfo(),
- Consumer.getLookupResult().getLookupKind());
- const CXXScopeSpec *SS = Consumer.getSS();
- CXXScopeSpec NewSS;
-
- // Use an approprate CXXScopeSpec for building the expr.
- if (auto *NNS = TC.getCorrectionSpecifier())
- NewSS.MakeTrivial(SemaRef.Context, NNS, TC.getCorrectionRange());
- else if (SS && !TC.WillReplaceSpecifier())
- NewSS = *SS;
-
- if (auto *ND = TC.getFoundDecl()) {
- R.setLookupName(ND->getDeclName());
- R.addDecl(ND);
- if (ND->isCXXClassMember()) {
- // Figure out the correct naming class to add to the LookupResult.
- CXXRecordDecl *Record = nullptr;
- if (auto *NNS = TC.getCorrectionSpecifier())
- Record = NNS->getAsType()->getAsCXXRecordDecl();
- if (!Record)
- Record =
- dyn_cast<CXXRecordDecl>(ND->getDeclContext()->getRedeclContext());
- if (Record)
- R.setNamingClass(Record);
-
- // Detect and handle the case where the decl might be an implicit
- // member.
- if (SemaRef.isPotentialImplicitMemberAccess(
- NewSS, R, Consumer.isAddressOfOperand()))
- return SemaRef.BuildPossibleImplicitMemberExpr(
- NewSS, /*TemplateKWLoc*/ SourceLocation(), R,
- /*TemplateArgs*/ nullptr, /*S*/ nullptr);
- } else if (auto *Ivar = dyn_cast<ObjCIvarDecl>(ND)) {
- return SemaRef.ObjC().LookupInObjCMethod(R, Consumer.getScope(),
- Ivar->getIdentifier());
- }
- }
-
- return SemaRef.BuildDeclarationNameExpr(NewSS, R, /*NeedsADL*/ false,
- /*AcceptInvalidDecl*/ true);
-}
-
ExprResult Sema::ActOnFinishFullExpr(Expr *FE, SourceLocation CC,
bool DiscardedValue, bool IsConstexpr,
bool IsTemplateArgument) {
More information about the cfe-commits
mailing list