@@ -6713,10 +6713,6 @@ class Sema final : public SemaBase {
67136713 /// this expression evaluation context.
67146714 unsigned NumCleanupObjects;
67156715
6716- /// The number of typos encountered during this expression evaluation
6717- /// context (i.e. the number of TypoExprs created).
6718- unsigned NumTypos;
6719-
67206716 MaybeODRUseExprSet SavedMaybeODRUseExprs;
67216717
67226718 /// The lambdas that are present within this context, if it
@@ -6813,7 +6809,7 @@ class Sema final : public SemaBase {
68136809 Decl *ManglingContextDecl,
68146810 ExpressionKind ExprContext)
68156811 : Context(Context), ParentCleanup(ParentCleanup),
6816- NumCleanupObjects(NumCleanupObjects), NumTypos(0),
6812+ NumCleanupObjects(NumCleanupObjects),
68176813 ManglingContextDecl(ManglingContextDecl), ExprContext(ExprContext),
68186814 InDiscardedStatement(false), InImmediateFunctionContext(false),
68196815 InImmediateEscalatingFunctionContext(false) {}
@@ -7146,8 +7142,7 @@ class Sema final : public SemaBase {
71467142 CorrectionCandidateCallback &CCC,
71477143 TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
71487144 ArrayRef<Expr *> Args = {},
7149- DeclContext *LookupCtx = nullptr,
7150- TypoExpr **Out = nullptr);
7145+ DeclContext *LookupCtx = nullptr);
71517146
71527147 /// If \p D cannot be odr-used in the current expression evaluation context,
71537148 /// return a reason explaining why. Otherwise, return NOUR_None.
@@ -8748,40 +8743,6 @@ class Sema final : public SemaBase {
87488743
87498744 ExprResult CheckUnevaluatedOperand(Expr *E);
87508745
8751- /// Process any TypoExprs in the given Expr and its children,
8752- /// generating diagnostics as appropriate and returning a new Expr if there
8753- /// were typos that were all successfully corrected and ExprError if one or
8754- /// more typos could not be corrected.
8755- ///
8756- /// \param E The Expr to check for TypoExprs.
8757- ///
8758- /// \param InitDecl A VarDecl to avoid because the Expr being corrected is its
8759- /// initializer.
8760- ///
8761- /// \param RecoverUncorrectedTypos If true, when typo correction fails, it
8762- /// will rebuild the given Expr with all TypoExprs degraded to RecoveryExprs.
8763- ///
8764- /// \param Filter A function applied to a newly rebuilt Expr to determine if
8765- /// it is an acceptable/usable result from a single combination of typo
8766- /// corrections. As long as the filter returns ExprError, different
8767- /// combinations of corrections will be tried until all are exhausted.
8768- ExprResult CorrectDelayedTyposInExpr(
8769- Expr *E, VarDecl *InitDecl = nullptr,
8770- bool RecoverUncorrectedTypos = false,
8771- llvm::function_ref<ExprResult(Expr *)> Filter =
8772- [](Expr *E) -> ExprResult { return E; });
8773-
8774- ExprResult CorrectDelayedTyposInExpr(
8775- ExprResult ER, VarDecl *InitDecl = nullptr,
8776- bool RecoverUncorrectedTypos = false,
8777- llvm::function_ref<ExprResult(Expr *)> Filter =
8778- [](Expr *E) -> ExprResult { return E; }) {
8779- return ER.isInvalid()
8780- ? ER
8781- : CorrectDelayedTyposInExpr(ER.get(), InitDecl,
8782- RecoverUncorrectedTypos, Filter);
8783- }
8784-
87858746 IfExistsResult
87868747 CheckMicrosoftIfExistsSymbol(Scope *S, CXXScopeSpec &SS,
87878748 const DeclarationNameInfo &TargetNameInfo);
@@ -9283,12 +9244,6 @@ class Sema final : public SemaBase {
92839244 /// for C++ records.
92849245 llvm::FoldingSet<SpecialMemberOverloadResultEntry> SpecialMemberCache;
92859246
9286- /// Holds TypoExprs that are created from `createDelayedTypo`. This is used by
9287- /// `TransformTypos` in order to keep track of any TypoExprs that are created
9288- /// recursively during typo correction and wipe them away if the correction
9289- /// fails.
9290- llvm::SmallVector<TypoExpr *, 2> TypoExprs;
9291-
92929247 enum class AcceptableKind { Visible, Reachable };
92939248
92949249 // Members have to be NamespaceDecl* or TranslationUnitDecl*.
@@ -9376,10 +9331,6 @@ class Sema final : public SemaBase {
93769331 bool VolatileArg, bool RValueThis, bool ConstThis,
93779332 bool VolatileThis);
93789333
9379- typedef std::function<void(const TypoCorrection &)> TypoDiagnosticGenerator;
9380- typedef std::function<ExprResult(Sema &, TypoExpr *, TypoCorrection)>
9381- TypoRecoveryCallback;
9382-
93839334 RedeclarationKind forRedeclarationInCurContext() const;
93849335
93859336 /// Look up a name, looking for a single declaration. Return
@@ -9733,51 +9684,6 @@ class Sema final : public SemaBase {
97339684 const ObjCObjectPointerType *OPT = nullptr,
97349685 bool RecordFailure = true);
97359686
9736- /// Try to "correct" a typo in the source code by finding
9737- /// visible declarations whose names are similar to the name that was
9738- /// present in the source code.
9739- ///
9740- /// \param TypoName the \c DeclarationNameInfo structure that contains
9741- /// the name that was present in the source code along with its location.
9742- ///
9743- /// \param LookupKind the name-lookup criteria used to search for the name.
9744- ///
9745- /// \param S the scope in which name lookup occurs.
9746- ///
9747- /// \param SS the nested-name-specifier that precedes the name we're
9748- /// looking for, if present.
9749- ///
9750- /// \param CCC A CorrectionCandidateCallback object that provides further
9751- /// validation of typo correction candidates. It also provides flags for
9752- /// determining the set of keywords permitted.
9753- ///
9754- /// \param TDG A TypoDiagnosticGenerator functor that will be used to print
9755- /// diagnostics when the actual typo correction is attempted.
9756- ///
9757- /// \param TRC A TypoRecoveryCallback functor that will be used to build an
9758- /// Expr from a typo correction candidate.
9759- ///
9760- /// \param MemberContext if non-NULL, the context in which to look for
9761- /// a member access expression.
9762- ///
9763- /// \param EnteringContext whether we're entering the context described by
9764- /// the nested-name-specifier SS.
9765- ///
9766- /// \param OPT when non-NULL, the search for visible declarations will
9767- /// also walk the protocols in the qualified interfaces of \p OPT.
9768- ///
9769- /// \returns a new \c TypoExpr that will later be replaced in the AST with an
9770- /// Expr representing the result of performing typo correction, or nullptr if
9771- /// typo correction is not possible. If nullptr is returned, no diagnostics
9772- /// will be emitted and it is the responsibility of the caller to emit any
9773- /// that are needed.
9774- TypoExpr *CorrectTypoDelayed(
9775- const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind,
9776- Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC,
9777- TypoDiagnosticGenerator TDG, TypoRecoveryCallback TRC,
9778- CorrectTypoKind Mode, DeclContext *MemberContext = nullptr,
9779- bool EnteringContext = false, const ObjCObjectPointerType *OPT = nullptr);
9780-
97819687 /// Kinds of missing import. Note, the values of these enumerators correspond
97829688 /// to %select values in diagnostics.
97839689 enum class MissingImportKind {
@@ -9796,20 +9702,6 @@ class Sema final : public SemaBase {
97969702 SourceLocation DeclLoc, ArrayRef<Module *> Modules,
97979703 MissingImportKind MIK, bool Recover);
97989704
9799- struct TypoExprState {
9800- std::unique_ptr<TypoCorrectionConsumer> Consumer;
9801- TypoDiagnosticGenerator DiagHandler;
9802- TypoRecoveryCallback RecoveryHandler;
9803- TypoExprState();
9804- TypoExprState(TypoExprState &&other) noexcept;
9805- TypoExprState &operator=(TypoExprState &&other) noexcept;
9806- };
9807-
9808- const TypoExprState &getTypoExprState(TypoExpr *TE) const;
9809-
9810- /// Clears the state of the given TypoExpr.
9811- void clearDelayedTypo(TypoExpr *TE);
9812-
98139705 /// Called on #pragma clang __debug dump II
98149706 void ActOnPragmaDump(Scope *S, SourceLocation Loc, IdentifierInfo *II);
98159707
@@ -9832,23 +9724,15 @@ class Sema final : public SemaBase {
98329724 /// Determine if we could use all the declarations in the module.
98339725 bool isUsableModule(const Module *M);
98349726
9835- /// Helper for CorrectTypo and CorrectTypoDelayed used to create and
9836- /// populate a new TypoCorrectionConsumer. Returns nullptr if typo correction
9837- /// should be skipped entirely.
9727+ /// Helper for CorrectTypo used to create and populate a new
9728+ /// TypoCorrectionConsumer. Returns nullptr if typo correction should be
9729+ /// skipped entirely.
98389730 std::unique_ptr<TypoCorrectionConsumer> makeTypoCorrectionConsumer(
98399731 const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind,
98409732 Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC,
98419733 DeclContext *MemberContext, bool EnteringContext,
98429734 const ObjCObjectPointerType *OPT, bool ErrorRecovery);
98439735
9844- /// The set of unhandled TypoExprs and their associated state.
9845- llvm::MapVector<TypoExpr *, TypoExprState> DelayedTypos;
9846-
9847- /// Creates a new TypoExpr AST node.
9848- TypoExpr *createDelayedTypo(std::unique_ptr<TypoCorrectionConsumer> TCC,
9849- TypoDiagnosticGenerator TDG,
9850- TypoRecoveryCallback TRC, SourceLocation TypoLoc);
9851-
98529736 /// Cache for module units which is usable for current module.
98539737 llvm::DenseSet<const Module *> UsableModuleUnitsCache;
98549738
0 commit comments