From c18f4b16047b3d163ebd585ce39cc7028001cea0 Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Thu, 15 Jun 2023 15:20:20 +0200 Subject: [PATCH] Sync files and make language specific rename. --- .../go/dataflow/internal/FlowSummaryImpl.qll | 80 ++++++------------- .../internal/FlowSummaryImplSpecific.qll | 2 +- .../dataflow/internal/FlowSummaryImpl.qll | 80 ++++++------------- .../internal/FlowSummaryImplSpecific.qll | 2 +- .../dataflow/new/internal/FlowSummaryImpl.qll | 80 ++++++------------- .../new/internal/FlowSummaryImplSpecific.qll | 2 +- .../dataflow/internal/FlowSummaryImpl.qll | 80 ++++++------------- .../internal/FlowSummaryImplSpecific.qll | 2 +- .../dataflow/internal/FlowSummaryImpl.qll | 80 ++++++------------- .../internal/FlowSummaryImplSpecific.qll | 2 +- 10 files changed, 125 insertions(+), 285 deletions(-) diff --git a/go/ql/lib/semmle/go/dataflow/internal/FlowSummaryImpl.qll b/go/ql/lib/semmle/go/dataflow/internal/FlowSummaryImpl.qll index 9ea7c44c50c..af43319f817 100644 --- a/go/ql/lib/semmle/go/dataflow/internal/FlowSummaryImpl.qll +++ b/go/ql/lib/semmle/go/dataflow/internal/FlowSummaryImpl.qll @@ -23,29 +23,30 @@ module Public { * content type, or a return kind. */ class SummaryComponent extends TSummaryComponent { - /** Gets a textual representation of this summary component. */ - string toString() { - exists(ContentSet c | this = TContentSummaryComponent(c) and result = c.toString()) - or - exists(ContentSet c | this = TWithoutContentSummaryComponent(c) and result = "without " + c) - or - exists(ContentSet c | this = TWithContentSummaryComponent(c) and result = "with " + c) + /** Gets a textual representation of this component used for flow summaries. */ + string getAccessStep() { + result = getAccessStepSpecific(this) or exists(ArgumentPosition pos | - this = TParameterSummaryComponent(pos) and result = "parameter " + pos + this = TParameterSummaryComponent(pos) and + result = "Parameter[" + getArgumentPosition(pos) + "]" ) or exists(ParameterPosition pos | - this = TArgumentSummaryComponent(pos) and result = "argument " + pos + this = TArgumentSummaryComponent(pos) and + result = "Argument[" + getParameterPosition(pos) + "]" ) or - exists(ReturnKind rk | this = TReturnSummaryComponent(rk) and result = "return (" + rk + ")") - or - exists(SummaryComponent::SyntheticGlobal sg | - this = TSyntheticGlobalSummaryComponent(sg) and - result = "synthetic global (" + sg + ")" + exists(string synthetic | + this = TSyntheticGlobalSummaryComponent(synthetic) and + result = "SyntheticGlobal[" + synthetic + "]" ) + or + this = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue" } + + /** Gets a textual representation of this summary component. */ + string toString() { result = this.getAccessStep() } } /** Provides predicates for constructing summary components. */ @@ -125,19 +126,22 @@ module Public { this = TSingletonSummaryComponentStack(result) or result = this.tail().bottom() } - /** Gets a textual representation of this stack. */ - string toString() { + /** Gets a textual representation of this stack used for MaD models. */ + string getAccessPath() { exists(SummaryComponent head, SummaryComponentStack tail | head = this.head() and tail = this.tail() and - result = tail + "." + head + result = tail.getAccessPath() + "." + head.getAccessStep() ) or exists(SummaryComponent c | this = TSingletonSummaryComponentStack(c) and - result = c.toString() + result = c.getAccessStep() ) } + + /** Gets a textual representation of this stack. */ + string toString() { result = this.getAccessPath() } } /** Provides predicates for constructing stacks of summary components. */ @@ -166,42 +170,6 @@ module Public { SummaryComponentStack return(ReturnKind rk) { result = singleton(SummaryComponent::return(rk)) } } - /** Gets a textual representation of this component used for flow summaries. */ - private string getComponent(SummaryComponent sc) { - result = getComponentSpecific(sc) - or - exists(ArgumentPosition pos | - sc = TParameterSummaryComponent(pos) and - result = "Parameter[" + getArgumentPosition(pos) + "]" - ) - or - exists(ParameterPosition pos | - sc = TArgumentSummaryComponent(pos) and - result = "Argument[" + getParameterPosition(pos) + "]" - ) - or - exists(string synthetic | - sc = TSyntheticGlobalSummaryComponent(synthetic) and - result = "SyntheticGlobal[" + synthetic + "]" - ) - or - sc = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue" - } - - /** Gets a textual representation of this stack used for flow summaries. */ - string getComponentStack(SummaryComponentStack stack) { - exists(SummaryComponent head, SummaryComponentStack tail | - head = stack.head() and - tail = stack.tail() and - result = getComponentStack(tail) + "." + getComponent(head) - ) - or - exists(SummaryComponent c | - stack = TSingletonSummaryComponentStack(c) and - result = getComponent(c) - ) - } - /** * A class that exists for QL technical reasons only (the IPA type used * to represent component stacks needs to be bounded). @@ -1382,8 +1350,8 @@ module Private { c.relevantSummary(input, output, preservesValue) and csv = c.getCallableCsv() // Callable information - + getComponentStack(input) + ";" // input - + getComponentStack(output) + ";" // output + + input.getAccessPath() + ";" // input + + output.getAccessPath() + ";" // output + renderKind(preservesValue) + ";" // kind + renderProvenance(c) // provenance ) diff --git a/go/ql/lib/semmle/go/dataflow/internal/FlowSummaryImplSpecific.qll b/go/ql/lib/semmle/go/dataflow/internal/FlowSummaryImplSpecific.qll index 609790659f8..f6b3731fc3d 100644 --- a/go/ql/lib/semmle/go/dataflow/internal/FlowSummaryImplSpecific.qll +++ b/go/ql/lib/semmle/go/dataflow/internal/FlowSummaryImplSpecific.qll @@ -111,7 +111,7 @@ private string getContentSpecific(Content c) { } /** Gets the textual representation of the content in the format used for flow summaries. */ -string getComponentSpecific(SummaryComponent sc) { +string getAccessStepSpecific(SummaryComponent sc) { exists(Content c | sc = TContentSummaryComponent(c) and result = getContentSpecific(c)) or exists(ReturnKind rk | diff --git a/java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImpl.qll b/java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImpl.qll index 9ea7c44c50c..af43319f817 100644 --- a/java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImpl.qll +++ b/java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImpl.qll @@ -23,29 +23,30 @@ module Public { * content type, or a return kind. */ class SummaryComponent extends TSummaryComponent { - /** Gets a textual representation of this summary component. */ - string toString() { - exists(ContentSet c | this = TContentSummaryComponent(c) and result = c.toString()) - or - exists(ContentSet c | this = TWithoutContentSummaryComponent(c) and result = "without " + c) - or - exists(ContentSet c | this = TWithContentSummaryComponent(c) and result = "with " + c) + /** Gets a textual representation of this component used for flow summaries. */ + string getAccessStep() { + result = getAccessStepSpecific(this) or exists(ArgumentPosition pos | - this = TParameterSummaryComponent(pos) and result = "parameter " + pos + this = TParameterSummaryComponent(pos) and + result = "Parameter[" + getArgumentPosition(pos) + "]" ) or exists(ParameterPosition pos | - this = TArgumentSummaryComponent(pos) and result = "argument " + pos + this = TArgumentSummaryComponent(pos) and + result = "Argument[" + getParameterPosition(pos) + "]" ) or - exists(ReturnKind rk | this = TReturnSummaryComponent(rk) and result = "return (" + rk + ")") - or - exists(SummaryComponent::SyntheticGlobal sg | - this = TSyntheticGlobalSummaryComponent(sg) and - result = "synthetic global (" + sg + ")" + exists(string synthetic | + this = TSyntheticGlobalSummaryComponent(synthetic) and + result = "SyntheticGlobal[" + synthetic + "]" ) + or + this = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue" } + + /** Gets a textual representation of this summary component. */ + string toString() { result = this.getAccessStep() } } /** Provides predicates for constructing summary components. */ @@ -125,19 +126,22 @@ module Public { this = TSingletonSummaryComponentStack(result) or result = this.tail().bottom() } - /** Gets a textual representation of this stack. */ - string toString() { + /** Gets a textual representation of this stack used for MaD models. */ + string getAccessPath() { exists(SummaryComponent head, SummaryComponentStack tail | head = this.head() and tail = this.tail() and - result = tail + "." + head + result = tail.getAccessPath() + "." + head.getAccessStep() ) or exists(SummaryComponent c | this = TSingletonSummaryComponentStack(c) and - result = c.toString() + result = c.getAccessStep() ) } + + /** Gets a textual representation of this stack. */ + string toString() { result = this.getAccessPath() } } /** Provides predicates for constructing stacks of summary components. */ @@ -166,42 +170,6 @@ module Public { SummaryComponentStack return(ReturnKind rk) { result = singleton(SummaryComponent::return(rk)) } } - /** Gets a textual representation of this component used for flow summaries. */ - private string getComponent(SummaryComponent sc) { - result = getComponentSpecific(sc) - or - exists(ArgumentPosition pos | - sc = TParameterSummaryComponent(pos) and - result = "Parameter[" + getArgumentPosition(pos) + "]" - ) - or - exists(ParameterPosition pos | - sc = TArgumentSummaryComponent(pos) and - result = "Argument[" + getParameterPosition(pos) + "]" - ) - or - exists(string synthetic | - sc = TSyntheticGlobalSummaryComponent(synthetic) and - result = "SyntheticGlobal[" + synthetic + "]" - ) - or - sc = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue" - } - - /** Gets a textual representation of this stack used for flow summaries. */ - string getComponentStack(SummaryComponentStack stack) { - exists(SummaryComponent head, SummaryComponentStack tail | - head = stack.head() and - tail = stack.tail() and - result = getComponentStack(tail) + "." + getComponent(head) - ) - or - exists(SummaryComponent c | - stack = TSingletonSummaryComponentStack(c) and - result = getComponent(c) - ) - } - /** * A class that exists for QL technical reasons only (the IPA type used * to represent component stacks needs to be bounded). @@ -1382,8 +1350,8 @@ module Private { c.relevantSummary(input, output, preservesValue) and csv = c.getCallableCsv() // Callable information - + getComponentStack(input) + ";" // input - + getComponentStack(output) + ";" // output + + input.getAccessPath() + ";" // input + + output.getAccessPath() + ";" // output + renderKind(preservesValue) + ";" // kind + renderProvenance(c) // provenance ) diff --git a/java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImplSpecific.qll b/java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImplSpecific.qll index 77780aa3a46..aefc29f2fb3 100644 --- a/java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImplSpecific.qll +++ b/java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImplSpecific.qll @@ -194,7 +194,7 @@ private string getContentSpecific(Content c) { } /** Gets the textual representation of the content in the format used for flow summaries. */ -string getComponentSpecific(SummaryComponent sc) { +string getAccessStepSpecific(SummaryComponent sc) { exists(Content c | sc = TContentSummaryComponent(c) and result = getContentSpecific(c)) } diff --git a/python/ql/lib/semmle/python/dataflow/new/internal/FlowSummaryImpl.qll b/python/ql/lib/semmle/python/dataflow/new/internal/FlowSummaryImpl.qll index 9ea7c44c50c..af43319f817 100644 --- a/python/ql/lib/semmle/python/dataflow/new/internal/FlowSummaryImpl.qll +++ b/python/ql/lib/semmle/python/dataflow/new/internal/FlowSummaryImpl.qll @@ -23,29 +23,30 @@ module Public { * content type, or a return kind. */ class SummaryComponent extends TSummaryComponent { - /** Gets a textual representation of this summary component. */ - string toString() { - exists(ContentSet c | this = TContentSummaryComponent(c) and result = c.toString()) - or - exists(ContentSet c | this = TWithoutContentSummaryComponent(c) and result = "without " + c) - or - exists(ContentSet c | this = TWithContentSummaryComponent(c) and result = "with " + c) + /** Gets a textual representation of this component used for flow summaries. */ + string getAccessStep() { + result = getAccessStepSpecific(this) or exists(ArgumentPosition pos | - this = TParameterSummaryComponent(pos) and result = "parameter " + pos + this = TParameterSummaryComponent(pos) and + result = "Parameter[" + getArgumentPosition(pos) + "]" ) or exists(ParameterPosition pos | - this = TArgumentSummaryComponent(pos) and result = "argument " + pos + this = TArgumentSummaryComponent(pos) and + result = "Argument[" + getParameterPosition(pos) + "]" ) or - exists(ReturnKind rk | this = TReturnSummaryComponent(rk) and result = "return (" + rk + ")") - or - exists(SummaryComponent::SyntheticGlobal sg | - this = TSyntheticGlobalSummaryComponent(sg) and - result = "synthetic global (" + sg + ")" + exists(string synthetic | + this = TSyntheticGlobalSummaryComponent(synthetic) and + result = "SyntheticGlobal[" + synthetic + "]" ) + or + this = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue" } + + /** Gets a textual representation of this summary component. */ + string toString() { result = this.getAccessStep() } } /** Provides predicates for constructing summary components. */ @@ -125,19 +126,22 @@ module Public { this = TSingletonSummaryComponentStack(result) or result = this.tail().bottom() } - /** Gets a textual representation of this stack. */ - string toString() { + /** Gets a textual representation of this stack used for MaD models. */ + string getAccessPath() { exists(SummaryComponent head, SummaryComponentStack tail | head = this.head() and tail = this.tail() and - result = tail + "." + head + result = tail.getAccessPath() + "." + head.getAccessStep() ) or exists(SummaryComponent c | this = TSingletonSummaryComponentStack(c) and - result = c.toString() + result = c.getAccessStep() ) } + + /** Gets a textual representation of this stack. */ + string toString() { result = this.getAccessPath() } } /** Provides predicates for constructing stacks of summary components. */ @@ -166,42 +170,6 @@ module Public { SummaryComponentStack return(ReturnKind rk) { result = singleton(SummaryComponent::return(rk)) } } - /** Gets a textual representation of this component used for flow summaries. */ - private string getComponent(SummaryComponent sc) { - result = getComponentSpecific(sc) - or - exists(ArgumentPosition pos | - sc = TParameterSummaryComponent(pos) and - result = "Parameter[" + getArgumentPosition(pos) + "]" - ) - or - exists(ParameterPosition pos | - sc = TArgumentSummaryComponent(pos) and - result = "Argument[" + getParameterPosition(pos) + "]" - ) - or - exists(string synthetic | - sc = TSyntheticGlobalSummaryComponent(synthetic) and - result = "SyntheticGlobal[" + synthetic + "]" - ) - or - sc = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue" - } - - /** Gets a textual representation of this stack used for flow summaries. */ - string getComponentStack(SummaryComponentStack stack) { - exists(SummaryComponent head, SummaryComponentStack tail | - head = stack.head() and - tail = stack.tail() and - result = getComponentStack(tail) + "." + getComponent(head) - ) - or - exists(SummaryComponent c | - stack = TSingletonSummaryComponentStack(c) and - result = getComponent(c) - ) - } - /** * A class that exists for QL technical reasons only (the IPA type used * to represent component stacks needs to be bounded). @@ -1382,8 +1350,8 @@ module Private { c.relevantSummary(input, output, preservesValue) and csv = c.getCallableCsv() // Callable information - + getComponentStack(input) + ";" // input - + getComponentStack(output) + ";" // output + + input.getAccessPath() + ";" // input + + output.getAccessPath() + ";" // output + renderKind(preservesValue) + ";" // kind + renderProvenance(c) // provenance ) diff --git a/python/ql/lib/semmle/python/dataflow/new/internal/FlowSummaryImplSpecific.qll b/python/ql/lib/semmle/python/dataflow/new/internal/FlowSummaryImplSpecific.qll index 0f58d6988f0..a13ae3d1874 100644 --- a/python/ql/lib/semmle/python/dataflow/new/internal/FlowSummaryImplSpecific.qll +++ b/python/ql/lib/semmle/python/dataflow/new/internal/FlowSummaryImplSpecific.qll @@ -129,7 +129,7 @@ SummaryComponent interpretComponentSpecific(AccessPathToken c) { } /** Gets the textual representation of a summary component in the format used for flow summaries. */ -string getComponentSpecific(SummaryComponent sc) { +string getAccessStepSpecific(SummaryComponent sc) { sc = TContentSummaryComponent(any(ListElementContent c)) and result = "ListElement" } diff --git a/ruby/ql/lib/codeql/ruby/dataflow/internal/FlowSummaryImpl.qll b/ruby/ql/lib/codeql/ruby/dataflow/internal/FlowSummaryImpl.qll index 9ea7c44c50c..af43319f817 100644 --- a/ruby/ql/lib/codeql/ruby/dataflow/internal/FlowSummaryImpl.qll +++ b/ruby/ql/lib/codeql/ruby/dataflow/internal/FlowSummaryImpl.qll @@ -23,29 +23,30 @@ module Public { * content type, or a return kind. */ class SummaryComponent extends TSummaryComponent { - /** Gets a textual representation of this summary component. */ - string toString() { - exists(ContentSet c | this = TContentSummaryComponent(c) and result = c.toString()) - or - exists(ContentSet c | this = TWithoutContentSummaryComponent(c) and result = "without " + c) - or - exists(ContentSet c | this = TWithContentSummaryComponent(c) and result = "with " + c) + /** Gets a textual representation of this component used for flow summaries. */ + string getAccessStep() { + result = getAccessStepSpecific(this) or exists(ArgumentPosition pos | - this = TParameterSummaryComponent(pos) and result = "parameter " + pos + this = TParameterSummaryComponent(pos) and + result = "Parameter[" + getArgumentPosition(pos) + "]" ) or exists(ParameterPosition pos | - this = TArgumentSummaryComponent(pos) and result = "argument " + pos + this = TArgumentSummaryComponent(pos) and + result = "Argument[" + getParameterPosition(pos) + "]" ) or - exists(ReturnKind rk | this = TReturnSummaryComponent(rk) and result = "return (" + rk + ")") - or - exists(SummaryComponent::SyntheticGlobal sg | - this = TSyntheticGlobalSummaryComponent(sg) and - result = "synthetic global (" + sg + ")" + exists(string synthetic | + this = TSyntheticGlobalSummaryComponent(synthetic) and + result = "SyntheticGlobal[" + synthetic + "]" ) + or + this = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue" } + + /** Gets a textual representation of this summary component. */ + string toString() { result = this.getAccessStep() } } /** Provides predicates for constructing summary components. */ @@ -125,19 +126,22 @@ module Public { this = TSingletonSummaryComponentStack(result) or result = this.tail().bottom() } - /** Gets a textual representation of this stack. */ - string toString() { + /** Gets a textual representation of this stack used for MaD models. */ + string getAccessPath() { exists(SummaryComponent head, SummaryComponentStack tail | head = this.head() and tail = this.tail() and - result = tail + "." + head + result = tail.getAccessPath() + "." + head.getAccessStep() ) or exists(SummaryComponent c | this = TSingletonSummaryComponentStack(c) and - result = c.toString() + result = c.getAccessStep() ) } + + /** Gets a textual representation of this stack. */ + string toString() { result = this.getAccessPath() } } /** Provides predicates for constructing stacks of summary components. */ @@ -166,42 +170,6 @@ module Public { SummaryComponentStack return(ReturnKind rk) { result = singleton(SummaryComponent::return(rk)) } } - /** Gets a textual representation of this component used for flow summaries. */ - private string getComponent(SummaryComponent sc) { - result = getComponentSpecific(sc) - or - exists(ArgumentPosition pos | - sc = TParameterSummaryComponent(pos) and - result = "Parameter[" + getArgumentPosition(pos) + "]" - ) - or - exists(ParameterPosition pos | - sc = TArgumentSummaryComponent(pos) and - result = "Argument[" + getParameterPosition(pos) + "]" - ) - or - exists(string synthetic | - sc = TSyntheticGlobalSummaryComponent(synthetic) and - result = "SyntheticGlobal[" + synthetic + "]" - ) - or - sc = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue" - } - - /** Gets a textual representation of this stack used for flow summaries. */ - string getComponentStack(SummaryComponentStack stack) { - exists(SummaryComponent head, SummaryComponentStack tail | - head = stack.head() and - tail = stack.tail() and - result = getComponentStack(tail) + "." + getComponent(head) - ) - or - exists(SummaryComponent c | - stack = TSingletonSummaryComponentStack(c) and - result = getComponent(c) - ) - } - /** * A class that exists for QL technical reasons only (the IPA type used * to represent component stacks needs to be bounded). @@ -1382,8 +1350,8 @@ module Private { c.relevantSummary(input, output, preservesValue) and csv = c.getCallableCsv() // Callable information - + getComponentStack(input) + ";" // input - + getComponentStack(output) + ";" // output + + input.getAccessPath() + ";" // input + + output.getAccessPath() + ";" // output + renderKind(preservesValue) + ";" // kind + renderProvenance(c) // provenance ) diff --git a/ruby/ql/lib/codeql/ruby/dataflow/internal/FlowSummaryImplSpecific.qll b/ruby/ql/lib/codeql/ruby/dataflow/internal/FlowSummaryImplSpecific.qll index d9c0594159a..404cc8c9de5 100644 --- a/ruby/ql/lib/codeql/ruby/dataflow/internal/FlowSummaryImplSpecific.qll +++ b/ruby/ql/lib/codeql/ruby/dataflow/internal/FlowSummaryImplSpecific.qll @@ -140,7 +140,7 @@ SummaryComponent interpretComponentSpecific(AccessPathToken c) { } /** Gets the textual representation of a summary component in the format used for flow summaries. */ -string getComponentSpecific(SummaryComponent sc) { none() } +string getAccessStepSpecific(SummaryComponent sc) { none() } /** Gets the textual representation of a parameter position in the format used for flow summaries. */ string getParameterPosition(ParameterPosition pos) { diff --git a/swift/ql/lib/codeql/swift/dataflow/internal/FlowSummaryImpl.qll b/swift/ql/lib/codeql/swift/dataflow/internal/FlowSummaryImpl.qll index 9ea7c44c50c..af43319f817 100644 --- a/swift/ql/lib/codeql/swift/dataflow/internal/FlowSummaryImpl.qll +++ b/swift/ql/lib/codeql/swift/dataflow/internal/FlowSummaryImpl.qll @@ -23,29 +23,30 @@ module Public { * content type, or a return kind. */ class SummaryComponent extends TSummaryComponent { - /** Gets a textual representation of this summary component. */ - string toString() { - exists(ContentSet c | this = TContentSummaryComponent(c) and result = c.toString()) - or - exists(ContentSet c | this = TWithoutContentSummaryComponent(c) and result = "without " + c) - or - exists(ContentSet c | this = TWithContentSummaryComponent(c) and result = "with " + c) + /** Gets a textual representation of this component used for flow summaries. */ + string getAccessStep() { + result = getAccessStepSpecific(this) or exists(ArgumentPosition pos | - this = TParameterSummaryComponent(pos) and result = "parameter " + pos + this = TParameterSummaryComponent(pos) and + result = "Parameter[" + getArgumentPosition(pos) + "]" ) or exists(ParameterPosition pos | - this = TArgumentSummaryComponent(pos) and result = "argument " + pos + this = TArgumentSummaryComponent(pos) and + result = "Argument[" + getParameterPosition(pos) + "]" ) or - exists(ReturnKind rk | this = TReturnSummaryComponent(rk) and result = "return (" + rk + ")") - or - exists(SummaryComponent::SyntheticGlobal sg | - this = TSyntheticGlobalSummaryComponent(sg) and - result = "synthetic global (" + sg + ")" + exists(string synthetic | + this = TSyntheticGlobalSummaryComponent(synthetic) and + result = "SyntheticGlobal[" + synthetic + "]" ) + or + this = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue" } + + /** Gets a textual representation of this summary component. */ + string toString() { result = this.getAccessStep() } } /** Provides predicates for constructing summary components. */ @@ -125,19 +126,22 @@ module Public { this = TSingletonSummaryComponentStack(result) or result = this.tail().bottom() } - /** Gets a textual representation of this stack. */ - string toString() { + /** Gets a textual representation of this stack used for MaD models. */ + string getAccessPath() { exists(SummaryComponent head, SummaryComponentStack tail | head = this.head() and tail = this.tail() and - result = tail + "." + head + result = tail.getAccessPath() + "." + head.getAccessStep() ) or exists(SummaryComponent c | this = TSingletonSummaryComponentStack(c) and - result = c.toString() + result = c.getAccessStep() ) } + + /** Gets a textual representation of this stack. */ + string toString() { result = this.getAccessPath() } } /** Provides predicates for constructing stacks of summary components. */ @@ -166,42 +170,6 @@ module Public { SummaryComponentStack return(ReturnKind rk) { result = singleton(SummaryComponent::return(rk)) } } - /** Gets a textual representation of this component used for flow summaries. */ - private string getComponent(SummaryComponent sc) { - result = getComponentSpecific(sc) - or - exists(ArgumentPosition pos | - sc = TParameterSummaryComponent(pos) and - result = "Parameter[" + getArgumentPosition(pos) + "]" - ) - or - exists(ParameterPosition pos | - sc = TArgumentSummaryComponent(pos) and - result = "Argument[" + getParameterPosition(pos) + "]" - ) - or - exists(string synthetic | - sc = TSyntheticGlobalSummaryComponent(synthetic) and - result = "SyntheticGlobal[" + synthetic + "]" - ) - or - sc = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue" - } - - /** Gets a textual representation of this stack used for flow summaries. */ - string getComponentStack(SummaryComponentStack stack) { - exists(SummaryComponent head, SummaryComponentStack tail | - head = stack.head() and - tail = stack.tail() and - result = getComponentStack(tail) + "." + getComponent(head) - ) - or - exists(SummaryComponent c | - stack = TSingletonSummaryComponentStack(c) and - result = getComponent(c) - ) - } - /** * A class that exists for QL technical reasons only (the IPA type used * to represent component stacks needs to be bounded). @@ -1382,8 +1350,8 @@ module Private { c.relevantSummary(input, output, preservesValue) and csv = c.getCallableCsv() // Callable information - + getComponentStack(input) + ";" // input - + getComponentStack(output) + ";" // output + + input.getAccessPath() + ";" // input + + output.getAccessPath() + ";" // output + renderKind(preservesValue) + ";" // kind + renderProvenance(c) // provenance ) diff --git a/swift/ql/lib/codeql/swift/dataflow/internal/FlowSummaryImplSpecific.qll b/swift/ql/lib/codeql/swift/dataflow/internal/FlowSummaryImplSpecific.qll index ba84cea946a..8934d0dce06 100644 --- a/swift/ql/lib/codeql/swift/dataflow/internal/FlowSummaryImplSpecific.qll +++ b/swift/ql/lib/codeql/swift/dataflow/internal/FlowSummaryImplSpecific.qll @@ -112,7 +112,7 @@ private string getContentSpecific(ContentSet cs) { } /** Gets the textual representation of a summary component in the format used for flow summaries. */ -string getComponentSpecific(SummaryComponent sc) { +string getAccessStepSpecific(SummaryComponent sc) { exists(ContentSet c | sc = TContentSummaryComponent(c) and result = getContentSpecific(c)) or exists(ReturnKind rk |