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

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 8 08:11:39 PDT 2020


sammccall added a comment.

Very nice! Just want to give some thought to what these callsites look like.



================
Comment at: clang/include/clang/Sema/Sema.h:3899
 
+  /// Rebuild the given Expr with the TypoExpr degraded to RecoveryExpr.
+  ExprResult rebuildTypoExprs(Expr *TypoExpr);
----------------
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)


================
Comment at: clang/include/clang/Sema/Sema.h:3900
+  /// Rebuild the given Expr with the TypoExpr degraded to RecoveryExpr.
+  ExprResult rebuildTypoExprs(Expr *TypoExpr);
   /// Attempts to produce a RecoveryExpr after some AST node cannot be created.
----------------
hokein wrote:
> not quite happy with the naming, open for suggestions.
given current API, I'd suggest RecoverFromUncorrectedTypos or so


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