Skip to content

Commit f70f32e

Browse files
committed
C++: Fix tests for PrintAST.
1 parent 429aa15 commit f70f32e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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) {
@@ -236,9 +237,11 @@ class PrintASTNode extends TPrintASTNode {
236237

237238
private class PrintableElementBase extends ElementBase {
238239
PrintableElementBase() {
239-
not this instanceof Locatable
240+
shouldPrintFunction(getEnclosingFunction(this))
240241
or
241-
shouldPrintFunction(getEnclosingFunction(this.(Locatable)))
242+
this instanceof Type
243+
or
244+
shouldPrintFunction(this.(DeclarationEntry).getEnclosingElement+())
242245
}
243246

244247
pragma[noinline]

0 commit comments

Comments
 (0)