aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-03-14 21:58:42 +0000
committerTed Kremenek <kremenek@apple.com>2008-03-14 21:58:42 +0000
commit636e6ba3b6deacaddf1933c350e8fb142e1bb58f (patch)
tree4d8f91f0b271cdb73969932e193f3b3aad2f91f5
parent1b9df4c307b650526344ba0a28534268f6920745 (diff)
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
-rw-r--r--Analysis/GRExprEngine.cpp24
1 files changed, 22 insertions, 2 deletions
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<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.