r202491 - CFG: Also apply the filter to the first block in a FilteredCFGBlockIterator.

Benjamin Kramer benny.kra at googlemail.com
Fri Feb 28 03:12:22 PST 2014


Author: d0k
Date: Fri Feb 28 05:12:22 2014
New Revision: 202491

URL: http://llvm.org/viewvc/llvm-project?rev=202491&view=rev
Log:
CFG: Also apply the filter to the first block in a FilteredCFGBlockIterator.

PR18999.

Modified:
    cfe/trunk/include/clang/Analysis/CFG.h
    cfe/trunk/test/Sema/return.c

Modified: cfe/trunk/include/clang/Analysis/CFG.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/CFG.h?rev=202491&r1=202490&r2=202491&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/CFG.h (original)
+++ cfe/trunk/include/clang/Analysis/CFG.h Fri Feb 28 05:12:22 2014
@@ -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; }
 

Modified: cfe/trunk/test/Sema/return.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/return.c?rev=202491&r1=202490&r2=202491&view=diff
==============================================================================
--- cfe/trunk/test/Sema/return.c (original)
+++ cfe/trunk/test/Sema/return.c Fri Feb 28 05:12:22 2014
@@ -275,3 +275,10 @@ int test34(int x) {
     return 5;
   }
 }
+
+// PR18999
+int test35() {
+lbl:
+  if (1)
+    goto lbl;
+}





More information about the cfe-commits mailing list