File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
cpp/ql/src/semmle/code/cpp Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 11import cpp
2+ private import PrintAST
3+
4+ /**
5+ * Print function declarations only if there is a `PrintASTConfiguration`
6+ * that requests that function, or no `PrintASTConfiguration` exists.
7+ */
8+ private predicate shouldPrintDeclaration ( Declaration decl ) {
9+ not decl instanceof Function
10+ or
11+ not exists ( PrintASTConfiguration c )
12+ or
13+ exists ( PrintASTConfiguration config | config .shouldPrintFunction ( decl ) )
14+ }
215
316/**
417 * Gets a string containing the scope in which this declaration is declared.
@@ -48,6 +61,8 @@ private string getTemplateArgumentString(Declaration d, int i) {
4861 * A `Declaration` extended to add methods for generating strings useful only for dumps and debugging.
4962 */
5063abstract private class DumpDeclaration extends Declaration {
64+ DumpDeclaration ( ) { shouldPrintDeclaration ( this ) }
65+
5166 /**
5267 * Gets a string that uniquely identifies this declaration, suitable for use when debugging queries. Only holds for
5368 * functions, user-defined types, global and namespace-scope variables, and member variables.
You can’t perform that action at this time.
0 commit comments