-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPrintAST.ql
More file actions
26 lines (24 loc) · 762 Bytes
/
PrintAST.ql
File metadata and controls
26 lines (24 loc) · 762 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
25
26
/**
* @name Print AST
* @description Outputs a representation of the Abstract Syntax Tree.
* @id cpp/print-ast
* @kind graph
*/
import cpp
import semmle.code.cpp.PrintAST
/**
* Temporarily tweak this class or make a copy to control which
* declarations are printed.
*/
class Cfg extends PrintAstConfiguration {
/**
* TWEAK THIS PREDICATE AS NEEDED.
* Holds if the AST for `decl` should be printed.
*/
override predicate shouldPrintDeclaration(Declaration decl) {
// Only include source files with a `test` directory as the parent
// of its containing directory, which fits the expected structure
// of CodeQL unit tests in this project.
decl.getFile().getParentContainer().getParentContainer().getBaseName() = "test"
}
}