diff options
Diffstat (limited to 'lib/StaticAnalyzer/Core/CallEvent.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/CallEvent.cpp | 68 |
1 files changed, 35 insertions, 33 deletions
diff --git a/lib/StaticAnalyzer/Core/CallEvent.cpp b/lib/StaticAnalyzer/Core/CallEvent.cpp index 778d86ee2b..2375784681 100644 --- a/lib/StaticAnalyzer/Core/CallEvent.cpp +++ b/lib/StaticAnalyzer/Core/CallEvent.cpp @@ -193,9 +193,43 @@ ProgramPoint CallEvent::getProgramPoint(bool IsPreVisit, return PostImplicitCall(D, Loc, getLocationContext(), Tag); } +SVal CallEvent::getArgSVal(unsigned Index) const { + const Expr *ArgE = getArgExpr(Index); + if (!ArgE) + return UnknownVal(); + return getSVal(ArgE); +} + +SourceRange CallEvent::getArgSourceRange(unsigned Index) const { + const Expr *ArgE = getArgExpr(Index); + if (!ArgE) + return SourceRange(); + return ArgE->getSourceRange(); +} + +void CallEvent::dump(raw_ostream &Out) const { + ASTContext &Ctx = getState()->getStateManager().getContext(); + if (const Expr *E = getOriginExpr()) { + E->printPretty(Out, Ctx, 0, Ctx.getPrintingPolicy()); + Out << "\n"; + return; + } + + if (const Decl *D = getDecl()) { + Out << "Call to "; + D->print(Out, Ctx.getPrintingPolicy()); + return; + } + + // FIXME: a string representation of the kind would be nice. + Out << "Unknown call (type " << getKind() << ")"; +} + bool CallEvent::mayBeInlined(const Stmt *S) { - return isa<CallExpr>(S); + // FIXME: Kill this. + return isa<CallExpr>(S) || isa<ObjCMessageExpr>(S) + || isa<CXXConstructExpr>(S); } @@ -283,20 +317,6 @@ bool AnyFunctionCall::argumentsMayEscape() const { return false; } -SVal AnyFunctionCall::getArgSVal(unsigned Index) const { - const Expr *ArgE = getArgExpr(Index); - if (!ArgE) - return UnknownVal(); - return getSVal(ArgE); -} - -SourceRange AnyFunctionCall::getArgSourceRange(unsigned Index) const { - const Expr *ArgE = getArgExpr(Index); - if (!ArgE) - return SourceRange(); - return ArgE->getSourceRange(); -} - const FunctionDecl *SimpleCall::getDecl() const { const FunctionDecl *D = getOriginExpr()->getDirectCallee(); @@ -306,24 +326,6 @@ const FunctionDecl *SimpleCall::getDecl() const { return getSVal(getOriginExpr()->getCallee()).getAsFunctionDecl(); } -void CallEvent::dump(raw_ostream &Out) const { - ASTContext &Ctx = getState()->getStateManager().getContext(); - if (const Expr *E = getOriginExpr()) { - E->printPretty(Out, Ctx, 0, Ctx.getLangOpts()); - Out << "\n"; - return; - } - - if (const Decl *D = getDecl()) { - Out << "Call to "; - D->print(Out, Ctx.getLangOpts()); - return; - } - - // FIXME: a string representation of the kind would be nice. - Out << "Unknown call (type " << getKind() << ")"; -} - void CXXInstanceCall::getExtraInvalidatedRegions(RegionList &Regions) const { if (const MemRegion *R = getCXXThisVal().getAsRegion()) |