Skip to content

Commit f2425ad

Browse files
committed
Use database extensionals instead of their wrapper classes in two predicates
We are planning to change the charpred of `Function` in the CodeQL C++ library, which means the code changed here will no longer compile. By switching to the extensionals, the code will keep compiling. DIL before: ``` noinline `ConstantExprs::isFunction/1#600714be`( /* Element::Element */ interned unique entity el ) { exists(interned dontcare string _, interned dontcare int _1 | functions(el, _, _1) ) or exists(interned dontcare int _ | exprparents(el, _, el)) } noopt `ConstantExprs::callHasNoTarget/1#e6e8caa4`( /* @funbindexpr */ interned unique entity fc ) { exists(/* Function::Function */ interned entity f | funbind(fc, f) and not(`ConstantExprs::isFunction/1#600714be`(f)) ) } ``` DIL after: ``` noinline `ConstantExprs::isFunction/1#600714be`(/* @element */ interned unique entity el) { exists(interned dontcare string _, interned dontcare int _1 | functions(el, _, _1) ) or exists(interned dontcare int _ | exprparents(el, _, el)) } noopt `ConstantExprs::callHasNoTarget/1#e6e8caa4`( /* @funbindexpr */ interned unique entity fc ) { exists(/* @function */ interned entity f | funbind(fc, f) and not(`ConstantExprs::isFunction/1#600714be`(f)) ) } ```
1 parent a93b1c4 commit f2425ad

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cpp/common/src/codingstandards/cpp/enhancements/ControlFlowGraphEnhancements.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import cpp
1010
* should be in this relation.
1111
*/
1212
pragma[noinline]
13-
private predicate isFunction(Element el) {
14-
el instanceof Function
13+
private predicate isFunction(@element el) {
14+
el instanceof @function
1515
or
1616
el.(Expr).getParent() = el
1717
}
@@ -22,7 +22,7 @@ private predicate isFunction(Element el) {
2222
*/
2323
pragma[noopt]
2424
private predicate callHasNoTarget(@funbindexpr fc) {
25-
exists(Function f |
25+
exists(@function f |
2626
funbind(fc, f) and
2727
not isFunction(f)
2828
)

0 commit comments

Comments
 (0)