<div dir="ltr">Hello,<div><br></div><div>Check this testcase: <a href="https://github.com/llvm-mirror/clang/blob/329eb5c6baeca0a1bd6b1a5bd55e41de786f39fa//test/Sema/switch-1.c#L10" target="_blank">https://github.com/llvm-mirror/clang/blob/329eb5c6baeca0a1bd6b1a5bd55e41de786f39fa//test/Sema/switch-1.c#L10</a></div><div><br></div><div>clang -cc1 -ast-dump -x c++ /home/LLVM/llvm/tools/clang/test/Sema/switch-1.c<br></div><div>Produced AST:</div><div><br></div><div><pre class="gmail-m_5316226957850078995gmail-remarkup-code" style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:15px;font-family:Menlo,Consolas,Monaco,monospace;margin-top:0px;margin-bottom:0px;padding:12px;border:0px;background:rgba(71,87,120,0.08);color:rgb(0,0,0);overflow:auto;border-radius:3px;white-space:pre-wrap">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</pre></div><div><br></div><div>The problem is how can we distinguish between this AST and AST for:</div><div>switch(x) {</div><div>   return 1;</div><div>   return 2;</div><div>   case 1: ...</div><div>}<br></div><div><br></div><div>Ideally here: <a href="https://github.com/llvm-mirror/clang/blob/329eb5c6baeca0a1bd6b1a5bd55e41de786f39fa/lib/Sema/SemaStmt.cpp#L809">https://github.com/llvm-mirror/clang/blob/329eb5c6baeca0a1bd6b1a5bd55e41de786f39fa/lib/Sema/SemaStmt.cpp#L809</a></div><div><br></div><div>Since I am working on -Wswitch-unreachable, this problem blocks <a href="https://reviews.llvm.org/D63423">https://reviews.llvm.org/D63423</a> now.</div></div>