Skip to content

Commit 8e31b81

Browse files
committed
C++: Add a sample class in PrintAST.ql
I've found myself typing out this class whenever I want to print the AST of one function. I hope it will be useful to others too.
1 parent 1c79ec5 commit 8e31b81

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cpp/ql/src/semmle/code/cpp/PrintAST.ql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,12 @@
77

88
import cpp
99
import PrintAST
10+
11+
/**
12+
* Temporarily tweak this class or make a copy to control which functions are
13+
* printed.
14+
*/
15+
class Cfg extends PrintASTConfiguration {
16+
/** Holds if the AST for `func` should be printed. */
17+
override predicate shouldPrintFunction(Function func) { any() }
18+
}

0 commit comments

Comments
 (0)