diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-07-10 23:56:23 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-07-10 23:56:23 +0000 |
commit | 0ffbfd1a7f80f9a3c07317cb8f44c562f2ba1ba5 (patch) | |
tree | 032c92cbc84a108c3524f63002ba774ea7d561ed /lib/StaticAnalyzer/Core/Calls.cpp | |
parent | 5ef6e94b294cc47750d8ab220858a36726caba59 (diff) |
[analyzer] Add debug.DumpCalls, which prints out any CallEvents it sees.
This is probably not so useful yet because it is not path-sensitive, though
it does try to show inlining with indentation.
This also adds a dump() method to CallEvent, which should be useful for
debugging.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160030 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/Calls.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/Calls.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/StaticAnalyzer/Core/Calls.cpp b/lib/StaticAnalyzer/Core/Calls.cpp index ced1154da7..94fc5fc8c0 100644 --- a/lib/StaticAnalyzer/Core/Calls.cpp +++ b/lib/StaticAnalyzer/Core/Calls.cpp @@ -310,6 +310,24 @@ const FunctionDecl *SimpleCall::getDecl() const { return getSVal(CE->getCallee()).getAsFunctionDecl(); } +void CallEvent::dump(raw_ostream &Out) const { + ASTContext &Ctx = State->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() << ")"; +} + SVal CXXMemberCall::getCXXThisVal() const { const Expr *Base = getOriginExpr()->getImplicitObjectArgument(); |