From 924d23f657fedab6cb16d3d8c9fba071014953a9 Mon Sep 17 00:00:00 2001 From: alexet Date: Fri, 25 Oct 2019 14:31:32 +0100 Subject: [PATCH] Cache the computation of core toString predicates. --- cpp/ql/src/semmle/code/cpp/Element.qll | 1 + csharp/ql/src/semmle/code/dotnet/Element.qll | 1 + java/ql/src/semmle/code/Location.qll | 1 + 3 files changed, 3 insertions(+) diff --git a/cpp/ql/src/semmle/code/cpp/Element.qll b/cpp/ql/src/semmle/code/cpp/Element.qll index 7d7f95272d99..2b2361474845 100644 --- a/cpp/ql/src/semmle/code/cpp/Element.qll +++ b/cpp/ql/src/semmle/code/cpp/Element.qll @@ -47,6 +47,7 @@ pragma[inline] */ class ElementBase extends @element { /** Gets a textual representation of this element. */ + cached string toString() { none() } /** diff --git a/csharp/ql/src/semmle/code/dotnet/Element.qll b/csharp/ql/src/semmle/code/dotnet/Element.qll index c06e78551139..9d8b35023aad 100644 --- a/csharp/ql/src/semmle/code/dotnet/Element.qll +++ b/csharp/ql/src/semmle/code/dotnet/Element.qll @@ -10,6 +10,7 @@ import semmle.code.csharp.Location */ class Element extends @dotnet_element { /** Gets a textual representation of this element. */ + cached string toString() { none() } /** Gets the location of this element. */ diff --git a/java/ql/src/semmle/code/Location.qll b/java/ql/src/semmle/code/Location.qll index 92b92fc69edb..a34bba9ddc7c 100755 --- a/java/ql/src/semmle/code/Location.qll +++ b/java/ql/src/semmle/code/Location.qll @@ -84,6 +84,7 @@ class Top extends @top { int getNumberOfCommentLines() { numlines(this, _, _, result) } /** Gets a textual representation of this element. */ + cached string toString() { hasName(this, result) } }