Thread-safety analysis:  Fix warning when EXCLUSIVE_LOCKS_REQUIRED
is placed on a function that has no path to the exit block.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164244 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/ThreadSafety.cpp b/lib/Analysis/ThreadSafety.cpp
index e7d9a2d..036d0b8 100644
--- a/lib/Analysis/ThreadSafety.cpp
+++ b/lib/Analysis/ThreadSafety.cpp
@@ -2374,6 +2374,20 @@
     }
   }
 
+
+  // Check to make sure that the exit block is reachable
+  bool ExitUnreachable = true;
+  for (CFGBlock::const_pred_iterator PI = CFGraph->getExit().pred_begin(),
+       PE  = CFGraph->getExit().pred_end(); PI != PE; ++PI) {
+    if (!(*PI)->hasNoReturnElement()) {
+      ExitUnreachable = false;
+      break;
+    }
+  }
+  // Skip the final check if the exit block is unreachable.
+  if (ExitUnreachable)
+    return;
+
   CFGBlockInfo *Initial = &BlockInfo[CFGraph->getEntry().getBlockID()];
   CFGBlockInfo *Final   = &BlockInfo[CFGraph->getExit().getBlockID()];