[PATCH] Fix to PR8880 (clang dies processing a for loop).

Richard Smith richard at metafoo.co.uk
Tue Jan 21 16:53:00 PST 2014


  Thanks, this looks good.


================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:6336
@@ +6335,3 @@
+def warn_loop_ctrl_binds_to_inner : Warning<
+  "'%0' is bound to current loop, GCC binds it to enclosing">,
+  InGroup<GccCompat>;
----------------
... "to the enclosing loop" might be clearer.

================
Comment at: test/CodeGen/PR8880.c:8
@@ +7,3 @@
+  for (i = 2; i != 10 ; i++ )
+// CHECK: [[OUTER_COND]]
+// CHECK: label %[[OUTER_BODY:[0-9A-Za-z$._]+]]
----------------
This test will not work with a Clang built without asserts, because label names are not emitted into the text form of the IR. If you need to match label names, run the IR through `opt -instnamer -S` before piping it into `FileCheck` (see test/CodeGenCXX/for-range.cpp for an example).

================
Comment at: test/Sema/loop-control.cpp:1
@@ +1,2 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
----------------
Can you fold this and loop-control.c into the same source file? (Maybe use `-verify` for the C test and `-Werror` for this one.)


http://llvm-reviews.chandlerc.com/D2518



More information about the cfe-commits mailing list