]> granicus.if.org Git - clang/commitdiff
CFG: Also apply the filter to the first block in a FilteredCFGBlockIterator.
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 28 Feb 2014 11:12:22 +0000 (11:12 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 28 Feb 2014 11:12:22 +0000 (11:12 +0000)
PR18999.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202491 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/CFG.h
test/Sema/return.c

index 077210e78907765f4d7dccec1f8aa215ef9b0c8b..56ad6af91395a79b49145e9ad800c78725653794 100644 (file)
@@ -576,11 +576,14 @@ public:
     IMPL I, E;
     const FilterOptions F;
     const CFGBlock *From;
-   public:
+  public:
     explicit FilteredCFGBlockIterator(const IMPL &i, const IMPL &e,
-              const CFGBlock *from,
-              const FilterOptions &f)
-      : I(i), E(e), F(f), From(from) {}
+                                      const CFGBlock *from,
+                                      const FilterOptions &f)
+        : I(i), E(e), F(f), From(from) {
+      while (hasMore() && Filter(*I))
+        ++I;
+    }
 
     bool hasMore() const { return I != E; }
 
index cfdbe0c5d4ba123e7cc5822d9565017587f862ae..aa2ecda0486dd59df10facb732c39b42d08a0d42 100644 (file)
@@ -275,3 +275,10 @@ int test34(int x) {
     return 5;
   }
 }
+
+// PR18999
+int test35() {
+lbl:
+  if (1)
+    goto lbl;
+}