-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathcfg.ql
More file actions
24 lines (21 loc) · 791 Bytes
/
cfg.ql
File metadata and controls
24 lines (21 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import cpp
string arguments(Function f, int i) {
result = "," and i = -1
or
result = "" and i = min(int j | function_template_argument(unresolveElement(f), j, _)) - 1
or
result = arguments(f, i - 1) + "," + f.getTemplateArgument(i).toString()
}
string name(Function f) {
if f.isConstructedFrom(_)
then result = f.toString() + "<" + max(arguments(f, _)).suffix(1) + ">"
else
if f instanceof TemplateFunction
then result = f.toString() + " prototype instantiation"
else result = f.toString()
}
from ControlFlowNode x, ControlFlowNode y
where y = x.getASuccessor()
select name(x.getControlFlowScope()), x.getLocation().getStartLine(),
count(x.getAPredecessor*()), // This helps order things sensibly
x.toString(), y.getLocation().getStartLine(), y.toString()