arphaman added a comment.

Thanks! There are two issues that I see:



================
Comment at: lib/Sema/SemaDeclAttr.cpp:7519
+    // to any useful diagnostics.
+    for (Stmt *Child : llvm::drop_begin(CS->children(), 1))
+      if (!Base::TraverseStmt(Child))
----------------
GNU case statements can also have a RHS expression in a range. You should avoid 
using children completely and just traverse the sub stmt instead.


================
Comment at: lib/Sema/SemaDeclAttr.cpp:7520
+    for (Stmt *Child : llvm::drop_begin(CS->children(), 1))
+      if (!Base::TraverseStmt(Child))
+        return false;
----------------
You should call `TraverseStmt` instead because we have special logic for 
tracking the statement stack for a fixit. We can produce an incorrect 
multi-statement fixit if the case's sub statement is a compound statement when 
we call `Base::TraverseStmt`.


https://reviews.llvm.org/D36777



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to