[PATCH] D76592: [Parser] Fix the assertion crash in ActOnStartOfSwitch stmt.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 24 03:12:16 PDT 2020


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


================
Comment at: clang/lib/Sema/SemaStmt.cpp:709
   } SwitchDiagnoser(Cond);
+  // The TypoExpr might be corrected to a non-intergral-or-enum type in the
+  // later stage without the proper type check, which is invalid for switch
----------------
sammccall wrote:
> How do we know Cond is a TypoExpr directly rather than containing one?
> 
> I think the usual strategy when code can't deal with typo correction being delayed further is to call CorrectDelayedTyposInExpr.
no sure whether we should consider the containing-typo Cond, we might still want to keep the typo correction? thinking a case like `switch(return_int(typo-expr)) {}`.

Do you suggest that we use the `CorrectDelayedTyposInExpr` to check the whether Cond is/has a TypoExpr? `CorrectDelayedTyposInExpr` has a side effect of emitting the typo-suggestion diagnostic.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76592





More information about the cfe-commits mailing list