================
@@ -1710,4 +1710,25 @@ TEST_F(TopTest, ForRangeStmtConverges) {
                 // analysis converged.
               });
 }
+
+TEST_F(TopTest, ForRangeStmtHasFlowCondition) {
+  std::string Code = R"(
+    #include <array>
+    void target(bool Foo) {
+      std::array<int, 5> t;
+      for (auto& i : t) {
+        (void)0;
+        /*[[p1]]*/
+      }
+    }
----------------
martinboehme wrote:

```suggestion
    #include <initializer_list>
    void target() {
      for (auto& i : {1, 2}) {
        (void)0;
        /*[[p1]]*/
      }
    }
```

Try to keep code snippets as simple as possible:

*  I don't think `Foo` is needed here?
*  An `initializer_list` is probably the simplest thing you can use to iterate 
over (it doesn't matter specifically what you're iterating over, right?)

https://github.com/llvm/llvm-project/pull/80989
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to