[PATCH] D63139: [Diagnostics] Implement -Wswitch-unreachable

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 10 13:43:01 PDT 2019


rjmccall added a comment.

I agree that tools shouldn't be forced to deal with invalid AST that looks like valid AST.  To me that means finding ways to preserve information that (1) don't badly violate invariants and (2) are easily discoverable as invalid.  For `case`, which has external requirements (e.g. not being a duplicate value) not entirely dissimilar to a declaration, I think that means having an "invalid" flag; arbitrary tools already can't rely on the expression being constant-evaluable because of templates, although granted many tools might never look at template patterns.  For other things (e.g. a binary operator) maybe that means using different classes (e.g. `InvalidBinaryOperator`) so that tools looking at an apparently well-typed expression don't need to consider totally invalid possibilities.


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

https://reviews.llvm.org/D63139





More information about the cfe-commits mailing list