[analyzer] Print the callee name in CallEnter in exploded-graph-rewriter (#116225)

![image](https://github.com/user-attachments/assets/22a82950-d6e1-4e1f-8f82-2f33240b382a)
This commit is contained in:
Balazs Benics 2024-11-15 14:21:35 +01:00 committed by GitHub
parent e0b76bafde
commit 9cbf2dd6f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View File

@ -13,6 +13,7 @@
#include "clang/Analysis/ProgramPoint.h"
#include "clang/AST/ASTContext.h"
#include "clang/Analysis/AnalysisDeclContext.h"
#include "clang/Basic/JsonSupport.h"
using namespace clang;
@ -81,7 +82,10 @@ void ProgramPoint::printJson(llvm::raw_ostream &Out, const char *NL) const {
llvm_unreachable("BlockExitKind");
break;
case ProgramPoint::CallEnterKind:
Out << "CallEnter\"";
Out << "CallEnter\", \"callee_decl\": \"";
Out << AnalysisDeclContext::getFunctionName(
castAs<CallEnter>().getCalleeContext()->getDecl())
<< '\"';
break;
case ProgramPoint::CallExitBeginKind:
Out << "CallExitBegin\"";

View File

@ -86,6 +86,8 @@ class ProgramPoint:
if json_pp["location"] is not None
else None
)
elif self.kind == "CallEnter":
self.callee_decl = json_pp.get("callee_decl", "None")
elif self.kind == "BlockEntrance":
self.block_id = json_pp["block_id"]
@ -618,6 +620,13 @@ class DotDumpVisitor:
'<font color="%s">%s</font></td>'
'<td align="left">[B%d]</td></tr>' % (color, p.kind, p.block_id)
)
elif p.kind == "CallEnter":
self._dump(
'<td width="0"></td>'
'<td align="left" width="0">'
'<font color="%s">%s</font></td>'
'<td align="left">%s</td></tr>' % (color, p.kind, p.callee_decl)
)
else:
# TODO: Print more stuff for other kinds of points.
self._dump(