[PATCH] D81395: [AST][RecoveryExpr] Preserve the invalid "undef_var" initializer.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 9 04:54:04 PDT 2020


hokein marked an inline comment as done.
hokein added inline comments.


================
Comment at: clang/include/clang/Sema/Sema.h:3899
 
+  /// Rebuild the given Expr with the TypoExpr degraded to RecoveryExpr.
+  ExprResult rebuildTypoExprs(Expr *TypoExpr);
----------------
sammccall wrote:
> This definitely seems like something that makes sense to call in more places. Wonder if the API can be smoother.
> 
> Both of the examples are of the form: CorrectDelayedTypos, if invalid, rebuildTypos.
> Are *all* likely cases of this form? (Could make it an optional part of CorrectDelayedTypos)
> Are there any places where you want CorrectDelayedTypos and don't want rebuild? (Could make it an eventually-mandatory part of CorrectDelayedTypos)
> Are *all* likely cases of this form? (Could make it an optional part of CorrectDelayedTypos)

I think so (at least for the moment).

> Are there any places where you want CorrectDelayedTypos and don't want rebuild? (Could make it an eventually-mandatory part of CorrectDelayedTypos)

yeah, I think the eventual goal is to make the rebuild as the default fallback when typo correction fails, but it is still too far away to do it at the moment -- many testcases are broken (some are crashes, some are diagnostics improvements) when turning on `recovery-ast` by default.

I suppose we'd need to fix that case by case until it is ready, given this situation, adding an option parameter (`recoveryUncorrectedTypos`) to `CorrectDelayedTyposInExpr` API seems a feasible solution.






Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81395/new/

https://reviews.llvm.org/D81395





More information about the cfe-commits mailing list