@@ -6713,10 +6713,6 @@ class Sema final : public SemaBase {
6713
6713
/// this expression evaluation context.
6714
6714
unsigned NumCleanupObjects;
6715
6715
6716
- /// The number of typos encountered during this expression evaluation
6717
- /// context (i.e. the number of TypoExprs created).
6718
- unsigned NumTypos;
6719
-
6720
6716
MaybeODRUseExprSet SavedMaybeODRUseExprs;
6721
6717
6722
6718
/// The lambdas that are present within this context, if it
@@ -6813,7 +6809,7 @@ class Sema final : public SemaBase {
6813
6809
Decl *ManglingContextDecl,
6814
6810
ExpressionKind ExprContext)
6815
6811
: Context(Context), ParentCleanup(ParentCleanup),
6816
- NumCleanupObjects(NumCleanupObjects), NumTypos(0),
6812
+ NumCleanupObjects(NumCleanupObjects),
6817
6813
ManglingContextDecl(ManglingContextDecl), ExprContext(ExprContext),
6818
6814
InDiscardedStatement(false), InImmediateFunctionContext(false),
6819
6815
InImmediateEscalatingFunctionContext(false) {}
@@ -7146,8 +7142,7 @@ class Sema final : public SemaBase {
7146
7142
CorrectionCandidateCallback &CCC,
7147
7143
TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
7148
7144
ArrayRef<Expr *> Args = {},
7149
- DeclContext *LookupCtx = nullptr,
7150
- TypoExpr **Out = nullptr);
7145
+ DeclContext *LookupCtx = nullptr);
7151
7146
7152
7147
/// If \p D cannot be odr-used in the current expression evaluation context,
7153
7148
/// return a reason explaining why. Otherwise, return NOUR_None.
@@ -8748,40 +8743,6 @@ class Sema final : public SemaBase {
8748
8743
8749
8744
ExprResult CheckUnevaluatedOperand(Expr *E);
8750
8745
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
-
8785
8746
IfExistsResult
8786
8747
CheckMicrosoftIfExistsSymbol(Scope *S, CXXScopeSpec &SS,
8787
8748
const DeclarationNameInfo &TargetNameInfo);
@@ -9283,12 +9244,6 @@ class Sema final : public SemaBase {
9283
9244
/// for C++ records.
9284
9245
llvm::FoldingSet<SpecialMemberOverloadResultEntry> SpecialMemberCache;
9285
9246
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
-
9292
9247
enum class AcceptableKind { Visible, Reachable };
9293
9248
9294
9249
// Members have to be NamespaceDecl* or TranslationUnitDecl*.
@@ -9376,10 +9331,6 @@ class Sema final : public SemaBase {
9376
9331
bool VolatileArg, bool RValueThis, bool ConstThis,
9377
9332
bool VolatileThis);
9378
9333
9379
- typedef std::function<void(const TypoCorrection &)> TypoDiagnosticGenerator;
9380
- typedef std::function<ExprResult(Sema &, TypoExpr *, TypoCorrection)>
9381
- TypoRecoveryCallback;
9382
-
9383
9334
RedeclarationKind forRedeclarationInCurContext() const;
9384
9335
9385
9336
/// Look up a name, looking for a single declaration. Return
@@ -9733,51 +9684,6 @@ class Sema final : public SemaBase {
9733
9684
const ObjCObjectPointerType *OPT = nullptr,
9734
9685
bool RecordFailure = true);
9735
9686
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
-
9781
9687
/// Kinds of missing import. Note, the values of these enumerators correspond
9782
9688
/// to %select values in diagnostics.
9783
9689
enum class MissingImportKind {
@@ -9796,20 +9702,6 @@ class Sema final : public SemaBase {
9796
9702
SourceLocation DeclLoc, ArrayRef<Module *> Modules,
9797
9703
MissingImportKind MIK, bool Recover);
9798
9704
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
-
9813
9705
/// Called on #pragma clang __debug dump II
9814
9706
void ActOnPragmaDump(Scope *S, SourceLocation Loc, IdentifierInfo *II);
9815
9707
@@ -9832,23 +9724,15 @@ class Sema final : public SemaBase {
9832
9724
/// Determine if we could use all the declarations in the module.
9833
9725
bool isUsableModule(const Module *M);
9834
9726
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.
9838
9730
std::unique_ptr<TypoCorrectionConsumer> makeTypoCorrectionConsumer(
9839
9731
const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind,
9840
9732
Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC,
9841
9733
DeclContext *MemberContext, bool EnteringContext,
9842
9734
const ObjCObjectPointerType *OPT, bool ErrorRecovery);
9843
9735
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
-
9852
9736
/// Cache for module units which is usable for current module.
9853
9737
llvm::DenseSet<const Module *> UsableModuleUnitsCache;
9854
9738
0 commit comments