mirror of
https://github.com/hohn/codeql-cpp-ast.git
synced 2025-12-16 06:13:04 +01:00
better name for output
This commit is contained in:
committed by
=Michael Hohn
parent
c93451f34f
commit
3ae5b45687
@@ -29,13 +29,13 @@
|
||||
|
||||
# Generate SVG
|
||||
cd ~/w/codeql-cpp/queries/printast.dot/cpp
|
||||
dot -Tsvg < ./print-ast.dot > ./printast-ast.svg
|
||||
open -a safari ./printast-ast.svg
|
||||
dot -Tsvg < ./print-ast.dot > ./print-ast.svg
|
||||
open -a safari ./print-ast.svg
|
||||
|
||||
#+END_SRC
|
||||
|
||||
#+CAPTION: AST graph from dot
|
||||
#+NAME: fig:graph-ast-1
|
||||
[[./queries/printast.dot/cpp/printast-ast.svg]]
|
||||
[[./queries/printast.dot/cpp/print-ast.svg]]
|
||||
|
||||
|
||||
|
||||
24
queries/printast.dot/cpp/print-ast.dot
Normal file
24
queries/printast.dot/cpp/print-ast.dot
Normal file
@@ -0,0 +1,24 @@
|
||||
digraph {
|
||||
compound=true;
|
||||
0[];
|
||||
1[label="[Parameter] argc"; ];
|
||||
2[label="[Parameter] argv"; ];
|
||||
3[label="[ExprStmt] ExprStmt"; ];
|
||||
4[label="[FormattingFunctionCall,FunctionCall] call to printf"; ];
|
||||
5[label="hello world\n"; ];
|
||||
6[label="[ArrayToPointerConversion] array to pointer conversion"; ];
|
||||
7[label="[ReturnStmt] return ..."; ];
|
||||
8[label="[Literal] 0"; ];
|
||||
9[label="[BlockStmt] { ... }"; ];
|
||||
10[label="[TopLevelFunction] int main(int, char**)"; ];
|
||||
0 -> 1[label="getParameter(0)"; ];
|
||||
10 -> 0[label="<params>"; ];
|
||||
3 -> 4[label="getExpr()"; ];
|
||||
4 -> 5[label="getArgument(0)"; ];
|
||||
7 -> 8[label="getExpr()"; ];
|
||||
9 -> 3[label="getStmt(0)"; ];
|
||||
0 -> 2[label="getParameter(1)"; ];
|
||||
10 -> 9[label="getEntryPoint()"; ];
|
||||
4 -> 6[label="getArgument(0).getFullyConverted()"; ];
|
||||
9 -> 7[label="getStmt(1)"; ];
|
||||
}
|
||||
148
queries/printast.dot/cpp/print-ast.svg
Normal file
148
queries/printast.dot/cpp/print-ast.svg
Normal file
@@ -0,0 +1,148 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Generated by graphviz version 2.48.0 (20210717.1556)
|
||||
-->
|
||||
<!-- Pages: 1 -->
|
||||
<svg width="763pt" height="392pt"
|
||||
viewBox="0.00 0.00 762.92 392.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 388)">
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-388 758.92,-388 758.92,4 -4,4"/>
|
||||
<!-- 0 -->
|
||||
<g id="node1" class="node">
|
||||
<title>0</title>
|
||||
<ellipse fill="none" stroke="black" cx="233.49" cy="-279" rx="27" ry="18"/>
|
||||
<text text-anchor="middle" x="233.49" y="-275.3" font-family="Times,serif" font-size="14.00">0</text>
|
||||
</g>
|
||||
<!-- 1 -->
|
||||
<g id="node2" class="node">
|
||||
<title>1</title>
|
||||
<ellipse fill="none" stroke="black" cx="71.49" cy="-192" rx="71.49" ry="18"/>
|
||||
<text text-anchor="middle" x="71.49" y="-188.3" font-family="Times,serif" font-size="14.00">[Parameter] argc</text>
|
||||
</g>
|
||||
<!-- 0->1 -->
|
||||
<g id="edge1" class="edge">
|
||||
<title>0->1</title>
|
||||
<path fill="none" stroke="black" d="M208.84,-271.07C189.16,-265.03 161.2,-255.32 138.49,-243 124.53,-235.43 110.26,-225.19 98.5,-215.95"/>
|
||||
<polygon fill="black" stroke="black" points="100.41,-212.99 90.42,-209.45 96.02,-218.45 100.41,-212.99"/>
|
||||
<text text-anchor="middle" x="183.99" y="-231.8" font-family="Times,serif" font-size="14.00">getParameter(0)</text>
|
||||
</g>
|
||||
<!-- 2 -->
|
||||
<g id="node3" class="node">
|
||||
<title>2</title>
|
||||
<ellipse fill="none" stroke="black" cx="233.49" cy="-192" rx="72.29" ry="18"/>
|
||||
<text text-anchor="middle" x="233.49" y="-188.3" font-family="Times,serif" font-size="14.00">[Parameter] argv</text>
|
||||
</g>
|
||||
<!-- 0->2 -->
|
||||
<g id="edge7" class="edge">
|
||||
<title>0->2</title>
|
||||
<path fill="none" stroke="black" d="M233.49,-260.8C233.49,-249.16 233.49,-233.55 233.49,-220.24"/>
|
||||
<polygon fill="black" stroke="black" points="236.99,-220.18 233.49,-210.18 229.99,-220.18 236.99,-220.18"/>
|
||||
<text text-anchor="middle" x="278.99" y="-231.8" font-family="Times,serif" font-size="14.00">getParameter(1)</text>
|
||||
</g>
|
||||
<!-- 3 -->
|
||||
<g id="node4" class="node">
|
||||
<title>3</title>
|
||||
<ellipse fill="none" stroke="black" cx="412.49" cy="-192" rx="89.08" ry="18"/>
|
||||
<text text-anchor="middle" x="412.49" y="-188.3" font-family="Times,serif" font-size="14.00">[ExprStmt] ExprStmt</text>
|
||||
</g>
|
||||
<!-- 4 -->
|
||||
<g id="node5" class="node">
|
||||
<title>4</title>
|
||||
<ellipse fill="none" stroke="black" cx="394.49" cy="-105" rx="201.46" ry="18"/>
|
||||
<text text-anchor="middle" x="394.49" y="-101.3" font-family="Times,serif" font-size="14.00">[FormattingFunctionCall,FunctionCall] call to printf</text>
|
||||
</g>
|
||||
<!-- 3->4 -->
|
||||
<g id="edge3" class="edge">
|
||||
<title>3->4</title>
|
||||
<path fill="none" stroke="black" d="M408.85,-173.8C406.39,-162.16 403.08,-146.55 400.26,-133.24"/>
|
||||
<polygon fill="black" stroke="black" points="403.63,-132.23 398.13,-123.18 396.78,-133.68 403.63,-132.23"/>
|
||||
<text text-anchor="middle" x="432.49" y="-144.8" font-family="Times,serif" font-size="14.00">getExpr()</text>
|
||||
</g>
|
||||
<!-- 5 -->
|
||||
<g id="node6" class="node">
|
||||
<title>5</title>
|
||||
<ellipse fill="none" stroke="black" cx="251.49" cy="-18" rx="52.79" ry="18"/>
|
||||
<text text-anchor="middle" x="251.49" y="-14.3" font-family="Times,serif" font-size="14.00">hello world</text>
|
||||
</g>
|
||||
<!-- 4->5 -->
|
||||
<g id="edge4" class="edge">
|
||||
<title>4->5</title>
|
||||
<path fill="none" stroke="black" d="M365.9,-87C342.67,-73.2 309.85,-53.69 285.32,-39.11"/>
|
||||
<polygon fill="black" stroke="black" points="287.07,-36.08 276.69,-33.98 283.5,-42.09 287.07,-36.08"/>
|
||||
<text text-anchor="middle" x="377.49" y="-57.8" font-family="Times,serif" font-size="14.00">getArgument(0)</text>
|
||||
</g>
|
||||
<!-- 6 -->
|
||||
<g id="node7" class="node">
|
||||
<title>6</title>
|
||||
<ellipse fill="none" stroke="black" cx="538.49" cy="-18" rx="216.36" ry="18"/>
|
||||
<text text-anchor="middle" x="538.49" y="-14.3" font-family="Times,serif" font-size="14.00">[ArrayToPointerConversion] array to pointer conversion</text>
|
||||
</g>
|
||||
<!-- 4->6 -->
|
||||
<g id="edge9" class="edge">
|
||||
<title>4->6</title>
|
||||
<path fill="none" stroke="black" d="M423.29,-87C445.56,-73.86 476.58,-55.55 500.82,-41.24"/>
|
||||
<polygon fill="black" stroke="black" points="502.92,-44.06 509.75,-35.97 499.36,-38.04 502.92,-44.06"/>
|
||||
<text text-anchor="middle" x="579.49" y="-57.8" font-family="Times,serif" font-size="14.00">getArgument(0).getFullyConverted()</text>
|
||||
</g>
|
||||
<!-- 7 -->
|
||||
<g id="node8" class="node">
|
||||
<title>7</title>
|
||||
<ellipse fill="none" stroke="black" cx="645.49" cy="-192" rx="91.78" ry="18"/>
|
||||
<text text-anchor="middle" x="645.49" y="-188.3" font-family="Times,serif" font-size="14.00">[ReturnStmt] return ...</text>
|
||||
</g>
|
||||
<!-- 8 -->
|
||||
<g id="node9" class="node">
|
||||
<title>8</title>
|
||||
<ellipse fill="none" stroke="black" cx="662.49" cy="-105" rx="48.19" ry="18"/>
|
||||
<text text-anchor="middle" x="662.49" y="-101.3" font-family="Times,serif" font-size="14.00">[Literal] 0</text>
|
||||
</g>
|
||||
<!-- 7->8 -->
|
||||
<g id="edge5" class="edge">
|
||||
<title>7->8</title>
|
||||
<path fill="none" stroke="black" d="M648.93,-173.8C651.26,-162.16 654.38,-146.55 657.05,-133.24"/>
|
||||
<polygon fill="black" stroke="black" points="660.53,-133.67 659.06,-123.18 653.67,-132.29 660.53,-133.67"/>
|
||||
<text text-anchor="middle" x="682.49" y="-144.8" font-family="Times,serif" font-size="14.00">getExpr()</text>
|
||||
</g>
|
||||
<!-- 9 -->
|
||||
<g id="node10" class="node">
|
||||
<title>9</title>
|
||||
<ellipse fill="none" stroke="black" cx="412.49" cy="-279" rx="77.99" ry="18"/>
|
||||
<text text-anchor="middle" x="412.49" y="-275.3" font-family="Times,serif" font-size="14.00">[BlockStmt] { ... }</text>
|
||||
</g>
|
||||
<!-- 9->3 -->
|
||||
<g id="edge6" class="edge">
|
||||
<title>9->3</title>
|
||||
<path fill="none" stroke="black" d="M412.49,-260.8C412.49,-249.16 412.49,-233.55 412.49,-220.24"/>
|
||||
<polygon fill="black" stroke="black" points="415.99,-220.18 412.49,-210.18 408.99,-220.18 415.99,-220.18"/>
|
||||
<text text-anchor="middle" x="442.49" y="-231.8" font-family="Times,serif" font-size="14.00">getStmt(0)</text>
|
||||
</g>
|
||||
<!-- 9->7 -->
|
||||
<g id="edge10" class="edge">
|
||||
<title>9->7</title>
|
||||
<path fill="none" stroke="black" d="M452.28,-263.48C491.47,-249.19 551.51,-227.29 594.25,-211.69"/>
|
||||
<polygon fill="black" stroke="black" points="595.71,-214.89 603.9,-208.17 593.31,-208.31 595.71,-214.89"/>
|
||||
<text text-anchor="middle" x="573.49" y="-231.8" font-family="Times,serif" font-size="14.00">getStmt(1)</text>
|
||||
</g>
|
||||
<!-- 10 -->
|
||||
<g id="node11" class="node">
|
||||
<title>10</title>
|
||||
<ellipse fill="none" stroke="black" cx="322.49" cy="-366" rx="161.37" ry="18"/>
|
||||
<text text-anchor="middle" x="322.49" y="-362.3" font-family="Times,serif" font-size="14.00">[TopLevelFunction] int main(int, char**)</text>
|
||||
</g>
|
||||
<!-- 10->0 -->
|
||||
<g id="edge2" class="edge">
|
||||
<title>10->0</title>
|
||||
<path fill="none" stroke="black" d="M304.48,-347.8C290.38,-334.33 270.7,-315.54 255.64,-301.15"/>
|
||||
<polygon fill="black" stroke="black" points="257.89,-298.46 248.24,-294.08 253.05,-303.52 257.89,-298.46"/>
|
||||
<text text-anchor="middle" x="311.99" y="-318.8" font-family="Times,serif" font-size="14.00"><params></text>
|
||||
</g>
|
||||
<!-- 10->9 -->
|
||||
<g id="edge8" class="edge">
|
||||
<title>10->9</title>
|
||||
<path fill="none" stroke="black" d="M340.71,-347.8C354.18,-335.08 372.69,-317.6 387.53,-303.57"/>
|
||||
<polygon fill="black" stroke="black" points="390.05,-306.01 394.92,-296.6 385.25,-300.92 390.05,-306.01"/>
|
||||
<text text-anchor="middle" x="417.49" y="-318.8" font-family="Times,serif" font-size="14.00">getEntryPoint()</text>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.4 KiB |
Reference in New Issue
Block a user