Skip to content

Commit e2de0e6

Browse files
committed
Python: Remove RegExpTerm from PrintAST
Since this caused bad performance (as we had to evaluate points-to). Fixes #6964 This approach was motivated by the comment on the issue from @tausbn: > We discussed this internally in the CodeQL Python team, and have > agreed that the best approach for now is to disable the printing of > regex ASTs. I tried to keep our RegExpTerm logic, but doing the fix below did not work, and still evaluated RegExpTerm :| I guess we will just have to revert this PR if we want it back ```diff TRegExpTermNode(RegExpTerm term) { + none() and exists(StrConst str | term.getRootTerm() = getParsedRegExp(str) and shouldPrint(str, _)) } ```
1 parent e93c46a commit e2de0e6

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

python/ql/lib/semmle/python/PrintAst.qll

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ private newtype TPrintAstNode =
5353
shouldPrint(list.getAnItem(), _) and
5454
not list = any(Module mod).getBody() and
5555
not forall(AstNode child | child = list.getAnItem() | isNotNeeded(child))
56-
} or
57-
TRegExpTermNode(RegExpTerm term) {
58-
exists(StrConst str | term.getRootTerm() = getParsedRegExp(str) and shouldPrint(str, _))
5956
}
6057

6158
/**
@@ -430,32 +427,6 @@ class ParameterNode extends AstElementNode {
430427
*/
431428
class StrConstNode extends AstElementNode {
432429
override StrConst element;
433-
434-
override PrintAstNode getChild(int childIndex) {
435-
childIndex = 0 and result.(RegExpTermNode).getTerm() = getParsedRegExp(element)
436-
}
437-
}
438-
439-
/**
440-
* A print node for a regular expression term.
441-
*/
442-
class RegExpTermNode extends TRegExpTermNode, PrintAstNode {
443-
RegExpTerm term;
444-
445-
RegExpTermNode() { this = TRegExpTermNode(term) }
446-
447-
/** Gets the `RegExpTerm` for this node. */
448-
RegExpTerm getTerm() { result = term }
449-
450-
override PrintAstNode getChild(int childIndex) {
451-
result.(RegExpTermNode).getTerm() = term.getChild(childIndex)
452-
}
453-
454-
override string toString() {
455-
result = "[" + strictconcat(term.getPrimaryQLClass(), " | ") + "] " + term.toString()
456-
}
457-
458-
override Location getLocation() { result = term.getLocation() }
459430
}
460431

461432
/**

0 commit comments

Comments
 (0)