@@ -91,7 +91,8 @@ private newtype TPrintASTNode =
9191 TDeclarationEntryNode ( DeclStmt stmt , DeclarationEntry entry ) {
9292 // We create a unique node for each pair of (stmt, entry), to avoid having one node with
9393 // multiple parents due to extractor bug CPP-413.
94- stmt .getADeclarationEntry ( ) = entry
94+ stmt .getADeclarationEntry ( ) = entry and
95+ shouldPrintFunction ( stmt .getEnclosingFunction ( ) )
9596 } or
9697 TParametersNode ( Function func ) { shouldPrintFunction ( func ) } or
9798 TConstructorInitializersNode ( Constructor ctor ) {
@@ -234,11 +235,27 @@ class PrintASTNode extends TPrintASTNode {
234235 private Function getEnclosingFunction ( ) { result = getParent * ( ) .( FunctionNode ) .getFunction ( ) }
235236}
236237
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+
237254/**
238255 * Retrieves the canonical QL class(es) for entity `el`
239256 */
240- private string qlClass ( ElementBase el ) {
241- result = "[" + concat ( el .getAPrimaryQlClass ( ) , "," ) + "] "
257+ private string qlClass ( PrintableElement el ) {
258+ result = "[" + concat ( el .getAPrimaryQlClass0 ( ) , "," ) + "] "
242259 // Alternative implementation -- do not delete. It is useful for QL class discovery.
243260 //result = "["+ concat(el.getAQlClass(), ",") + "] "
244261}
0 commit comments