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

Dávid Bolvanský via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 18 03:20:17 PDT 2019


xbolva00 added a comment.

There is a bug in Clang AST. @rsmith

Check testcase test/Sema/switch-1.c. In C++ mode we have AST:
CompoundStmt 0x55f5b7d68460 <col:14, line:51:3>

|  |                                                   | -ReturnStmt 0x55f5b7d68060 <line:17:7, col:14>   |
|  |                                                   | `-IntegerLiteral 0x55f5b7d68040 <col:14> 'int' 1 |
|  |                                                   | -ReturnStmt 0x55f5b7d68120 <line:25:7, col:14>   |
|  |                                                   | `-IntegerLiteral 0x55f5b7d68100 <col:14> 'int' 2 |
|  |                                                   | -ReturnStmt 0x55f5b7d68210 <line:33:7, col:14>   |
|  |                                                   | `-IntegerLiteral 0x55f5b7d681f0 <col:14> 'int' 3 |
|  |                                                   | -ReturnStmt 0x55f5b7d683c0 <line:48:7, col:14>   |
|  |                                                   | `-IntegerLiteral 0x55f5b7d683a0 <col:14> 'int' 4 |
|  | `-CaseStmt 0x55f5b7d68408 <line:49:5, line:50:14> |
|  |                                                   | -ConstantExpr 0x55f5b7d683f0 <line:49:10> 'int'  |
|  |                                                   | `-IntegerLiteral 0x55f5b7d683d0 <col:10> 'int' 2147483647 |
|  | `-ReturnStmt 0x55f5b7d68450 <line:50:7, col:14>   |
|  | `-IntegerLiteral 0x55f5b7d68430 <col:14> 'int' 0  |
|

This is bad and blocks this patch since it creates weird warnings :/


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

https://reviews.llvm.org/D63139





More information about the cfe-commits mailing list