Hack to hardwire in some panic functions that are not marked noreturn.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48374 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Analysis/GRExprEngine.cpp b/Analysis/GRExprEngine.cpp
index 70cd187..0504e65 100644
--- a/Analysis/GRExprEngine.cpp
+++ b/Analysis/GRExprEngine.cpp
@@ -497,9 +497,29 @@
     
     SaveAndRestore<bool> OldSink(Builder->BuildSinks);
     
-    if (isa<lval::FuncVal>(L))
-      if (cast<lval::FuncVal>(L).getDecl()->getAttr<NoReturnAttr>())
+    if (isa<lval::FuncVal>(L)) {      
+      
+      FunctionDecl* FD = cast<lval::FuncVal>(L).getDecl();
+      
+      if (FD->getAttr<NoReturnAttr>())
         Builder->BuildSinks = true;
+      else {
+        // HACK: Some functions are not marked noreturn, and don't return.
+        //  Here are a few hardwired ones.  If this takes too long, we can
+        //  potentially cache these results.
+        const char* s = FD->getIdentifier()->getName();
+        unsigned n = strlen(s);
+        
+        switch (n) {
+          default:
+            break;
+          case 4:
+            if (!memcmp(s, "exit", 4) || !memcmp(s, "panic", 4)) {
+              Builder->BuildSinks = true; break;
+            }
+        }
+      }
+    }
     
     // Evaluate the call.