[cfe-commits] r48374 - /cfe/trunk/Analysis/GRExprEngine.cpp

Ted Kremenek kremenek at apple.com
Fri Mar 14 14:58:42 PDT 2008


Author: kremenek
Date: Fri Mar 14 16:58:42 2008
New Revision: 48374

URL: http://llvm.org/viewvc/llvm-project?rev=48374&view=rev
Log:
Hack to hardwire in some panic functions that are not marked noreturn.

Modified:
    cfe/trunk/Analysis/GRExprEngine.cpp

Modified: cfe/trunk/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRExprEngine.cpp?rev=48374&r1=48373&r2=48374&view=diff

==============================================================================
--- cfe/trunk/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/Analysis/GRExprEngine.cpp Fri Mar 14 16:58:42 2008
@@ -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.
     





More information about the cfe-commits mailing list