[PATCH] D63139: [Diagnostics] Implement -Wswitch-unreachable
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 10 07:46:23 PDT 2019
aaron.ballman added a comment.
In D63139#1561891 <https://reviews.llvm.org/D63139#1561891>, @rjmccall wrote:
> Are the `CaseStmt`s being dropped in C++ because the expression overflows? I agree that that's bad AST behavior; we should strive to generate AST whenever we can, even if it's not valid.
We do strive to generate an AST whenever we can (like recovering as though fix-its were applied, or keeping declarations and marking them as invalid), but I don't think we want to generate *invalid* AST nodes. I believe that way leads to more cascading, insensible errors and worse behavior for tooling than dropping the invalid AST node does (depending on the scenario). I have a hazy recollection that we wanted to consider adding AST nodes to represent erroneous constructs that attempt to hold onto as much valid state as we can capture to help with these situations, but I'm not certain that idea went anywhere.
It would be nice if we could suppress the unreachable warning in this case, but I'm not certain it's strictly required for this patch to proceed, either. @rsmith, do you have opinions?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63139/new/
https://reviews.llvm.org/D63139
More information about the cfe-commits
mailing list