From: Ted Kremenek Date: Wed, 30 Apr 2008 17:54:04 +0000 (+0000) Subject: Add conjured symbols for decl initializations. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f47bb7851edac9919f632271fb7dc96b17e1dae0;p=clang Add conjured symbols for decl initializations. Add db_error as panic function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50489 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp index d9a2313aa1..770a133ba7 100644 --- a/lib/Analysis/GRExprEngine.cpp +++ b/lib/Analysis/GRExprEngine.cpp @@ -1046,6 +1046,10 @@ void GRExprEngine::VisitCall(CallExpr* CE, NodeTy* Pred, if (!memcmp(s, "assfail", 7)) Builder->BuildSinks = true; break; + case 8: + if (!memcmp(s ,"db_error", 8)) Builder->BuildSinks = true; + break; + case 14: if (!memcmp(s, "dtrace_assfail", 14)) Builder->BuildSinks = true; break; @@ -1375,9 +1379,24 @@ void GRExprEngine::VisitDeclStmtAux(DeclStmt* DS, ScopedDecl* D, QualType T = VD->getType(); - if (T->isPointerType() || T->isIntegerType()) - St = SetRVal(St, lval::DeclVal(VD), - Ex ? GetRVal(St, Ex) : UndefinedVal()); + if (T->isPointerType() || T->isIntegerType()) { + + RVal V = Ex ? GetRVal(St, Ex) : UndefinedVal(); + + if (Ex && V.isUnknown()) { + + // EXPERIMENTAL: "Conjured" symbols. + + unsigned Count = Builder->getCurrentBlockCount(); + SymbolID Sym = SymMgr.getConjuredSymbol(Ex, Count); + + V = Ex->getType()->isPointerType() + ? cast(lval::SymbolVal(Sym)) + : cast(nonlval::SymbolVal(Sym)); + } + + St = SetRVal(St, lval::DeclVal(VD), V); + } } // Create a new node. We don't really need to create a new NodeSet