[PATCH] Recovery of switch statement

Richard Smith richard at metafoo.co.uk
Tue May 20 18:07:53 PDT 2014


Looks fine with some tiny fixes.

================
Comment at: lib/Parse/ParseStmt.cpp:706
@@ +705,3 @@
+    // not valid.  If ColonLoc doesn't point to valid text location, there was
+    // another parsing error, so don't produce extra diagnostic.
+    if (ColonLoc.isValid()) {
----------------
"a valid text location"
"an extra diagnostic" or "extra diagnostics"?

================
Comment at: lib/Sema/SemaStmt.cpp:705-706
@@ -704,2 +704,4 @@
 
-  SS->setBody(BodyStmt, SwitchLoc);
+  Stmt *Body = BodyStmt;
+  if (!Body) return StmtError();
+  SS->setBody(Body, SwitchLoc);
----------------
Why the extra variable?

http://reviews.llvm.org/D3137






More information about the cfe-commits mailing list