forked from OSchip/llvm-project
[analyzer] Display cast kinds in program point dumps.
Because cast expressions have their own hierarchy, it's extremely useful to have some information about what kind of casts are we dealing with. llvm-svn: 375185
This commit is contained in:
parent
73b67f0b1a
commit
d325196f19
|
@ -188,7 +188,11 @@ void ProgramPoint::printJson(llvm::raw_ostream &Out, const char *NL) const {
|
|||
|
||||
Out << "Statement\", \"stmt_kind\": \"" << S->getStmtClassName()
|
||||
<< "\", \"stmt_id\": " << S->getID(Context)
|
||||
<< ", \"pointer\": \"" << (const void *)S << "\", \"pretty\": ";
|
||||
<< ", \"pointer\": \"" << (const void *)S << "\", ";
|
||||
if (const auto *CS = dyn_cast<CastExpr>(S))
|
||||
Out << "\"cast_kind\": \"" << CS->getCastKindName() << "\", ";
|
||||
|
||||
Out << "\"pretty\": ";
|
||||
|
||||
S->printJson(Out, nullptr, PP, AddQuotes);
|
||||
|
||||
|
|
|
@ -116,3 +116,51 @@ Node0x3 [shape=record,label=
|
|||
}
|
||||
]}
|
||||
\l}"];
|
||||
|
||||
// CHECK-NEXT: <b>Program point:</b>
|
||||
// CHECK-SAME: <table border="0" align="left" width="0">
|
||||
// CHECK-SAME: <tr>
|
||||
// CHECK-SAME: <td align="left" width="0">
|
||||
// CHECK-SAME: main.cpp:<b>8</b>:<b>9</b>:
|
||||
// CHECK-SAME: </td>
|
||||
// CHECK-SAME: <td align="left" width="0">
|
||||
// CHECK-SAME: <font color="cyan4">
|
||||
// CHECK-SAME: ImplicitCastExpr (LValueToRValue)
|
||||
// CHECK-SAME: </font>
|
||||
// CHECK-SAME: </td>
|
||||
// CHECK-SAME: <td align="left"><i>S5</i></td>
|
||||
// CHECK-SAME: <td align="left">
|
||||
// CHECK-SAME: <font color="cyan3">PreStmt</font>
|
||||
// CHECK-SAME: </td>
|
||||
// CHECK-SAME: <td align="left">y</td>
|
||||
// CHECK-SAME: </tr>
|
||||
// CHECK-SAME: <tr>
|
||||
// CHECK-SAME: <td width="0">
|
||||
// CHECK-SAME: </td>
|
||||
// CHECK-SAME: <td colspan="3" align="left">
|
||||
// CHECK-SAME: <b>Tag: </b>
|
||||
// CHECK-SAME: <font color="crimson">ExprEngine : Clean Node</font>
|
||||
// CHECK-SAME: </td>
|
||||
// CHECK-SAME: </tr>
|
||||
// CHECK-SAME: </table>
|
||||
Node0x4 [shape=record,label=
|
||||
"{
|
||||
{ "node_id": 4, "pointer": "0x4", "has_report": false, "is_sink": false,
|
||||
"program_state": null, "program_points": [
|
||||
{
|
||||
"kind": "Statement",
|
||||
"stmt_kind": "ImplicitCastExpr",
|
||||
"cast_kind": "LValueToRValue",
|
||||
"stmt_point_kind": "PreStmt",
|
||||
"stmt_id": 5,
|
||||
"pointer": "0x6",
|
||||
"pretty": "y",
|
||||
"location": {
|
||||
"file": "main.cpp",
|
||||
"line": 8,
|
||||
"column": 9
|
||||
},
|
||||
"tag": "ExprEngine : Clean Node"
|
||||
}
|
||||
]}
|
||||
\l}"];
|
||||
|
|
|
@ -73,6 +73,8 @@ class ProgramPoint(object):
|
|||
elif self.kind == 'Statement':
|
||||
logging.debug(json_pp)
|
||||
self.stmt_kind = json_pp['stmt_kind']
|
||||
self.cast_kind = json_pp['cast_kind'] \
|
||||
if 'cast_kind' in json_pp else None
|
||||
self.stmt_point_kind = json_pp['stmt_point_kind']
|
||||
self.stmt_id = json_pp['stmt_id']
|
||||
self.pointer = json_pp['pointer']
|
||||
|
@ -497,7 +499,9 @@ class DotDumpVisitor(object):
|
|||
'<td align="left"><i>S%s</i></td>'
|
||||
'<td align="left"><font color="%s">%s</font></td>'
|
||||
'<td align="left">%s</td></tr>'
|
||||
% (self._make_sloc(p.loc), color, p.stmt_kind,
|
||||
% (self._make_sloc(p.loc), color,
|
||||
'%s (%s)' % (p.stmt_kind, p.cast_kind)
|
||||
if p.cast_kind is not None else p.stmt_kind,
|
||||
p.stmt_id, stmt_color, p.stmt_point_kind,
|
||||
self._short_pretty(p.pretty)
|
||||
if not skip_pretty else ''))
|
||||
|
|
Loading…
Reference in New Issue