From: Ted Kremenek Date: Fri, 14 Mar 2008 21:58:42 +0000 (+0000) Subject: Hack to hardwire in some panic functions that are not marked noreturn. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=636e6ba3b6deacaddf1933c350e8fb142e1bb58f;p=clang 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 70cd1871bc..0504e65abe 100644 --- a/Analysis/GRExprEngine.cpp +++ b/Analysis/GRExprEngine.cpp @@ -497,9 +497,29 @@ void GRExprEngine::VisitCall(CallExpr* CE, NodeTy* Pred, SaveAndRestore OldSink(Builder->BuildSinks); - if (isa(L)) - if (cast(L).getDecl()->getAttr()) + if (isa(L)) { + + FunctionDecl* FD = cast(L).getDecl(); + + if (FD->getAttr()) 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.