diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp
index f2ff48a..60bf5a0 100644
--- a/lib/Sema/AnalysisBasedWarnings.cpp
+++ b/lib/Sema/AnalysisBasedWarnings.cpp
@@ -171,21 +171,14 @@ enum RecursiveState {
   FoundPathWithNoRecursiveCall
 };
 
-static void checkForFunctionCall(Sema &S, const FunctionDecl *FD,
-                                 CFGBlock &Block, unsigned ExitID,
-                                 llvm::SmallVectorImpl<RecursiveState> &States,
-                                 RecursiveState State) {
+static RecursiveState updateRecursiveState(const FunctionDecl *FD,
+                                           CFGBlock &Block, unsigned ExitID,
+                                           RecursiveState State) {
   unsigned ID = Block.getBlockID();
 
-  // A block's state can only move to a higher state.
-  if (States[ID] >= State)
-    return;
-
-  States[ID] = State;
-
   // Found a path to the exit node without a recursive call.
   if (ID == ExitID && State == FoundPathWithNoRecursiveCall)
-    return;
+    return State;
 
   if (State == FoundPathWithNoRecursiveCall) {
     // If the current state is FoundPathWithNoRecursiveCall, the successors
@@ -200,12 +193,12 @@ static void checkForFunctionCall(Sema &S, const FunctionDecl *FD,
           CE->getCalleeDecl()->getCanonicalDecl() == FD) {
 
         // Skip function calls which are qualified with a templated class.
-        if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(
-                CE->getCallee()->IgnoreParenImpCasts())) {
+        if (const DeclRefExpr *DRE =
+                dyn_cast<DeclRefExpr>(CE->getCallee()->IgnoreParenImpCasts())) {
           if (NestedNameSpecifier *NNS = DRE->getQualifier()) {
             if (NNS->getKind() == NestedNameSpecifier::TypeSpec &&
                 isa<TemplateSpecializationType>(NNS->getAsType())) {
-               continue;
+              continue;
             }
           }
         }
@@ -224,6 +217,23 @@ static void checkForFunctionCall(Sema &S, const FunctionDecl *FD,
     }
   }
 
+  return State;
+}
+
+static void checkForFunctionCall(Sema &S, const FunctionDecl *FD,
+                                 CFGBlock &Block, unsigned ExitID,
+                                 llvm::SmallVectorImpl<RecursiveState> &States,
+                                 RecursiveState State) {
+  unsigned ID = Block.getBlockID();
+
+  // A block's state can only move to a higher state.
+  if (States[ID] >= State)
+    return;
+
+  States[ID] = State;
+
+  State = updateRecursiveState(FD, Block, ExitID, State);
+
   for (CFGBlock::succ_iterator I = Block.succ_begin(), E = Block.succ_end();
        I != E; ++I)
     if (*I)
