joern icon indicating copy to clipboard operation
joern copied to clipboard

(C/C++) "TYPE_DECL" node has empty label in dot output

Open NemoTR opened this issue 2 years ago • 2 comments

This is the code:

struct R
{
    int a;
} r;

This is the attribute of "TYPE_DECL" node "R":

  "7": {
    "inheritsFromTypeFullName": [],
    "name": "R",
    "astParentFullName": "",
    "fullName": "R",
    "astParentType": "",
    "_label": "TYPE_DECL",
    "code": "struct R",
    "isExternal": false,
    "id": 7,
    "order": 1,
    "filename": "/root/workspace/slice/testcase1/tmpdir/a.c"
  },

This ast dot file of global function is:

digraph "<global>" {  
"5" [label = <(METHOD,&lt;global&gt;)<SUB>30</SUB>> ]
"6" [label = <(BLOCK,&lt;empty&gt;,&lt;empty&gt;)> ]
"7" [label = <> ]
"8" [label = <<SUB>32</SUB>> ]
"9" [label = <<SUB>33</SUB>> ]
"10" [label = <> ]
"11" [label = <(LOCAL,struct R s: R)<SUB>35</SUB>> ]
"12" [label = <(METHOD,main)<SUB>37</SUB>> ]
"13" [label = <(BLOCK,&lt;empty&gt;,&lt;empty&gt;)<SUB>38</SUB>> ]
"14" [label = <(RETURN,return 0;,return 0;)<SUB>39</SUB>> ]
"15" [label = <(LITERAL,0,return 0;)<SUB>39</SUB>> ]
"16" [label = <(METHOD_RETURN,int)<SUB>37</SUB>> ]
"18" [label = <(METHOD_RETURN,ANY)> ]
  "5" -> "6" 
  "5" -> "18" 
  "6" -> "7" 
  "6" -> "9" 
  "6" -> "10" 
  "6" -> "11" 
  "6" -> "12" 
  "7" -> "8" 
  "12" -> "13" 
  "12" -> "16" 
  "13" -> "14" 
  "14" -> "15" 
}

The dot "7" has empty labe l (label = <>), this is an error in syntax? This dot file couldn't be used to generate graph picture at my computer because of this syntax error.

And there are so many "&lt", "&gt", "<SUB>" and "</SUB>", is something wrong with them?

NemoTR avatar May 05 '22 11:05 NemoTR

The "&lt", "&gt", "<SUB>" and "</SUB>" lines are from #1349 as part of adding line number information to each node to map back to source code

DavidBakerEffendi avatar May 05 '22 11:05 DavidBakerEffendi

The "&lt", "&gt", "<SUB>" and "</SUB>" lines are from #1349 as part of adding line number information to each node to map back to source code

Got it, thanks.

NemoTR avatar May 05 '22 11:05 NemoTR

Closing, because the issue seems to be "solved". Please re-open it if this is not the case :)

itsacoderepo avatar Jan 15 '23 22:01 itsacoderepo