@@ -91,7 +91,8 @@ private newtype TPrintASTNode =
91
91
TDeclarationEntryNode ( DeclStmt stmt , DeclarationEntry entry ) {
92
92
// We create a unique node for each pair of (stmt, entry), to avoid having one node with
93
93
// multiple parents due to extractor bug CPP-413.
94
- stmt .getADeclarationEntry ( ) = entry
94
+ stmt .getADeclarationEntry ( ) = entry and
95
+ shouldPrintFunction ( stmt .getEnclosingFunction ( ) )
95
96
} or
96
97
TParametersNode ( Function func ) { shouldPrintFunction ( func ) } or
97
98
TConstructorInitializersNode ( Constructor ctor ) {
@@ -234,11 +235,27 @@ class PrintASTNode extends TPrintASTNode {
234
235
private Function getEnclosingFunction ( ) { result = getParent * ( ) .( FunctionNode ) .getFunction ( ) }
235
236
}
236
237
238
+ /**
239
+ * Class that restricts the elements that we compute `qlClass` for.
240
+ */
241
+ private class PrintableElement extends Element {
242
+ PrintableElement ( ) {
243
+ exists ( TASTNode ( this ) )
244
+ or
245
+ exists ( TDeclarationEntryNode ( _, this ) )
246
+ or
247
+ this instanceof Type
248
+ }
249
+
250
+ pragma [ noinline]
251
+ string getAPrimaryQlClass0 ( ) { result = getAPrimaryQlClass ( ) }
252
+ }
253
+
237
254
/**
238
255
* Retrieves the canonical QL class(es) for entity `el`
239
256
*/
240
- private string qlClass ( ElementBase el ) {
241
- result = "[" + concat ( el .getAPrimaryQlClass ( ) , "," ) + "] "
257
+ private string qlClass ( PrintableElement el ) {
258
+ result = "[" + concat ( el .getAPrimaryQlClass0 ( ) , "," ) + "] "
242
259
// Alternative implementation -- do not delete. It is useful for QL class discovery.
243
260
//result = "["+ concat(el.getAQlClass(), ",") + "] "
244
261
}
0 commit comments