[cfe-commits] r93956 - /cfe/trunk/lib/Sema/SemaDecl.cpp

Mike Stump mrs at apple.com
Tue Jan 19 16:34:04 PST 2010


Author: mrs
Date: Tue Jan 19 18:34:04 2010
New Revision: 93956

URL: http://llvm.org/viewvc/llvm-project?rev=93956&view=rev
Log:
Improve CheckFallThrough analysis in the presense of the new C++ EH
support.  WIP.

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=93956&r1=93955&r2=93956&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Jan 19 18:34:04 2010
@@ -1496,6 +1496,7 @@
   bool HasLiveReturn = false;
   bool HasFakeEdge = false;
   bool HasPlainEdge = false;
+  bool HasAbnormalEdge = false;
   for (CFGBlock::pred_iterator I=cfg->getExit().pred_begin(),
          E = cfg->getExit().pred_end();
        I != E;
@@ -1528,9 +1529,17 @@
         continue;
       }
     }
+    if (isa<CXXTryStmt>(S)) {
+      HasAbnormalEdge = true;
+      continue;
+    }
 
     bool NoReturnEdge = false;
     if (CallExpr *C = dyn_cast<CallExpr>(S)) {
+      if (B.succ_begin()[0] != &cfg->getExit()) {
+        HasAbnormalEdge = true;
+        continue;
+      }
       Expr *CEE = C->getCallee()->IgnoreParenCasts();
       if (CEE->getType().getNoReturnAttr()) {
         NoReturnEdge = true;
@@ -1552,7 +1561,7 @@
       return NeverFallThrough;
     return NeverFallThroughOrReturn;
   }
-  if (HasFakeEdge || HasLiveReturn)
+  if (HasAbnormalEdge || HasFakeEdge || HasLiveReturn)
     return MaybeFallThrough;
   // This says AlwaysFallThrough for calls to functions that are not marked
   // noreturn, that don't return.  If people would like this warning to be more





More information about the cfe-commits mailing list