From d816f7f390d11b7597172ca27a57f617675e4bd1 Mon Sep 17 00:00:00 2001 From: erik-krogh Date: Mon, 15 Aug 2022 21:52:10 +0200 Subject: [PATCH 01/30] add ql/consistent-alert-message --- .../queries/style/ConsistentAlertMessage.ql | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 ql/ql/src/queries/style/ConsistentAlertMessage.ql diff --git a/ql/ql/src/queries/style/ConsistentAlertMessage.ql b/ql/ql/src/queries/style/ConsistentAlertMessage.ql new file mode 100644 index 00000000000..a63824ea38a --- /dev/null +++ b/ql/ql/src/queries/style/ConsistentAlertMessage.ql @@ -0,0 +1,77 @@ +/** + * @name Consistent alert message + * @description The alert message should be consistent across languages. + * @kind problem + * @problem.severity warning + * @id ql/consistent-alert-message + * @tags correctness + * @precision very-high + */ + +import ql + +/** + * Gets a string representation of the entire message in `sel`. + * Ignores everything that is not a string constant. + */ +string getMessage(Select sel) { + result = + strictconcat(String e, Location l | + // is child of an expression in the select (in an uneven position, that's where the message is) + e.getParent*() = sel.getExpr(any(int i | i % 2 = 1)) and l = e.getFullLocation() + | + e.getValue(), " | " order by l.getStartLine(), l.getStartColumn() + ).trim() +} + +/** + * Gets a language agnostic fingerprint for a Select. + * The fingerPrint includes e.g. the query-id, the @kind of the query, and the number of expressions in the select. + * + * This fingerprint avoid false positives where two queries with the same ID behave differently (which is OK). + */ +string getSelectFingerPrint(Select sel) { + exists(File file, QLDoc doc | + sel.getLocation().getFile() = file and + any(TopLevel top | top.getLocation().getFile() = file).getQLDoc() = doc + | + result = + doc.getContents().regexpCapture("(?s).*@id (\\w+)/([\\w\\-]+)\\s.*", 2) // query ID (without lang) + + "-" + doc.getContents().regexpCapture("(?s).*@kind (\\w+)\\s.*", 1) // @kind + + "-" + + strictcount(String e | e.getParent*() = sel.getExpr(any(int i | i % 2 = 1))) // the number of string constants in the select + + "-" + count(sel.getExpr(_)) // and the total number of expressions in the select + ) +} + +/** + * Gets information about the select. + * The query-id (without language), the language, the message from the select, and a language agnostic fingerprint. + */ +Select parseSelect(string id, string lang, string msg, string fingerPrint) { + exists(File file, QLDoc doc | result.getLocation().getFile() = file | + any(TopLevel top | top.getLocation().getFile() = file).getQLDoc() = doc and + id = doc.getContents().regexpCapture("(?s).*@id (\\w+)/([\\w\\-]+)\\s.*", 2) and + lang = doc.getContents().regexpCapture("(?s).*@id (\\w+)/([\\w\\-]+)\\s.*", 1) and + fingerPrint = getSelectFingerPrint(result) and + msg = getMessage(result).toLowerCase() // case normalize, because some languages upper-case methods. + ) and + // excluding experimental + not result.getLocation().getFile().getRelativePath().matches("%/experimental/%") and + not lang = "ql" // excluding QL-for-QL +} + +from Select sel, string id, string lang, string msg, string fingerPrint, string badLangs +where + // for a select with a fingerprint + sel = parseSelect(id, lang, msg, fingerPrint) and + // there exists other languages with the same fingerprint, but other message + badLangs = + strictconcat(string bad | + bad != lang and + exists(parseSelect(id, bad, any(string otherMsg | otherMsg != msg), fingerPrint)) + | + bad, ", " + ) +select sel, + "The " + lang + "/" + id + " query does not have the same alert message as " + badLangs + "." From 5e53124217ddaf6fd803babd2e78c6a7620bfd24 Mon Sep 17 00:00:00 2001 From: erik-krogh Date: Mon, 15 Aug 2022 21:52:34 +0200 Subject: [PATCH 02/30] don't report warning for deprecated classes/predicates --- ql/ql/src/queries/style/docs/ClassDocs.ql | 3 ++- ql/ql/src/queries/style/docs/PredicateDocs.ql | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ql/ql/src/queries/style/docs/ClassDocs.ql b/ql/ql/src/queries/style/docs/ClassDocs.ql index 1dad0867996..f7e5d7ac8d8 100644 --- a/ql/ql/src/queries/style/docs/ClassDocs.ql +++ b/ql/ql/src/queries/style/docs/ClassDocs.ql @@ -22,5 +22,6 @@ predicate badStyle(string s) { from Class c where badStyle(c.getQLDoc().getContents()) and - not c.isPrivate() + not c.isPrivate() and + not c.hasAnnotation("deprecated") select c.getQLDoc(), "The QLDoc for a class should start with 'A', 'An', or 'The'." diff --git a/ql/ql/src/queries/style/docs/PredicateDocs.ql b/ql/ql/src/queries/style/docs/PredicateDocs.ql index 250fbefbbd8..a8a271e7ab8 100644 --- a/ql/ql/src/queries/style/docs/PredicateDocs.ql +++ b/ql/ql/src/queries/style/docs/PredicateDocs.ql @@ -18,6 +18,7 @@ string docLines(Predicate pred) { from Predicate pred, string message where not pred.isPrivate() and + not pred.hasAnnotation("deprecated") and // only considering qldocs that look like a class-doc, to avoid reporting way too much. docLines(pred).matches(["A", "An", "The"] + " %") and // looks like a class doc. not pred instanceof NewTypeBranch and // <- these are actually kinda class-like. From f738567f96b03e33d87d05b2113ca9df09b78e76 Mon Sep 17 00:00:00 2001 From: erik-krogh Date: Wed, 17 Aug 2022 22:56:46 +0200 Subject: [PATCH 03/30] refactor some code out into a helper class QueryDoc --- ql/ql/src/codeql_ql/ast/Ast.qll | 25 +++++++++++++++++++ .../queries/style/ConsistentAlertMessage.ql | 17 ++++++------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/ql/ql/src/codeql_ql/ast/Ast.qll b/ql/ql/src/codeql_ql/ast/Ast.qll index f206ed9d49a..de50b58a5fc 100644 --- a/ql/ql/src/codeql_ql/ast/Ast.qll +++ b/ql/ql/src/codeql_ql/ast/Ast.qll @@ -176,6 +176,29 @@ class QLDoc extends TQLDoc, Comment { override AstNode getParent() { result.getQLDoc() = this } } +/** The QLDoc for a query (i.e. the top comment in a .ql file). */ +class QueryDoc extends QLDoc { + QueryDoc() { + this.getLocation().getFile().getExtension() = "ql" and + this = any(TopLevel t).getQLDoc() + } + + override string getAPrimaryQlClass() { result = "QueryDoc" } + + /** Gets the @kind for the query */ + string getQueryKind() { result = this.getContents().regexpCapture("(?s).*@kind (\\w+)\\s.*", 1) } + + /** Gets the id part (without language) of the @id */ + string getQueryId() { + result = this.getContents().regexpCapture("(?s).*@id (\\w+)/([\\w\\-]+)\\s.*", 2) + } + + /** Gets the language of the @id */ + string getQueryLanguage() { + result = this.getContents().regexpCapture("(?s).*@id (\\w+)/([\\w\\-]+)\\s.*", 1) + } +} + class BlockComment extends TBlockComment, Comment { QL::BlockComment comment; @@ -237,6 +260,8 @@ class Select extends TSelect, AstNode { } override string getAPrimaryQlClass() { result = "Select" } + + QueryDoc getQueryDoc() { result.getLocation().getFile() = this.getLocation().getFile() } } class PredicateOrBuiltin extends TPredOrBuiltin, AstNode { diff --git a/ql/ql/src/queries/style/ConsistentAlertMessage.ql b/ql/ql/src/queries/style/ConsistentAlertMessage.ql index a63824ea38a..854358d8b04 100644 --- a/ql/ql/src/queries/style/ConsistentAlertMessage.ql +++ b/ql/ql/src/queries/style/ConsistentAlertMessage.ql @@ -31,13 +31,10 @@ string getMessage(Select sel) { * This fingerprint avoid false positives where two queries with the same ID behave differently (which is OK). */ string getSelectFingerPrint(Select sel) { - exists(File file, QLDoc doc | - sel.getLocation().getFile() = file and - any(TopLevel top | top.getLocation().getFile() = file).getQLDoc() = doc - | + exists(QueryDoc doc | doc = sel.getQueryDoc() | result = - doc.getContents().regexpCapture("(?s).*@id (\\w+)/([\\w\\-]+)\\s.*", 2) // query ID (without lang) - + "-" + doc.getContents().regexpCapture("(?s).*@kind (\\w+)\\s.*", 1) // @kind + doc.getQueryId() // query ID (without lang) + + "-" + doc.getQueryKind() // @kind + "-" + strictcount(String e | e.getParent*() = sel.getExpr(any(int i | i % 2 = 1))) // the number of string constants in the select + "-" + count(sel.getExpr(_)) // and the total number of expressions in the select @@ -49,10 +46,10 @@ string getSelectFingerPrint(Select sel) { * The query-id (without language), the language, the message from the select, and a language agnostic fingerprint. */ Select parseSelect(string id, string lang, string msg, string fingerPrint) { - exists(File file, QLDoc doc | result.getLocation().getFile() = file | - any(TopLevel top | top.getLocation().getFile() = file).getQLDoc() = doc and - id = doc.getContents().regexpCapture("(?s).*@id (\\w+)/([\\w\\-]+)\\s.*", 2) and - lang = doc.getContents().regexpCapture("(?s).*@id (\\w+)/([\\w\\-]+)\\s.*", 1) and + exists(QueryDoc doc | + doc = result.getQueryDoc() and + id = doc.getQueryId() and + lang = doc.getQueryLanguage() and fingerPrint = getSelectFingerPrint(result) and msg = getMessage(result).toLowerCase() // case normalize, because some languages upper-case methods. ) and From cb110ba266d55569a4206e9cf468ced1c486a7a9 Mon Sep 17 00:00:00 2001 From: erik-krogh Date: Wed, 17 Aug 2022 22:57:27 +0200 Subject: [PATCH 04/30] this is an odd commit --- ql/ql/src/queries/style/ConsistentAlertMessage.ql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ql/ql/src/queries/style/ConsistentAlertMessage.ql b/ql/ql/src/queries/style/ConsistentAlertMessage.ql index 854358d8b04..eb147031f2a 100644 --- a/ql/ql/src/queries/style/ConsistentAlertMessage.ql +++ b/ql/ql/src/queries/style/ConsistentAlertMessage.ql @@ -17,7 +17,7 @@ import ql string getMessage(Select sel) { result = strictconcat(String e, Location l | - // is child of an expression in the select (in an uneven position, that's where the message is) + // is child of an expression in the select (in an odd-indexed position, that's where the message is) e.getParent*() = sel.getExpr(any(int i | i % 2 = 1)) and l = e.getFullLocation() | e.getValue(), " | " order by l.getStartLine(), l.getStartColumn() From 7850ab2dcc88a71088a483aac7cf098aef29a7fa Mon Sep 17 00:00:00 2001 From: erik-krogh Date: Wed, 17 Aug 2022 22:58:58 +0200 Subject: [PATCH 05/30] rename badlangs to otherlangs --- ql/ql/src/queries/style/ConsistentAlertMessage.ql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ql/ql/src/queries/style/ConsistentAlertMessage.ql b/ql/ql/src/queries/style/ConsistentAlertMessage.ql index eb147031f2a..467254430e6 100644 --- a/ql/ql/src/queries/style/ConsistentAlertMessage.ql +++ b/ql/ql/src/queries/style/ConsistentAlertMessage.ql @@ -58,12 +58,12 @@ Select parseSelect(string id, string lang, string msg, string fingerPrint) { not lang = "ql" // excluding QL-for-QL } -from Select sel, string id, string lang, string msg, string fingerPrint, string badLangs +from Select sel, string id, string lang, string msg, string fingerPrint, string otherLangs where // for a select with a fingerprint sel = parseSelect(id, lang, msg, fingerPrint) and // there exists other languages with the same fingerprint, but other message - badLangs = + otherLangs = strictconcat(string bad | bad != lang and exists(parseSelect(id, bad, any(string otherMsg | otherMsg != msg), fingerPrint)) @@ -71,4 +71,4 @@ where bad, ", " ) select sel, - "The " + lang + "/" + id + " query does not have the same alert message as " + badLangs + "." + "The " + lang + "/" + id + " query does not have the same alert message as " + otherLangs + "." From d96dca4f5e03372f3df8537f0f962f4ad2dfb956 Mon Sep 17 00:00:00 2001 From: erik-krogh Date: Wed, 17 Aug 2022 22:59:16 +0200 Subject: [PATCH 06/30] fix typo --- ql/ql/src/queries/style/ConsistentAlertMessage.ql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ql/ql/src/queries/style/ConsistentAlertMessage.ql b/ql/ql/src/queries/style/ConsistentAlertMessage.ql index 467254430e6..c2d0c9be180 100644 --- a/ql/ql/src/queries/style/ConsistentAlertMessage.ql +++ b/ql/ql/src/queries/style/ConsistentAlertMessage.ql @@ -28,7 +28,7 @@ string getMessage(Select sel) { * Gets a language agnostic fingerprint for a Select. * The fingerPrint includes e.g. the query-id, the @kind of the query, and the number of expressions in the select. * - * This fingerprint avoid false positives where two queries with the same ID behave differently (which is OK). + * This fingerprint avoids false positives where two queries with the same ID behave differently (which is OK). */ string getSelectFingerPrint(Select sel) { exists(QueryDoc doc | doc = sel.getQueryDoc() | From 5704995b62607a88b99c9cf48207e5088182d5db Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Thu, 18 Aug 2022 13:23:39 +0100 Subject: [PATCH 07/30] C++: Fix joins in 'cpp/using-expired-stack-address'. --- .../UsingExpiredStackAddress.ql | 48 ++++++++++++++----- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/cpp/ql/src/Likely Bugs/Memory Management/UsingExpiredStackAddress.ql b/cpp/ql/src/Likely Bugs/Memory Management/UsingExpiredStackAddress.ql index 3f3997315d4..1f9743cf9d3 100644 --- a/cpp/ql/src/Likely Bugs/Memory Management/UsingExpiredStackAddress.ql +++ b/cpp/ql/src/Likely Bugs/Memory Management/UsingExpiredStackAddress.ql @@ -106,6 +106,26 @@ predicate inheritanceConversionTypes( toType = convert.getResultType() } +private signature class ConversionInstruction extends UnaryInstruction; + +module Conversion { + signature predicate hasTypes(I instr, Type fromType, Type toType); + + module Using { + pragma[nomagic] + predicate hasOperandAndTypes(I convert, Instruction unary, Type fromType, Type toType) { + project(convert, fromType, toType) and + unary = convert.getUnary() + } + } +} + +pragma[nomagic] +predicate hasObjectAndField(FieldAddressInstruction fai, Instruction object, Field f) { + fai.getObjectAddress() = object and + fai.getField() = f +} + /** Gets the HashCons value of an address computed by `instr`, if any. */ TGlobalAddress globalAddress(Instruction instr) { result = TGlobalVariable(instr.(VariableAddressInstruction).getAstVariable()) @@ -117,25 +137,27 @@ TGlobalAddress globalAddress(Instruction instr) { result = TLoad(globalAddress(load.getSourceAddress())) ) or - exists(ConvertInstruction convert, Type fromType, Type toType | instr = convert | - uncheckedConversionTypes(convert, fromType, toType) and - result = TConversion("unchecked", globalAddress(convert.getUnary()), fromType, toType) + exists(Type fromType, Type toType, Instruction unary | + Conversion::Using::hasOperandAndTypes(instr, + unary, fromType, toType) and + result = TConversion("unchecked", globalAddress(unary), fromType, toType) ) or - exists(CheckedConvertOrNullInstruction convert, Type fromType, Type toType | instr = convert | - checkedConversionTypes(convert, fromType, toType) and - result = TConversion("checked", globalAddress(convert.getUnary()), fromType, toType) + exists(Type fromType, Type toType, Instruction unary | + Conversion::Using::hasOperandAndTypes(instr, + unary, fromType, toType) and + result = TConversion("checked", globalAddress(unary), fromType, toType) ) or - exists(InheritanceConversionInstruction convert, Type fromType, Type toType | instr = convert | - inheritanceConversionTypes(convert, fromType, toType) and - result = TConversion("inheritance", globalAddress(convert.getUnary()), fromType, toType) + exists(Type fromType, Type toType, Instruction unary | + Conversion::Using::hasOperandAndTypes(instr, + unary, fromType, toType) and + result = TConversion("inheritance", globalAddress(unary), fromType, toType) ) or - exists(FieldAddressInstruction fai | instr = fai | - result = - TFieldAddress(globalAddress(pragma[only_bind_into](fai.getObjectAddress())), - pragma[only_bind_out](fai.getField())) + exists(FieldAddressInstruction fai, Instruction object, Field f | instr = fai | + hasObjectAndField(fai, object, f) and + result = TFieldAddress(globalAddress(object), f) ) or result = globalAddress(instr.(PointerOffsetInstruction).getLeft()) From ec1cc72669681f5ca4e948ff184fbda5c7286b8d Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Thu, 18 Aug 2022 15:02:16 +0100 Subject: [PATCH 08/30] Note support for Java 19 --- docs/codeql/support/reusables/versions-compilers.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/codeql/support/reusables/versions-compilers.rst b/docs/codeql/support/reusables/versions-compilers.rst index 4dfadcfb276..c734cf65ff3 100644 --- a/docs/codeql/support/reusables/versions-compilers.rst +++ b/docs/codeql/support/reusables/versions-compilers.rst @@ -30,7 +30,7 @@ .. [1] C++20 support is currently in beta. Supported for GCC on Linux only. Modules are *not* supported. .. [2] Support for the clang-cl compiler is preliminary. .. [3] Support for the Arm Compiler (armcc) is preliminary. - .. [4] Builds that execute on Java 7 to 18 can be analyzed. The analysis understands Java 18 standard language features. + .. [4] Builds that execute on Java 7 to 19 can be analyzed. The analysis understands Java 19 standard language features. .. [5] ECJ is supported when the build invokes it via the Maven Compiler plugin or the Takari Lifecycle plugin. .. [6] JSX and Flow code, YAML, JSON, HTML, and XML files may also be analyzed with JavaScript files. .. [7] Requires glibc 2.17. From 328e47834e3abbc9f89e8e4c04bdb55d283a8ce0 Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Mon, 15 Aug 2022 11:16:10 +0200 Subject: [PATCH 09/30] C#: Add ASP.NET Core MapGet routing end point example. --- .../flowsources/aspremote/AspRemoteFlowSource.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/AspRemoteFlowSource.cs b/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/AspRemoteFlowSource.cs index a62c94d8686..d9995ac7afc 100644 --- a/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/AspRemoteFlowSource.cs +++ b/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/AspRemoteFlowSource.cs @@ -1,3 +1,4 @@ +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Mvc; namespace Testing @@ -20,4 +21,19 @@ namespace Testing throw null; } } + + public class AspRoutingEndpoints + { + + public void M1(string[] args) + { + var builder = WebApplication.CreateBuilder(args); + var app = builder.Build(); + + // The delegate parameters are considered flow sources. + app.MapGet("/api/redirect/{newUrl}", (string newUrl) => { }); + + app.Run(); + } + } } \ No newline at end of file From c8afb1bb948a67822ce0b8893bb84fb39e5e2705 Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Mon, 15 Aug 2022 11:21:22 +0200 Subject: [PATCH 10/30] C#: Update expected test case with new line numbers. --- .../flowsources/aspremote/aspRemoteFlowSource.expected | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected b/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected index e2e07cb08c6..9ef5145d9b1 100644 --- a/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected +++ b/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected @@ -1,4 +1,4 @@ remoteFlowSourceMembers -| AspRemoteFlowSource.cs:8:23:8:31 | RequestId | +| AspRemoteFlowSource.cs:9:23:9:31 | RequestId | remoteFlowSources -| AspRemoteFlowSource.cs:18:42:18:50 | viewModel | +| AspRemoteFlowSource.cs:19:42:19:50 | viewModel | From bd6d3c73474c178bacae605f788069a1314c4238 Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Mon, 15 Aug 2022 16:26:32 +0200 Subject: [PATCH 11/30] C#: Consider parameters passed to lambdas in MapGet remote flow sources. --- .../csharp/frameworks/microsoft/AspNetCore.qll | 12 ++++++++++++ .../security/dataflow/flowsources/Remote.qll | 16 ++++++++++++++++ .../aspremote/aspRemoteFlowSource.expected | 1 + 3 files changed, 29 insertions(+) diff --git a/csharp/ql/lib/semmle/code/csharp/frameworks/microsoft/AspNetCore.qll b/csharp/ql/lib/semmle/code/csharp/frameworks/microsoft/AspNetCore.qll index a918b603818..3f5cc91c88e 100644 --- a/csharp/ql/lib/semmle/code/csharp/frameworks/microsoft/AspNetCore.qll +++ b/csharp/ql/lib/semmle/code/csharp/frameworks/microsoft/AspNetCore.qll @@ -357,3 +357,15 @@ class MicrosoftAspNetCoreHttpHtmlString extends Class { this.hasQualifiedName("Microsoft.AspNetCore.Html", "HtmlString") } } + +/** + * The `Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions` class. + */ +class MicrosoftAspNetCoreBuilderEndpointRouteBuilderExtensions extends Class { + MicrosoftAspNetCoreBuilderEndpointRouteBuilderExtensions() { + this.hasQualifiedName("Microsoft.AspNetCore.Builder", "EndpointRouteBuilderExtensions") + } + + /** Gets the `UseMap` extension method. */ + Method getMapGetMethod() { result = this.getAMethod("MapGet") } +} diff --git a/csharp/ql/lib/semmle/code/csharp/security/dataflow/flowsources/Remote.qll b/csharp/ql/lib/semmle/code/csharp/security/dataflow/flowsources/Remote.qll index 241f16d06ed..b5cdbc0c4ba 100644 --- a/csharp/ql/lib/semmle/code/csharp/security/dataflow/flowsources/Remote.qll +++ b/csharp/ql/lib/semmle/code/csharp/security/dataflow/flowsources/Remote.qll @@ -171,6 +171,22 @@ class ActionMethodParameter extends RemoteFlowSource, DataFlow::ParameterNode { /** A data flow source of remote user input (ASP.NET Core). */ abstract class AspNetCoreRemoteFlowSource extends RemoteFlowSource { } +/** A parameter to a routing method delegate. */ +class RoutingMethodParameter extends AspNetCoreRemoteFlowSource, DataFlow::ParameterNode { + RoutingMethodParameter() { + exists(Parameter p, MethodCall m | + p = this.getParameter() and + p.fromSource() + | + m.getTarget() = + any(MicrosoftAspNetCoreBuilderEndpointRouteBuilderExtensions c).getMapGetMethod() and + p = m.getArgument(2).(AnonymousFunctionExpr).getAParameter() + ) + } + + override string getSourceType() { result = "ASP.NET Core routing endpoint." } +} + /** * Data flow for ASP.NET Core. * diff --git a/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected b/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected index 9ef5145d9b1..b350ad17f2d 100644 --- a/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected +++ b/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected @@ -2,3 +2,4 @@ remoteFlowSourceMembers | AspRemoteFlowSource.cs:9:23:9:31 | RequestId | remoteFlowSources | AspRemoteFlowSource.cs:19:42:19:50 | viewModel | +| AspRemoteFlowSource.cs:34:58:34:63 | newUrl | From 6e5a412150ac3c6982821d5880d48c1aff24ce4e Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Tue, 16 Aug 2022 13:03:34 +0200 Subject: [PATCH 12/30] C#: Make one more ASP.NET routing example. --- .../dataflow/flowsources/aspremote/AspRemoteFlowSource.cs | 2 +- .../flowsources/aspremote/aspRemoteFlowSource.expected | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/AspRemoteFlowSource.cs b/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/AspRemoteFlowSource.cs index d9995ac7afc..c47d5a02058 100644 --- a/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/AspRemoteFlowSource.cs +++ b/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/AspRemoteFlowSource.cs @@ -24,7 +24,6 @@ namespace Testing public class AspRoutingEndpoints { - public void M1(string[] args) { var builder = WebApplication.CreateBuilder(args); @@ -32,6 +31,7 @@ namespace Testing // The delegate parameters are considered flow sources. app.MapGet("/api/redirect/{newUrl}", (string newUrl) => { }); + app.MapGet("/{myApi}/redirect/{myUrl}", (string myApi, string myUrl) => { } ); app.Run(); } diff --git a/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected b/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected index b350ad17f2d..a0354b3e68b 100644 --- a/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected +++ b/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected @@ -2,4 +2,6 @@ remoteFlowSourceMembers | AspRemoteFlowSource.cs:9:23:9:31 | RequestId | remoteFlowSources | AspRemoteFlowSource.cs:19:42:19:50 | viewModel | -| AspRemoteFlowSource.cs:34:58:34:63 | newUrl | +| AspRemoteFlowSource.cs:33:58:33:63 | newUrl | +| AspRemoteFlowSource.cs:34:61:34:65 | myApi | +| AspRemoteFlowSource.cs:34:75:34:79 | myUrl | From aaf14b0184f6283e7cdc715e06317c93a771e9a1 Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Tue, 16 Aug 2022 13:35:34 +0200 Subject: [PATCH 13/30] C#: Improve solution (pair programming with @hvitved). --- .../security/dataflow/flowsources/Remote.qll | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/csharp/ql/lib/semmle/code/csharp/security/dataflow/flowsources/Remote.qll b/csharp/ql/lib/semmle/code/csharp/security/dataflow/flowsources/Remote.qll index b5cdbc0c4ba..01ebce07dbf 100644 --- a/csharp/ql/lib/semmle/code/csharp/security/dataflow/flowsources/Remote.qll +++ b/csharp/ql/lib/semmle/code/csharp/security/dataflow/flowsources/Remote.qll @@ -171,16 +171,30 @@ class ActionMethodParameter extends RemoteFlowSource, DataFlow::ParameterNode { /** A data flow source of remote user input (ASP.NET Core). */ abstract class AspNetCoreRemoteFlowSource extends RemoteFlowSource { } +private predicate reachesMapGetArg(DataFlow::Node n) { + exists(MethodCall mc | + mc.getTarget() = + any(MicrosoftAspNetCoreBuilderEndpointRouteBuilderExtensions c).getMapGetMethod() and + n.asExpr() = mc.getArgument(2) + ) + or + exists(DataFlow::Node mid | reachesMapGetArg(mid) | + DataFlow::localFlowStep(n, mid) or + n.asExpr() = mid.asExpr().(DelegateCreation).getArgument() + ) +} + /** A parameter to a routing method delegate. */ -class RoutingMethodParameter extends AspNetCoreRemoteFlowSource, DataFlow::ParameterNode { - RoutingMethodParameter() { - exists(Parameter p, MethodCall m | - p = this.getParameter() and - p.fromSource() +class AspNetCoreRoutingMethodParameter extends AspNetCoreRemoteFlowSource, DataFlow::ParameterNode { + AspNetCoreRoutingMethodParameter() { + exists(DataFlow::Node n, Callable c | + reachesMapGetArg(n) and + c.getAParameter() = this.asParameter() and + c.isSourceDeclaration() | - m.getTarget() = - any(MicrosoftAspNetCoreBuilderEndpointRouteBuilderExtensions c).getMapGetMethod() and - p = m.getArgument(2).(AnonymousFunctionExpr).getAParameter() + n.asExpr() = c + or + n.asExpr().(CallableAccess).getTarget().getUnboundDeclaration() = c ) } From d2c526613930eb883658b1af31127c736aa4ceee Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Tue, 16 Aug 2022 14:56:56 +0200 Subject: [PATCH 14/30] C#: Add more test examples. --- .../flowsources/aspremote/AspRemoteFlowSource.cs | 12 +++++++++++- .../aspremote/aspRemoteFlowSource.expected | 12 +++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/AspRemoteFlowSource.cs b/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/AspRemoteFlowSource.cs index c47d5a02058..06090935e2b 100644 --- a/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/AspRemoteFlowSource.cs +++ b/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/AspRemoteFlowSource.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Mvc; +using System; namespace Testing { @@ -24,6 +25,10 @@ namespace Testing public class AspRoutingEndpoints { + public delegate void MapGetHandler(string delegateparam); + + public void HandlerMethod(string param) { } + public void M1(string[] args) { var builder = WebApplication.CreateBuilder(args); @@ -31,8 +36,13 @@ namespace Testing // The delegate parameters are considered flow sources. app.MapGet("/api/redirect/{newUrl}", (string newUrl) => { }); - app.MapGet("/{myApi}/redirect/{myUrl}", (string myApi, string myUrl) => { } ); + app.MapGet("/{myApi}/redirect/{myUrl}", (string myApi, string myUrl) => { }); + Action handler = (string lambdaParam) => { }; + app.MapGet("/api/redirect/{lambdaParam}", handler); + + MapGetHandler handler2 = HandlerMethod; + app.MapGet("/api/redirect/{param}", handler2); app.Run(); } } diff --git a/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected b/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected index a0354b3e68b..4d5162029c8 100644 --- a/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected +++ b/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected @@ -1,7 +1,9 @@ remoteFlowSourceMembers -| AspRemoteFlowSource.cs:9:23:9:31 | RequestId | +| AspRemoteFlowSource.cs:10:23:10:31 | RequestId | remoteFlowSources -| AspRemoteFlowSource.cs:19:42:19:50 | viewModel | -| AspRemoteFlowSource.cs:33:58:33:63 | newUrl | -| AspRemoteFlowSource.cs:34:61:34:65 | myApi | -| AspRemoteFlowSource.cs:34:75:34:79 | myUrl | +| AspRemoteFlowSource.cs:20:42:20:50 | viewModel | +| AspRemoteFlowSource.cs:30:42:30:46 | param | +| AspRemoteFlowSource.cs:38:58:38:63 | newUrl | +| AspRemoteFlowSource.cs:39:61:39:65 | myApi | +| AspRemoteFlowSource.cs:39:75:39:79 | myUrl | +| AspRemoteFlowSource.cs:41:46:41:56 | lambdaParam | From 424d909201d220bd6b0f3eed73a29f7a9b9e7dcf Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Tue, 16 Aug 2022 16:03:44 +0200 Subject: [PATCH 15/30] C#: Add more Map like method delegate parameter as flow sources. --- .../frameworks/microsoft/AspNetCore.qll | 23 ++++++++++++++++++- .../security/dataflow/flowsources/Remote.qll | 3 +-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/csharp/ql/lib/semmle/code/csharp/frameworks/microsoft/AspNetCore.qll b/csharp/ql/lib/semmle/code/csharp/frameworks/microsoft/AspNetCore.qll index 3f5cc91c88e..2ebd9a93c29 100644 --- a/csharp/ql/lib/semmle/code/csharp/frameworks/microsoft/AspNetCore.qll +++ b/csharp/ql/lib/semmle/code/csharp/frameworks/microsoft/AspNetCore.qll @@ -366,6 +366,27 @@ class MicrosoftAspNetCoreBuilderEndpointRouteBuilderExtensions extends Class { this.hasQualifiedName("Microsoft.AspNetCore.Builder", "EndpointRouteBuilderExtensions") } - /** Gets the `UseMap` extension method. */ + /** Gets the `Map` extension method. */ + Method getMapMethod() { result = this.getAMethod("Map") } + + /** Gets the `MapGet` extension method. */ Method getMapGetMethod() { result = this.getAMethod("MapGet") } + + /** Gets the `MapPost` extension method. */ + Method getMapPostMethod() { result = this.getAMethod("MapPost") } + + /** Gets the `MapPut` extension method. */ + Method getMapPutMethod() { result = this.getAMethod("MapPut") } + + /** Gets the `MapDelete` extension method. */ + Method getMapDeleteMethod() { result = this.getAMethod("MapDelete") } + + /** Get a `Map` like extenion methods. */ + Method getAMapMethod() { + result = + [ + this.getMapMethod(), this.getMapGetMethod(), this.getMapPostMethod(), + this.getMapPutMethod(), this.getMapDeleteMethod() + ] + } } diff --git a/csharp/ql/lib/semmle/code/csharp/security/dataflow/flowsources/Remote.qll b/csharp/ql/lib/semmle/code/csharp/security/dataflow/flowsources/Remote.qll index 01ebce07dbf..4badf4e2070 100644 --- a/csharp/ql/lib/semmle/code/csharp/security/dataflow/flowsources/Remote.qll +++ b/csharp/ql/lib/semmle/code/csharp/security/dataflow/flowsources/Remote.qll @@ -173,8 +173,7 @@ abstract class AspNetCoreRemoteFlowSource extends RemoteFlowSource { } private predicate reachesMapGetArg(DataFlow::Node n) { exists(MethodCall mc | - mc.getTarget() = - any(MicrosoftAspNetCoreBuilderEndpointRouteBuilderExtensions c).getMapGetMethod() and + mc.getTarget() = any(MicrosoftAspNetCoreBuilderEndpointRouteBuilderExtensions c).getAMapMethod() and n.asExpr() = mc.getArgument(2) ) or From bbb6ba088b8905cb918e46aabfce12e772475ee6 Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Tue, 16 Aug 2022 16:06:49 +0200 Subject: [PATCH 16/30] C#: Add more Map like remote flow source testcases. --- .../flowsources/aspremote/AspRemoteFlowSource.cs | 9 +++++++-- .../flowsources/aspremote/aspRemoteFlowSource.expected | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/AspRemoteFlowSource.cs b/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/AspRemoteFlowSource.cs index 06090935e2b..6f22212b775 100644 --- a/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/AspRemoteFlowSource.cs +++ b/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/AspRemoteFlowSource.cs @@ -25,7 +25,7 @@ namespace Testing public class AspRoutingEndpoints { - public delegate void MapGetHandler(string delegateparam); + public delegate void MapGetHandler(string param); public void HandlerMethod(string param) { } @@ -42,7 +42,12 @@ namespace Testing app.MapGet("/api/redirect/{lambdaParam}", handler); MapGetHandler handler2 = HandlerMethod; - app.MapGet("/api/redirect/{param}", handler2); + app.MapGet("/api/redirect/{mapGetParam}", handler2); + + app.MapPost("/api/redirect/{mapPostParam}", (string mapPostParam) => { }); + app.MapPut("/api/redirect/{mapPutParam}", (string mapPutParam) => { }); + app.MapDelete("/api/redirect/{mapDeleteParam}", (string mapDeleteParam) => { }); + app.Run(); } } diff --git a/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected b/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected index 4d5162029c8..a952c3c8365 100644 --- a/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected +++ b/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected @@ -7,3 +7,6 @@ remoteFlowSources | AspRemoteFlowSource.cs:39:61:39:65 | myApi | | AspRemoteFlowSource.cs:39:75:39:79 | myUrl | | AspRemoteFlowSource.cs:41:46:41:56 | lambdaParam | +| AspRemoteFlowSource.cs:47:65:47:76 | mapPostParam | +| AspRemoteFlowSource.cs:48:63:48:73 | mapPutParam | +| AspRemoteFlowSource.cs:49:69:49:82 | mapDeleteParam | From 058541c0d6d5e55e93a38b59934f97d7c38e286d Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Tue, 16 Aug 2022 16:23:45 +0200 Subject: [PATCH 17/30] C#: Added change note. --- .../change-notes/2022-08-16-aspnetcore-remoteflowsources.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 csharp/ql/src/change-notes/2022-08-16-aspnetcore-remoteflowsources.md diff --git a/csharp/ql/src/change-notes/2022-08-16-aspnetcore-remoteflowsources.md b/csharp/ql/src/change-notes/2022-08-16-aspnetcore-remoteflowsources.md new file mode 100644 index 00000000000..efabbfdcb97 --- /dev/null +++ b/csharp/ql/src/change-notes/2022-08-16-aspnetcore-remoteflowsources.md @@ -0,0 +1,4 @@ +--- +category: minorAnalysis +--- +* Parameters of delegates passed to routing endpoint calls like `MapGet` in ASP.NET Core are now considered remote flow sources. \ No newline at end of file From c3e0388a75545eb24a898fd90269111323f51519 Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Fri, 19 Aug 2022 08:51:39 +0200 Subject: [PATCH 18/30] C#: Add testcase for complex models. --- .../aspremote/AspRemoteFlowSource.cs | 7 +++++++ .../aspremote/aspRemoteFlowSource.expected | 18 ++++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/AspRemoteFlowSource.cs b/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/AspRemoteFlowSource.cs index 6f22212b775..7f110e5c6fd 100644 --- a/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/AspRemoteFlowSource.cs +++ b/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/AspRemoteFlowSource.cs @@ -23,6 +23,11 @@ namespace Testing } } + public class Item + { + public string Tainted { get; set; } + } + public class AspRoutingEndpoints { public delegate void MapGetHandler(string param); @@ -48,6 +53,8 @@ namespace Testing app.MapPut("/api/redirect/{mapPutParam}", (string mapPutParam) => { }); app.MapDelete("/api/redirect/{mapDeleteParam}", (string mapDeleteParam) => { }); + app.MapPost("/items", (Item item) => { }); + app.Run(); } } diff --git a/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected b/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected index a952c3c8365..199ed69f28f 100644 --- a/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected +++ b/csharp/ql/test/library-tests/dataflow/flowsources/aspremote/aspRemoteFlowSource.expected @@ -1,12 +1,14 @@ remoteFlowSourceMembers | AspRemoteFlowSource.cs:10:23:10:31 | RequestId | +| AspRemoteFlowSource.cs:28:23:28:29 | Tainted | remoteFlowSources | AspRemoteFlowSource.cs:20:42:20:50 | viewModel | -| AspRemoteFlowSource.cs:30:42:30:46 | param | -| AspRemoteFlowSource.cs:38:58:38:63 | newUrl | -| AspRemoteFlowSource.cs:39:61:39:65 | myApi | -| AspRemoteFlowSource.cs:39:75:39:79 | myUrl | -| AspRemoteFlowSource.cs:41:46:41:56 | lambdaParam | -| AspRemoteFlowSource.cs:47:65:47:76 | mapPostParam | -| AspRemoteFlowSource.cs:48:63:48:73 | mapPutParam | -| AspRemoteFlowSource.cs:49:69:49:82 | mapDeleteParam | +| AspRemoteFlowSource.cs:35:42:35:46 | param | +| AspRemoteFlowSource.cs:43:58:43:63 | newUrl | +| AspRemoteFlowSource.cs:44:61:44:65 | myApi | +| AspRemoteFlowSource.cs:44:75:44:79 | myUrl | +| AspRemoteFlowSource.cs:46:46:46:56 | lambdaParam | +| AspRemoteFlowSource.cs:52:65:52:76 | mapPostParam | +| AspRemoteFlowSource.cs:53:63:53:73 | mapPutParam | +| AspRemoteFlowSource.cs:54:69:54:82 | mapDeleteParam | +| AspRemoteFlowSource.cs:56:41:56:44 | item | From 50a53008cd26699b4e1d97f43b05592e4dcb30e3 Mon Sep 17 00:00:00 2001 From: Tom Hvitved Date: Thu, 18 Aug 2022 19:04:36 +0200 Subject: [PATCH 19/30] QL: Refine 'redundant override' query --- ql/ql/src/queries/style/RedundantOverride.ql | 40 +++- .../RedundantOverride.expected | 15 +- .../RedundantOverride/RedundantOverride.qll | 202 +++++++++++++++--- 3 files changed, 217 insertions(+), 40 deletions(-) diff --git a/ql/ql/src/queries/style/RedundantOverride.ql b/ql/ql/src/queries/style/RedundantOverride.ql index dbaf5694d30..e95df3cf8a3 100644 --- a/ql/ql/src/queries/style/RedundantOverride.ql +++ b/ql/ql/src/queries/style/RedundantOverride.ql @@ -10,15 +10,14 @@ import ql -private predicate redundantOverride(ClassPredicate pred, ClassPredicate sup) { +/** Holds if `pred` overrides super predicate `sup` by forwarding via `mc`. */ +private predicate forwardingOverride(ClassPredicate pred, MemberCall mc, ClassPredicate sup) { pred.overrides(sup) and - // Can be made more precise, but rules out overrides needed for disambiguation - count(pred.getDeclaringType().getASuperType()) <= 1 and - exists(MemberCall mc | - mc.getBase() instanceof Super and - mc.getTarget() = sup and - not exists(pred.getQLDoc()) - | + mc.getBase() instanceof Super and + mc.getTarget() = sup and + not exists(pred.getQLDoc()) and + forall(int i, VarDecl p | p = pred.getParameter(i) | mc.getArgument(i) = p.getAnAccess()) and + ( pred.getBody() = any(ComparisonFormula comp | comp.getOperator() = "=" and @@ -31,6 +30,31 @@ private predicate redundantOverride(ClassPredicate pred, ClassPredicate sup) { ) } +private predicate forwardingOverrideProj(ClassPredicate pred, ClassPredicate sup) { + forwardingOverride(pred, _, sup) +} + +private ClassPredicate getUltimateDef(ClassPredicate p) { + forwardingOverrideProj*(p, result) and + not forwardingOverrideProj(result, _) +} + +private predicate redundantOverride(ClassPredicate pred, ClassPredicate sup) { + exists(MemberCall mc | + forwardingOverride(pred, mc, sup) and + // overridden to provide more precise QL doc + not exists(pred.getQLDoc()) and + // overridden to disambiguate + not exists(ClassPredicate other | + getUltimateDef(sup) != getUltimateDef(other) and + pred.getDeclaringType().getASuperType+() = other.getDeclaringType() and + not sup.overrides*(other) and + other.getName() = pred.getName() and + other.getArity() = pred.getArity() + ) + ) +} + from ClassPredicate pred, ClassPredicate sup where redundantOverride(pred, sup) select pred, "Redundant override of $@ predicate", sup, "this" diff --git a/ql/ql/test/queries/style/RedundantOverride/RedundantOverride.expected b/ql/ql/test/queries/style/RedundantOverride/RedundantOverride.expected index 32d11091cd5..dbb5c60174f 100644 --- a/ql/ql/test/queries/style/RedundantOverride/RedundantOverride.expected +++ b/ql/ql/test/queries/style/RedundantOverride/RedundantOverride.expected @@ -1,4 +1,11 @@ -| RedundantOverride.qll:12:16:12:19 | ClassPredicate pred | Redundant override of $@ predicate | RedundantOverride.qll:4:7:4:10 | ClassPredicate pred | this | -| RedundantOverride.qll:16:16:16:19 | ClassPredicate pred | Redundant override of $@ predicate | RedundantOverride.qll:4:7:4:10 | ClassPredicate pred | this | -| RedundantOverride.qll:47:22:47:26 | ClassPredicate pred3 | Redundant override of $@ predicate | RedundantOverride.qll:8:13:8:17 | ClassPredicate pred3 | this | -| RedundantOverride.qll:51:16:51:19 | ClassPredicate pred | Redundant override of $@ predicate | RedundantOverride.qll:4:7:4:10 | ClassPredicate pred | this | +| RedundantOverride.qll:9:18:9:21 | ClassPredicate pred | Redundant override of $@ predicate | RedundantOverride.qll:5:9:5:12 | ClassPredicate pred | this | +| RedundantOverride.qll:21:18:21:21 | ClassPredicate pred | Redundant override of $@ predicate | RedundantOverride.qll:17:9:17:12 | ClassPredicate pred | this | +| RedundantOverride.qll:110:24:110:27 | ClassPredicate pred | Redundant override of $@ predicate | RedundantOverride.qll:106:15:106:18 | ClassPredicate pred | this | +| RedundantOverride.qll:124:18:124:21 | ClassPredicate pred | Redundant override of $@ predicate | RedundantOverride.qll:118:9:118:12 | ClassPredicate pred | this | +| RedundantOverride.qll:128:18:128:21 | ClassPredicate pred | Redundant override of $@ predicate | RedundantOverride.qll:118:9:118:12 | ClassPredicate pred | this | +| RedundantOverride.qll:132:18:132:21 | ClassPredicate pred | Redundant override of $@ predicate | RedundantOverride.qll:128:18:128:21 | ClassPredicate pred | this | +| RedundantOverride.qll:150:18:150:21 | ClassPredicate pred | Redundant override of $@ predicate | RedundantOverride.qll:140:9:140:12 | ClassPredicate pred | this | +| RedundantOverride.qll:164:18:164:21 | ClassPredicate pred | Redundant override of $@ predicate | RedundantOverride.qll:158:9:158:12 | ClassPredicate pred | this | +| RedundantOverride.qll:168:18:168:21 | ClassPredicate pred | Redundant override of $@ predicate | RedundantOverride.qll:158:9:158:12 | ClassPredicate pred | this | +| RedundantOverride.qll:172:18:172:21 | ClassPredicate pred | Redundant override of $@ predicate | RedundantOverride.qll:168:18:168:21 | ClassPredicate pred | this | +| RedundantOverride.qll:176:18:176:21 | ClassPredicate pred | Redundant override of $@ predicate | RedundantOverride.qll:168:18:168:21 | ClassPredicate pred | this | diff --git a/ql/ql/test/queries/style/RedundantOverride/RedundantOverride.qll b/ql/ql/test/queries/style/RedundantOverride/RedundantOverride.qll index 4111b0d8b14..35df3b3194c 100644 --- a/ql/ql/test/queries/style/RedundantOverride/RedundantOverride.qll +++ b/ql/ql/test/queries/style/RedundantOverride/RedundantOverride.qll @@ -1,52 +1,198 @@ -class Foo extends string { - Foo() { this = "Foo" } +module Test1 { + class Foo extends int { + Foo() { this = 1 } - Foo pred() { none() } + Foo pred() { result = this } + } - Foo pred2() { none() } - - predicate pred3() { none() } + class Bar extends Foo { + override Foo pred() { result = Foo.super.pred() } // BAD + } } -class Bar1 extends Foo { - override Foo pred() { result = Foo.super.pred() } // BAD +module Test2 { + class Foo extends int { + Foo() { this = 1 } + + Foo pred() { result = this } + } + + class Bar extends Foo { + override Foo pred() { result = super.pred() } // BAD + } } -class Bar2 extends Foo { - override Foo pred() { result = super.pred() } // BAD +module Test3 { + class Foo extends int { + Foo() { this = [1 .. 3] } + + Foo pred() { any() } + } + + class Bar extends Foo { + Bar() { this = 2 } + } + + class Baz extends Foo { + Baz() { this = 3 } + + override Bar pred() { result = super.pred() } // GOOD (refined return type) + } } -class Bar3 extends Foo { - override Bar3 pred() { result = super.pred() } // GOOD (refined return type) +module Test4 { + class Foo extends int { + Foo() { this = [1, 2] } + + Foo pred() { result = 2 } + } + + class Bar extends Foo { + Bar() { this = 1 } + + override Foo pred() { result = this } // GOOD + } } -class Bar4 extends Foo { - override Foo pred() { any() } // GOOD +module Test5 { + class Foo extends int { + Foo() { this = 1 } + + Foo pred() { result = this } + } + + class Bar extends Foo { + /** My own overriding QL doc. */ + override Foo pred() { result = super.pred() } // GOOD + } } -class Bar5 extends Foo { - /** My own overriding QL doc. */ - override Foo pred() { result = super.pred() } // GOOD +module Test6 { + class Foo extends int { + Foo() { this = [1, 2] } + + Foo pred() { result = 1 } + + Foo pred2() { result = 2 } + } + + class Bar extends Foo { + override Foo pred() { result = super.pred2() } // GOOD + } } -class Bar6 extends Foo { - override Foo pred() { result = super.pred2() } // GOOD +module Test7 { + class Foo extends int { + Foo() { this = [1, 2] } + + Foo pred() { result = 2 } + } + + class Bar extends int { + Bar() { this = 1 } + + Foo pred() { result = this } + } + + class Baz extends Foo, Bar { + override Foo pred() { result = Foo.super.pred() } // GOOD (disambiguate) + } } -class Bar7 extends string { - Bar7() { this = "Bar7" } +module Test8 { + class Foo extends int { + Foo() { this = 1 } - Foo pred() { any() } + predicate pred(Foo f) { f = this } + } + + class Bar extends Foo { + override predicate pred(Foo f) { super.pred(f) } // BAD + } } -class Bar8 extends Foo, Bar7 { - override Foo pred() { result = Foo.super.pred() } // GOOD +module Test9 { + class Foo extends int { + Foo() { this = [1, 2] } + + Foo pred() { result = this } + } + + class Bar extends Foo { + Bar() { this = 1 } + + override Foo pred() { Foo.super.pred() = result } // BAD + } + + class Baz1 extends Foo, Bar { + override Foo pred() { Foo.super.pred() = result } // BAD + } + + class Baz2 extends Foo, Baz1 { + override Foo pred() { Baz1.super.pred() = result } // BAD + } } -class Bar9 extends Foo { - override predicate pred3() { super.pred3() } // BAD +module Test10 { + class Foo extends int { + Foo() { this = [1, 2] } + + Foo pred() { result = 1 } + } + + class Bar extends int { + Bar() { this = 1 } + + Foo pred(int i) { none() } + } + + class Baz1 extends Foo, Bar { + override Foo pred() { result = Foo.super.pred() } // BAD + } } -class Bar10 extends Foo { - override Foo pred() { Foo.super.pred() = result } // BAD +module Test11 { + class Foo extends int { + Foo() { this = [1 .. 4] } + + Foo pred() { result = 1 } + } + + class Bar1 extends Foo { + Bar1() { this = [1 .. 3] } + + override Foo pred() { Foo.super.pred() = result } // BAD + } + + class Bar2 extends Foo, Bar1 { + override Foo pred() { Foo.super.pred() = result } // BAD + } + + class Bar3 extends Foo, Bar2 { + override Foo pred() { Bar2.super.pred() = result } // BAD + } + + class Bar4 extends Bar2, Bar3 { + override Foo pred() { result = Bar2.super.pred() } // BAD + } + + class Bar5 extends Foo { + Bar5() { this = [1 .. 2] } + + override Foo pred() { result = this } // GOOD + } + + class Bar6 extends Bar4, Bar5 { + override Foo pred() { result = Bar4.super.pred() } // GOOD (dismambiguate) + } + + class Bar7 extends Bar6 { + Bar7() { this = 1 } + + override Foo pred() { result = 2 } // GOOD + } + + class Bar8 extends Bar6, Bar7 { + override Foo pred() { result = Bar6.super.pred() } // GOOD (specialize) + } } From c86c9ec2c30d0cadc29ddec8517d5ce4436cc7ff Mon Sep 17 00:00:00 2001 From: Tom Hvitved Date: Fri, 19 Aug 2022 10:35:47 +0200 Subject: [PATCH 20/30] QL: Move query logic into library --- .../style/RedundantOverrideQuery.qll | 46 +++++++++++++++++++ ql/ql/src/queries/style/RedundantOverride.ql | 46 +------------------ 2 files changed, 47 insertions(+), 45 deletions(-) create mode 100644 ql/ql/src/codeql_ql/style/RedundantOverrideQuery.qll diff --git a/ql/ql/src/codeql_ql/style/RedundantOverrideQuery.qll b/ql/ql/src/codeql_ql/style/RedundantOverrideQuery.qll new file mode 100644 index 00000000000..5d8abd4e170 --- /dev/null +++ b/ql/ql/src/codeql_ql/style/RedundantOverrideQuery.qll @@ -0,0 +1,46 @@ +import ql + +/** Holds if `pred` overrides super predicate `sup` by forwarding via `mc`. */ +private predicate forwardingOverride(ClassPredicate pred, MemberCall mc, ClassPredicate sup) { + pred.overrides(sup) and + mc.getBase() instanceof Super and + mc.getTarget() = sup and + not exists(pred.getQLDoc()) and + forall(int i, VarDecl p | p = pred.getParameter(i) | mc.getArgument(i) = p.getAnAccess()) and + ( + pred.getBody() = + any(ComparisonFormula comp | + comp.getOperator() = "=" and + comp.getAnOperand() instanceof ResultAccess and + comp.getAnOperand() = mc and + pred.getReturnType() = sup.getReturnType() + ) + or + pred.getBody() = mc + ) +} + +private predicate forwardingOverrideProj(ClassPredicate pred, ClassPredicate sup) { + forwardingOverride(pred, _, sup) +} + +private ClassPredicate getUltimateDef(ClassPredicate p) { + forwardingOverrideProj*(p, result) and + not forwardingOverrideProj(result, _) +} + +predicate redundantOverride(ClassPredicate pred, ClassPredicate sup) { + exists(MemberCall mc | + forwardingOverride(pred, mc, sup) and + // overridden to provide more precise QL doc + not exists(pred.getQLDoc()) and + // overridden to disambiguate + not exists(ClassPredicate other | + getUltimateDef(sup) != getUltimateDef(other) and + pred.getDeclaringType().getASuperType+() = other.getDeclaringType() and + not sup.overrides*(other) and + other.getName() = pred.getName() and + other.getArity() = pred.getArity() + ) + ) +} diff --git a/ql/ql/src/queries/style/RedundantOverride.ql b/ql/ql/src/queries/style/RedundantOverride.ql index e95df3cf8a3..53b17be1992 100644 --- a/ql/ql/src/queries/style/RedundantOverride.ql +++ b/ql/ql/src/queries/style/RedundantOverride.ql @@ -9,51 +9,7 @@ */ import ql - -/** Holds if `pred` overrides super predicate `sup` by forwarding via `mc`. */ -private predicate forwardingOverride(ClassPredicate pred, MemberCall mc, ClassPredicate sup) { - pred.overrides(sup) and - mc.getBase() instanceof Super and - mc.getTarget() = sup and - not exists(pred.getQLDoc()) and - forall(int i, VarDecl p | p = pred.getParameter(i) | mc.getArgument(i) = p.getAnAccess()) and - ( - pred.getBody() = - any(ComparisonFormula comp | - comp.getOperator() = "=" and - comp.getAnOperand() instanceof ResultAccess and - comp.getAnOperand() = mc and - pred.getReturnType() = sup.getReturnType() - ) - or - pred.getBody() = mc - ) -} - -private predicate forwardingOverrideProj(ClassPredicate pred, ClassPredicate sup) { - forwardingOverride(pred, _, sup) -} - -private ClassPredicate getUltimateDef(ClassPredicate p) { - forwardingOverrideProj*(p, result) and - not forwardingOverrideProj(result, _) -} - -private predicate redundantOverride(ClassPredicate pred, ClassPredicate sup) { - exists(MemberCall mc | - forwardingOverride(pred, mc, sup) and - // overridden to provide more precise QL doc - not exists(pred.getQLDoc()) and - // overridden to disambiguate - not exists(ClassPredicate other | - getUltimateDef(sup) != getUltimateDef(other) and - pred.getDeclaringType().getASuperType+() = other.getDeclaringType() and - not sup.overrides*(other) and - other.getName() = pred.getName() and - other.getArity() = pred.getArity() - ) - ) -} +import codeql_ql.style.RedundantOverrideQuery from ClassPredicate pred, ClassPredicate sup where redundantOverride(pred, sup) From 949de2a8dd8b472ca96b527cc91b570785cb68c8 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Fri, 19 Aug 2022 11:15:23 +0100 Subject: [PATCH 21/30] Create 2022-08-19-java-19-support.md --- java/ql/lib/change-notes/2022-08-19-java-19-support.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 java/ql/lib/change-notes/2022-08-19-java-19-support.md diff --git a/java/ql/lib/change-notes/2022-08-19-java-19-support.md b/java/ql/lib/change-notes/2022-08-19-java-19-support.md new file mode 100644 index 00000000000..5cf26dec89f --- /dev/null +++ b/java/ql/lib/change-notes/2022-08-19-java-19-support.md @@ -0,0 +1,4 @@ +--- +category: minorAnalysis +--- +* Java 19 builds can now be extracted. There are no non-preview new language features in this release, so the only user-visible change is that the CodeQL extractor will now correctly trace compilations using the JDK 19 release of `javac`. From 663096fe3a9b0ffd8eed1a3f0ec2eaddecc58971 Mon Sep 17 00:00:00 2001 From: Tom Hvitved Date: Fri, 19 Aug 2022 13:57:41 +0200 Subject: [PATCH 22/30] Remove redundant overrides --- cpp/ql/lib/semmle/code/cpp/File.qll | 2 -- csharp/ql/lib/semmle/code/cil/Types.qll | 2 -- csharp/ql/lib/semmle/code/csharp/Callable.qll | 8 -------- csharp/ql/lib/semmle/code/csharp/Namespace.qll | 4 ---- csharp/ql/lib/semmle/code/csharp/Property.qll | 2 -- .../ir/implementation/raw/internal/TranslatedExpr.qll | 4 ---- .../internal/TranslatedCompilerGeneratedDeclaration.qll | 4 ---- javascript/ql/lib/semmle/javascript/Files.qll | 2 -- javascript/ql/lib/semmle/javascript/frameworks/xUnit.qll | 2 -- .../library-tests/frameworks/Testing/customised/Tests.ql | 2 -- python/ql/lib/semmle/python/Comprehensions.qll | 2 -- python/ql/lib/semmle/python/Flow.qll | 4 +--- python/ql/lib/semmle/python/Keywords.qll | 6 ------ .../semmle/python/dataflow/new/internal/Attributes.qll | 4 +--- ql/ql/src/codeql_ql/ast/Ast.qll | 4 ---- ql/ql/test/callgraph/Foo.qll | 4 +--- ruby/ql/lib/codeql/ruby/ast/Module.qll | 2 -- ruby/ql/lib/codeql/ruby/ast/Variable.qll | 2 -- .../ruby/controlflow/internal/ControlFlowGraphImpl.qll | 4 ---- 19 files changed, 3 insertions(+), 61 deletions(-) diff --git a/cpp/ql/lib/semmle/code/cpp/File.qll b/cpp/ql/lib/semmle/code/cpp/File.qll index 398633edbd8..e58467fac20 100644 --- a/cpp/ql/lib/semmle/code/cpp/File.qll +++ b/cpp/ql/lib/semmle/code/cpp/File.qll @@ -218,8 +218,6 @@ class Folder extends Container, @folder { class File extends Container, @file { override string getAbsolutePath() { files(underlyingElement(this), result) } - override string toString() { result = Container.super.toString() } - override string getAPrimaryQlClass() { result = "File" } override Location getLocation() { diff --git a/csharp/ql/lib/semmle/code/cil/Types.qll b/csharp/ql/lib/semmle/code/cil/Types.qll index 6bb980d6a87..32efaf193ad 100644 --- a/csharp/ql/lib/semmle/code/cil/Types.qll +++ b/csharp/ql/lib/semmle/code/cil/Types.qll @@ -309,8 +309,6 @@ class FunctionPointerType extends Type, CustomModifierReceiver, Parameterizable, /** Gets the calling convention. */ int getCallingConvention() { cil_function_pointer_calling_conventions(this, result) } - override string toString() { result = Type.super.toString() } - /** Holds if the return type is `void`. */ predicate returnsVoid() { this.getReturnType() instanceof VoidType } diff --git a/csharp/ql/lib/semmle/code/csharp/Callable.qll b/csharp/ql/lib/semmle/code/csharp/Callable.qll index b403d201266..0477874eec1 100644 --- a/csharp/ql/lib/semmle/code/csharp/Callable.qll +++ b/csharp/ql/lib/semmle/code/csharp/Callable.qll @@ -215,11 +215,7 @@ class Callable extends DotNet::Callable, Parameterizable, ExprOrStmtParent, @cal /** Gets a `Call` that has this callable as a target. */ Call getACall() { this = result.getTarget() } - override Parameter getParameter(int n) { result = Parameterizable.super.getParameter(n) } - override Parameter getAParameter() { result = Parameterizable.super.getAParameter() } - - override int getNumberOfParameters() { result = Parameterizable.super.getNumberOfParameters() } } /** @@ -276,8 +272,6 @@ class Method extends Callable, Virtualizable, Attributable, @method { predicate hasParams() { exists(this.getParamsType()) } // Remove when `Callable.isOverridden()` is removed - override predicate isOverridden() { Virtualizable.super.isOverridden() } - override predicate fromSource() { Callable.super.fromSource() and not this.isCompilerGenerated() @@ -472,8 +466,6 @@ class RecordCloneMethod extends Method, DotNet::RecordCloneCallable { override Constructor getConstructor() { result = DotNet::RecordCloneCallable.super.getConstructor() } - - override string toString() { result = Method.super.toString() } } /** diff --git a/csharp/ql/lib/semmle/code/csharp/Namespace.qll b/csharp/ql/lib/semmle/code/csharp/Namespace.qll index e5e4287962f..6812eada0a5 100644 --- a/csharp/ql/lib/semmle/code/csharp/Namespace.qll +++ b/csharp/ql/lib/semmle/code/csharp/Namespace.qll @@ -116,10 +116,6 @@ class Namespace extends DotNet::Namespace, TypeContainer, Declaration, @namespac override Location getALocation() { result = this.getADeclaration().getALocation() } override string toString() { result = DotNet::Namespace.super.toString() } - - override predicate hasQualifiedName(string a, string b) { - DotNet::Namespace.super.hasQualifiedName(a, b) - } } /** diff --git a/csharp/ql/lib/semmle/code/csharp/Property.qll b/csharp/ql/lib/semmle/code/csharp/Property.qll index 58a7b52a66e..1bd65425845 100644 --- a/csharp/ql/lib/semmle/code/csharp/Property.qll +++ b/csharp/ql/lib/semmle/code/csharp/Property.qll @@ -42,8 +42,6 @@ class DeclarationWithAccessors extends AssignableMember, Virtualizable, Attribut } override Type getType() { none() } - - override string toString() { result = AssignableMember.super.toString() } } /** diff --git a/csharp/ql/src/experimental/ir/implementation/raw/internal/TranslatedExpr.qll b/csharp/ql/src/experimental/ir/implementation/raw/internal/TranslatedExpr.qll index c4ad2428202..08b246558b1 100644 --- a/csharp/ql/src/experimental/ir/implementation/raw/internal/TranslatedExpr.qll +++ b/csharp/ql/src/experimental/ir/implementation/raw/internal/TranslatedExpr.qll @@ -817,10 +817,6 @@ class TranslatedNonFieldVariableAccess extends TranslatedVariableAccess { else result = this.getInstruction(AddressTag()) } - override Instruction getInstructionOperand(InstructionTag tag, OperandTag operandTag) { - result = TranslatedVariableAccess.super.getInstructionOperand(tag, operandTag) - } - override predicate hasInstruction(Opcode opcode, InstructionTag tag, CSharpType resultType) { TranslatedVariableAccess.super.hasInstruction(opcode, tag, resultType) or diff --git a/csharp/ql/src/experimental/ir/implementation/raw/internal/desugar/internal/TranslatedCompilerGeneratedDeclaration.qll b/csharp/ql/src/experimental/ir/implementation/raw/internal/desugar/internal/TranslatedCompilerGeneratedDeclaration.qll index 273c9936588..6757b032424 100644 --- a/csharp/ql/src/experimental/ir/implementation/raw/internal/desugar/internal/TranslatedCompilerGeneratedDeclaration.qll +++ b/csharp/ql/src/experimental/ir/implementation/raw/internal/desugar/internal/TranslatedCompilerGeneratedDeclaration.qll @@ -21,10 +21,6 @@ abstract class TranslatedCompilerGeneratedDeclaration extends LocalVariableDecla result = "compiler generated declaration (" + generatedBy.toString() + ")" } - override TranslatedElement getChild(int id) { - result = LocalVariableDeclarationBase.super.getChild(id) - } - override Instruction getChildSuccessor(TranslatedElement child) { child = getInitialization() and result = getInstruction(InitializerStoreTag()) } diff --git a/javascript/ql/lib/semmle/javascript/Files.qll b/javascript/ql/lib/semmle/javascript/Files.qll index c01810b462f..d2db71ed73f 100644 --- a/javascript/ql/lib/semmle/javascript/Files.qll +++ b/javascript/ql/lib/semmle/javascript/Files.qll @@ -234,8 +234,6 @@ class File extends Container, @file { /** Gets a toplevel piece of JavaScript code in this file. */ TopLevel getATopLevel() { result.getFile() = this } - override string toString() { result = Container.super.toString() } - /** Gets the URL of this file. */ override string getURL() { result = "file://" + this.getAbsolutePath() + ":0:0:0:0" } diff --git a/javascript/ql/lib/semmle/javascript/frameworks/xUnit.qll b/javascript/ql/lib/semmle/javascript/frameworks/xUnit.qll index 0b2379dd6b1..4b009cddcf7 100644 --- a/javascript/ql/lib/semmle/javascript/frameworks/xUnit.qll +++ b/javascript/ql/lib/semmle/javascript/frameworks/xUnit.qll @@ -43,8 +43,6 @@ abstract private class BracketedListOfExpressions extends Expr { * An array expression viewed as a bracketed list of expressions. */ private class ArrayExprIsABracketedListOfExpressions extends ArrayExpr, BracketedListOfExpressions { - override predicate isImpure() { ArrayExpr.super.isImpure() } - /** Gets the `i`th element of this array literal. */ override Expr getElement(int i) { result = ArrayExpr.super.getElement(i) } } diff --git a/javascript/ql/test/library-tests/frameworks/Testing/customised/Tests.ql b/javascript/ql/test/library-tests/frameworks/Testing/customised/Tests.ql index eec5daebd89..1f4c9723856 100644 --- a/javascript/ql/test/library-tests/frameworks/Testing/customised/Tests.ql +++ b/javascript/ql/test/library-tests/frameworks/Testing/customised/Tests.ql @@ -2,8 +2,6 @@ import semmle.javascript.frameworks.Testing class MyTest extends Test, CallExpr { MyTest() { getCallee().(VarAccess).getName() = "mytest" } - - override string toString() { result = CallExpr.super.toString() } } from Test t diff --git a/python/ql/lib/semmle/python/Comprehensions.qll b/python/ql/lib/semmle/python/Comprehensions.qll index ae947f5d084..37f07614282 100644 --- a/python/ql/lib/semmle/python/Comprehensions.qll +++ b/python/ql/lib/semmle/python/Comprehensions.qll @@ -68,8 +68,6 @@ class ListComp extends ListComp_, Comp { override Expr getIterable() { result = ListComp_.super.getIterable() } - override string toString() { result = ListComp_.super.toString() } - override Expr getElt() { result = Comp.super.getElt() } } diff --git a/python/ql/lib/semmle/python/Flow.qll b/python/ql/lib/semmle/python/Flow.qll index ce886151135..3c58a2e00d7 100755 --- a/python/ql/lib/semmle/python/Flow.qll +++ b/python/ql/lib/semmle/python/Flow.qll @@ -324,9 +324,7 @@ class ControlFlowNode extends @py_flow_node { * This avoids wasting time on the trivial overrides on the ControlFlowNode subclasses. */ -private class AnyNode extends ControlFlowNode { - override AstNode getNode() { result = super.getNode() } -} +private class AnyNode extends ControlFlowNode { } /** * Check whether a SSA variable has complete points-to information. diff --git a/python/ql/lib/semmle/python/Keywords.qll b/python/ql/lib/semmle/python/Keywords.qll index 406ba833fb8..b7ecca528bb 100644 --- a/python/ql/lib/semmle/python/Keywords.qll +++ b/python/ql/lib/semmle/python/Keywords.qll @@ -2,8 +2,6 @@ import python class KeyValuePair extends KeyValuePair_, DictDisplayItem { /* syntax: Expr : Expr */ - override Location getLocation() { result = KeyValuePair_.super.getLocation() } - override string toString() { result = KeyValuePair_.super.toString() } /** Gets the value of this dictionary unpacking. */ @@ -20,8 +18,6 @@ class KeyValuePair extends KeyValuePair_, DictDisplayItem { /** A double-starred expression in a call or dict literal. */ class DictUnpacking extends DictUnpacking_, DictUnpackingOrKeyword, DictDisplayItem { - override Location getLocation() { result = DictUnpacking_.super.getLocation() } - override string toString() { result = DictUnpacking_.super.toString() } /** Gets the value of this dictionary unpacking. */ @@ -47,8 +43,6 @@ abstract class DictDisplayItem extends DictItem { /** A keyword argument in a call. For example `arg=expr` in `foo(0, arg=expr)` */ class Keyword extends Keyword_, DictUnpackingOrKeyword { /* syntax: name = Expr */ - override Location getLocation() { result = Keyword_.super.getLocation() } - override string toString() { result = Keyword_.super.toString() } /** Gets the value of this keyword argument. */ diff --git a/python/ql/lib/semmle/python/dataflow/new/internal/Attributes.qll b/python/ql/lib/semmle/python/dataflow/new/internal/Attributes.qll index d40e06ce6d7..49c8c7e5ab5 100644 --- a/python/ql/lib/semmle/python/dataflow/new/internal/Attributes.qll +++ b/python/ql/lib/semmle/python/dataflow/new/internal/Attributes.qll @@ -70,9 +70,7 @@ abstract class AttrWrite extends AttrRef { * ``` * Also gives access to the `value` being written, by extending `DefinitionNode`. */ -private class AttributeAssignmentNode extends DefinitionNode, AttrNode { - override ControlFlowNode getValue() { result = DefinitionNode.super.getValue() } -} +private class AttributeAssignmentNode extends DefinitionNode, AttrNode { } /** A simple attribute assignment: `object.attr = value`. */ private class AttributeAssignmentAsAttrWrite extends AttrWrite, CfgNode { diff --git a/ql/ql/src/codeql_ql/ast/Ast.qll b/ql/ql/src/codeql_ql/ast/Ast.qll index ec67d4637e3..b0d5c18a3bc 100644 --- a/ql/ql/src/codeql_ql/ast/Ast.qll +++ b/ql/ql/src/codeql_ql/ast/Ast.qll @@ -794,8 +794,6 @@ class Declaration extends TDeclaration, AstNode { or result = any(Class c).getQLDocFor(this) } - - override AstNode getAChild(string pred) { result = super.getAChild(pred) } } /** An entity that can be declared in a module. */ @@ -1101,8 +1099,6 @@ class NoneCall extends TNoneCall, Call, Formula { NoneCall() { this = TNoneCall(call) } override string getAPrimaryQlClass() { result = "NoneCall" } - - override AstNode getParent() { result = Call.super.getParent() } } /** diff --git a/ql/ql/test/callgraph/Foo.qll b/ql/ql/test/callgraph/Foo.qll index 1a2ac90e06e..ec801d08251 100644 --- a/ql/ql/test/callgraph/Foo.qll +++ b/ql/ql/test/callgraph/Foo.qll @@ -10,9 +10,7 @@ class Foo extends AstNode { predicate baz() { bar() } } -class Sub extends Foo { - override predicate baz() { super.baz() } -} +class Sub extends Foo { } query predicate test2() { any(Foo f).bar() } diff --git a/ruby/ql/lib/codeql/ruby/ast/Module.qll b/ruby/ql/lib/codeql/ruby/ast/Module.qll index f4edb762269..8f212ccde96 100644 --- a/ruby/ql/lib/codeql/ruby/ast/Module.qll +++ b/ruby/ql/lib/codeql/ruby/ast/Module.qll @@ -214,8 +214,6 @@ class Namespace extends ModuleBase, ConstantWriteAccess, TNamespace { result = ModuleBase.super.getAChild(pred) or result = ConstantWriteAccess.super.getAChild(pred) } - - final override string toString() { result = ConstantWriteAccess.super.toString() } } /** diff --git a/ruby/ql/lib/codeql/ruby/ast/Variable.qll b/ruby/ql/lib/codeql/ruby/ast/Variable.qll index 714c98fa994..08537690c81 100644 --- a/ruby/ql/lib/codeql/ruby/ast/Variable.qll +++ b/ruby/ql/lib/codeql/ruby/ast/Variable.qll @@ -122,8 +122,6 @@ class VariableAccess extends Expr instanceof VariableAccessImpl { or synthChild(any(BlockParameter p), 0, this) } - - final override string toString() { result = VariableAccessImpl.super.toString() } } /** An access to a variable where the value is updated. */ diff --git a/ruby/ql/lib/codeql/ruby/controlflow/internal/ControlFlowGraphImpl.qll b/ruby/ql/lib/codeql/ruby/controlflow/internal/ControlFlowGraphImpl.qll index 69d9e2d91c0..d7607e79976 100644 --- a/ruby/ql/lib/codeql/ruby/controlflow/internal/ControlFlowGraphImpl.qll +++ b/ruby/ql/lib/codeql/ruby/controlflow/internal/ControlFlowGraphImpl.qll @@ -1380,10 +1380,6 @@ module Trees { final override predicate first(AstNode first) { this.firstInner(first) } final override predicate last(AstNode last, Completion c) { this.lastInner(last, c) } - - final override predicate succ(AstNode pred, AstNode succ, Completion c) { - BodyStmtTree.super.succ(pred, succ, c) - } } private class UndefStmtTree extends StandardPreOrderTree, UndefStmt { From 1b29bddb73232431b1230009c31e8a644bbf662e Mon Sep 17 00:00:00 2001 From: Tom Hvitved Date: Fri, 19 Aug 2022 14:08:21 +0200 Subject: [PATCH 23/30] Python: Revert change to `AnyNode` --- python/ql/lib/semmle/python/Flow.qll | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/ql/lib/semmle/python/Flow.qll b/python/ql/lib/semmle/python/Flow.qll index 3c58a2e00d7..ce886151135 100755 --- a/python/ql/lib/semmle/python/Flow.qll +++ b/python/ql/lib/semmle/python/Flow.qll @@ -324,7 +324,9 @@ class ControlFlowNode extends @py_flow_node { * This avoids wasting time on the trivial overrides on the ControlFlowNode subclasses. */ -private class AnyNode extends ControlFlowNode { } +private class AnyNode extends ControlFlowNode { + override AstNode getNode() { result = super.getNode() } +} /** * Check whether a SSA variable has complete points-to information. From 18fb4a87af096ea556269a6f99e756f6e35f90f0 Mon Sep 17 00:00:00 2001 From: Tom Hvitved Date: Fri, 19 Aug 2022 14:37:25 +0200 Subject: [PATCH 24/30] Revert change to QL test --- ql/ql/test/callgraph/Foo.qll | 4 +++- ql/ql/test/callgraph/callgraph.expected | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ql/ql/test/callgraph/Foo.qll b/ql/ql/test/callgraph/Foo.qll index ec801d08251..70cb53587cf 100644 --- a/ql/ql/test/callgraph/Foo.qll +++ b/ql/ql/test/callgraph/Foo.qll @@ -10,7 +10,9 @@ class Foo extends AstNode { predicate baz() { bar() } } -class Sub extends Foo { } +class Sub extends Foo { + override predicate baz() { not super.baz() } +} query predicate test2() { any(Foo f).bar() } diff --git a/ql/ql/test/callgraph/callgraph.expected b/ql/ql/test/callgraph/callgraph.expected index 97c36a05cd8..823e8d2553a 100644 --- a/ql/ql/test/callgraph/callgraph.expected +++ b/ql/ql/test/callgraph/callgraph.expected @@ -6,7 +6,7 @@ getTarget | Baz.qll:8:18:8:44 | MemberCall | Baz.qll:4:10:4:24 | ClassPredicate getImportedPath | | Foo.qll:5:26:5:30 | PredicateCall | Foo.qll:3:11:3:13 | ClasslessPredicate foo | | Foo.qll:10:21:10:25 | PredicateCall | Foo.qll:8:13:8:15 | ClassPredicate bar | -| Foo.qll:14:30:14:40 | MemberCall | Foo.qll:10:13:10:15 | ClassPredicate baz | +| Foo.qll:14:34:14:44 | MemberCall | Foo.qll:10:13:10:15 | ClassPredicate baz | | Foo.qll:17:27:17:42 | MemberCall | Foo.qll:8:13:8:15 | ClassPredicate bar | | Foo.qll:29:5:29:16 | PredicateCall | Foo.qll:20:13:20:20 | ClasslessPredicate myThing2 | | Foo.qll:29:5:29:16 | PredicateCall | Foo.qll:26:13:26:18 | ClasslessPredicate alias2 | From 9b50336e47615ae996938f6a3c336ba06a7dbe52 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Fri, 19 Aug 2022 14:48:36 +0200 Subject: [PATCH 25/30] Swift: synthesize `MethodRefExpr` This introduces a `MethodRefExpr` node synthesized out of `DotSyntaxCallExpr` under the `LookupExpr` hierarchy. This means that much like ```free_function(1, 2)``` is a `CallExpr` with `getFunction` giving a `DeclRefExpr`, ```foo.method(1, 2)``` is now a `CallExpr` with `getFunction` giving a `MethodRefExpr`. `ApplyExpr::getStaticTarget` has been made work with it (as well as `ConstructorRefCallExpr` which for the moment has been left where it is), a new `MethodApplyExpr` has been introduced deriving from it, and control and data flow libraries have adapted. A small but was fixed in `qlgen` where the default constructor for DB types was not correctly subtracting derived IPA types depending on the order of definitions in `schema.yml`. There are still some occurrences of `DotSyntaxCallExpr`, and as already mentioned the other `SelfApply` class (`ConstructorRefCallExpr`) was left alone. Their treatment is left for a future PR. --- swift/codegen/generators/qlgen.py | 6 +- swift/codegen/schema.yml | 11 +- .../internal/ControlFlowGraphImpl.qll | 26 +- swift/ql/lib/codeql/swift/dataflow/Ssa.qll | 4 +- .../internal/FlowSummaryImplSpecific.qll | 4 +- .../dataflow/internal/SsaImplSpecific.qll | 6 +- .../internal/TaintTrackingPrivate.qll | 9 +- swift/ql/lib/codeql/swift/elements.qll | 1 + .../codeql/swift/elements/expr/ApplyExpr.qll | 26 +- .../elements/expr/ArithmeticOperation.qll | 12 +- .../expr/DotSyntaxCallExprConstructor.qll | 3 +- .../swift/elements/expr/LogicalOperation.qll | 6 +- .../swift/elements/expr/MethodRefExpr.qll | 24 + .../expr/MethodRefExprConstructor.qll | 5 + .../swift/generated/GetImmediateParent.qll | 6 +- .../swift/generated/PureSynthConstructors.qll | 2 +- swift/ql/lib/codeql/swift/generated/Raw.qll | 6 +- swift/ql/lib/codeql/swift/generated/Synth.qll | 13 +- .../swift/generated/SynthConstructors.qll | 1 + .../swift/generated/expr/DynamicTypeExpr.qll | 6 +- .../swift/generated/expr/LookupExpr.qll | 6 +- .../swift/generated/expr/MethodRefExpr.qll | 8 + .../swift/generated/expr/SelfApplyExpr.qll | 6 +- swift/ql/lib/swift.dbscheme | 11 +- .../Security/CWE-079/UnsafeWebViewFetch.ql | 2 +- .../CWE-135/StringLengthConflation.ql | 14 +- .../extractor-tests/expressions/all.expected | 50 +- .../ConstructorRefCallExpr.expected | 6 +- .../ConstructorRefCallExpr.ql | 6 +- .../DotSyntaxCallExpr.expected | 10 +- .../DotSyntaxCallExpr/DotSyntaxCallExpr.ql | 6 +- .../DotSyntaxCallExpr_getArgument.expected | 10 +- .../DotSyntaxCallExpr_getType.expected | 10 +- .../DotSyntaxCallExpr/dot_syntax_call.swift | 7 - .../expr/MethodRefExpr/MethodRefExpr.expected | 4 + .../expr/MethodRefExpr/MethodRefExpr.ql | 10 + .../MethodRefExpr_getMember.expected | 4 + .../MethodRefExpr/MethodRefExpr_getMember.ql | 7 + .../MethodRefExpr_getType.expected | 4 + .../MethodRefExpr/MethodRefExpr_getType.ql | 7 + .../expr/MethodRefExpr/method_refs.swift | 13 + .../statements/ConditionElements.expected | 6 +- .../test/extractor-tests/types/Types.expected | 8 +- .../controlflow/graph/Cfg.expected | 1282 +++++++---------- .../library-tests/controlflow/graph/cfg.swift | 4 +- .../dataflow/taint/LocalTaint.expected | 128 +- .../dataflow/taint/Taint.expected | 24 +- .../library-tests/dataflow/taint/string.swift | 4 +- .../arithmeticoperation.expected | 12 +- .../logicaloperation.expected | 12 +- .../test/library-tests/parent/parent.expected | 143 +- .../CWE-079/UnsafeWebViewFetch.expected | 56 +- .../CWE-135/StringLengthConflation.expected | 96 +- 53 files changed, 956 insertions(+), 1197 deletions(-) create mode 100644 swift/ql/lib/codeql/swift/elements/expr/MethodRefExpr.qll create mode 100644 swift/ql/lib/codeql/swift/elements/expr/MethodRefExprConstructor.qll create mode 100644 swift/ql/lib/codeql/swift/generated/expr/MethodRefExpr.qll create mode 100644 swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr.expected create mode 100644 swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr.ql create mode 100644 swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getMember.expected create mode 100644 swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getMember.ql create mode 100644 swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getType.expected create mode 100644 swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getType.ql create mode 100644 swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/method_refs.swift diff --git a/swift/codegen/generators/qlgen.py b/swift/codegen/generators/qlgen.py index 8b5bcaad1dc..38c9ee4145d 100755 --- a/swift/codegen/generators/qlgen.py +++ b/swift/codegen/generators/qlgen.py @@ -275,6 +275,7 @@ def generate(opts, renderer): non_final_ipa_types = [] constructor_imports = [] ipa_constructor_imports = [] + stubs = {} for cls in sorted(data.classes.values(), key=lambda cls: (cls.dir, cls.name)): ipa_type = get_ql_ipa_class(cls) if ipa_type.is_final: @@ -282,7 +283,8 @@ def generate(opts, renderer): if ipa_type.has_params: stub_file = stub_out / cls.dir / f"{cls.name}Constructor.qll" if not stub_file.is_file() or _is_generated_stub(stub_file): - renderer.render(ql.Synth.ConstructorStub(ipa_type), stub_file) + # stub rendering must be postponed as we might not have yet all subtracted ipa types in `ipa_type` + stubs[stub_file] = ql.Synth.ConstructorStub(ipa_type) constructor_import = get_import(stub_file, opts.swift_dir) constructor_imports.append(constructor_import) if ipa_type.is_ipa: @@ -290,6 +292,8 @@ def generate(opts, renderer): else: non_final_ipa_types.append(ipa_type) + for stub_file, data in stubs.items(): + renderer.render(data, stub_file) renderer.render(ql.Synth.Types(schema.root_class_name, final_ipa_types, non_final_ipa_types), out / "Synth.qll") renderer.render(ql.ImportList(constructor_imports), out / "SynthConstructors.qll") renderer.render(ql.ImportList(ipa_constructor_imports), out / "PureSynthConstructors.qll") diff --git a/swift/codegen/schema.yml b/swift/codegen/schema.yml index e77f2d82dcd..2a563bff173 100644 --- a/swift/codegen/schema.yml +++ b/swift/codegen/schema.yml @@ -419,7 +419,7 @@ DotSyntaxBaseIgnoredExpr: DynamicTypeExpr: _extends: Expr _children: - base_expr: Expr + base: Expr EditorPlaceholderExpr: _extends: Expr @@ -492,7 +492,7 @@ LiteralExpr: LookupExpr: _extends: Expr _children: - base_expr: Expr + base: Expr member: Decl? MakeTemporarilyEscapableExpr: @@ -835,7 +835,7 @@ PrefixUnaryExpr: SelfApplyExpr: _extends: ApplyExpr _children: - base_expr: Expr + base: Expr ArrayExpr: _extends: CollectionExpr @@ -990,6 +990,11 @@ MemberRefExpr: has_direct_to_implementation_semantics: predicate has_ordinary_semantics: predicate +MethodRefExpr: + _extends: LookupExpr + _synth: + from: DotSyntaxCallExpr + SubscriptExpr: _extends: - LookupExpr diff --git a/swift/ql/lib/codeql/swift/controlflow/internal/ControlFlowGraphImpl.qll b/swift/ql/lib/codeql/swift/controlflow/internal/ControlFlowGraphImpl.qll index 447db6b886a..83bd973b591 100644 --- a/swift/ql/lib/codeql/swift/controlflow/internal/ControlFlowGraphImpl.qll +++ b/swift/ql/lib/codeql/swift/controlflow/internal/ControlFlowGraphImpl.qll @@ -1206,13 +1206,13 @@ module Exprs { override SubscriptExpr ast; final override predicate propagatesAbnormal(ControlFlowElement child) { - child.asAstNode() = ast.getBaseExpr().getFullyConverted() + child.asAstNode() = ast.getBase().getFullyConverted() or child.asAstNode() = ast.getAnArgument().getExpr().getFullyConverted() } final override predicate first(ControlFlowElement first) { - astFirst(ast.getBaseExpr().getFullyConverted(), first) + astFirst(ast.getBase().getFullyConverted(), first) } final override predicate last(ControlFlowElement last, Completion c) { @@ -1230,7 +1230,7 @@ module Exprs { } override predicate succ(ControlFlowElement pred, ControlFlowElement succ, Completion c) { - astLast(ast.getBaseExpr().getFullyConverted(), pred, c) and + astLast(ast.getBase().getFullyConverted(), pred, c) and c instanceof NormalCompletion and astFirst(ast.getFirstArgument().getExpr().getFullyConverted(), succ) or @@ -1296,7 +1296,7 @@ module Exprs { override DynamicTypeExpr ast; final override ControlFlowElement getChildElement(int i) { - result.asAstNode() = ast.getBaseExpr().getFullyConverted() and i = 0 + result.asAstNode() = ast.getBase().getFullyConverted() and i = 0 } } @@ -1427,6 +1427,14 @@ module Exprs { } } + class MethodRefExprTree extends AstStandardPreOrderTree { + override MethodRefExpr ast; + + override ControlFlowElement getChildElement(int i) { + i = 0 and result.asAstNode() = ast.getBase().getFullyConverted() + } + } + module MemberRefs { /** * The control-flow of a member reference expression. @@ -1439,11 +1447,11 @@ module Exprs { override MemberRefExpr ast; final override predicate propagatesAbnormal(ControlFlowElement child) { - child.asAstNode() = ast.getBaseExpr().getFullyConverted() + child.asAstNode() = ast.getBase().getFullyConverted() } final override predicate first(ControlFlowElement first) { - astFirst(ast.getBaseExpr().getFullyConverted(), first) + astFirst(ast.getBase().getFullyConverted(), first) } } @@ -1459,7 +1467,7 @@ module Exprs { } override predicate succ(ControlFlowElement pred, ControlFlowElement succ, Completion c) { - astLast(ast.getBaseExpr().getFullyConverted(), pred, c) and + astLast(ast.getBase().getFullyConverted(), pred, c) and c instanceof NormalCompletion and succ.asAstNode() = ast } @@ -1489,7 +1497,7 @@ module Exprs { } override predicate succ(ControlFlowElement pred, ControlFlowElement succ, Completion c) { - astLast(ast.getBaseExpr().getFullyConverted(), pred, c) and + astLast(ast.getBase().getFullyConverted(), pred, c) and c instanceof NormalCompletion and succ.asAstNode() = ast } @@ -1510,7 +1518,7 @@ module Exprs { } override predicate succ(ControlFlowElement pred, ControlFlowElement succ, Completion c) { - astLast(ast.getBaseExpr().getFullyConverted(), pred, c) and + astLast(ast.getBase().getFullyConverted(), pred, c) and c instanceof NormalCompletion and isPropertyGetterElement(succ, accessor, ast) } diff --git a/swift/ql/lib/codeql/swift/dataflow/Ssa.qll b/swift/ql/lib/codeql/swift/dataflow/Ssa.qll index f40a19cbc0f..efa4f373165 100644 --- a/swift/ql/lib/codeql/swift/dataflow/Ssa.qll +++ b/swift/ql/lib/codeql/swift/dataflow/Ssa.qll @@ -86,11 +86,11 @@ module Ssa { predicate isInoutDef(ExprCfgNode argument) { // TODO: This should probably not be only `ExprCfgNode`s. exists( - ApplyExpr c, BasicBlock bb, int blockIndex, int argIndex, VarDecl v, InOutExpr argExpr // TODO: use CFG node for assignment expr + ApplyExpr c, BasicBlock bb, int blockIndex, VarDecl v, InOutExpr argExpr // TODO: use CFG node for assignment expr | this.definesAt(v, bb, blockIndex) and bb.getNode(blockIndex).getNode().asAstNode() = c and - c.getArgument(argIndex).getExpr() = argExpr and + [c.getAnArgument().getExpr(), c.getQualifier()] = argExpr and argExpr = argument.getNode().asAstNode() and argExpr.getSubExpr() = v.getAnAccess() // TODO: fields? ) diff --git a/swift/ql/lib/codeql/swift/dataflow/internal/FlowSummaryImplSpecific.qll b/swift/ql/lib/codeql/swift/dataflow/internal/FlowSummaryImplSpecific.qll index 79288e648e6..d696b659371 100644 --- a/swift/ql/lib/codeql/swift/dataflow/internal/FlowSummaryImplSpecific.qll +++ b/swift/ql/lib/codeql/swift/dataflow/internal/FlowSummaryImplSpecific.qll @@ -154,9 +154,7 @@ class InterpretNode extends TInterpretNode { DataFlowCallable asCallable() { result.getUnderlyingCallable() = this.asElement() } /** Gets the target of this call, if any. */ - AbstractFunctionDecl getCallTarget() { - result = this.asCall().asCall().getFunction().(ApplyExpr).getStaticTarget() - } + AbstractFunctionDecl getCallTarget() { result = this.asCall().asCall().getStaticTarget() } /** Gets a textual representation of this node. */ string toString() { diff --git a/swift/ql/lib/codeql/swift/dataflow/internal/SsaImplSpecific.qll b/swift/ql/lib/codeql/swift/dataflow/internal/SsaImplSpecific.qll index 2f507b31645..3adc7ba8aaf 100644 --- a/swift/ql/lib/codeql/swift/dataflow/internal/SsaImplSpecific.qll +++ b/swift/ql/lib/codeql/swift/dataflow/internal/SsaImplSpecific.qll @@ -29,9 +29,9 @@ predicate variableWrite(BasicBlock bb, int i, SourceVariable v, boolean certain) certain = true ) or - exists(ApplyExpr call, Argument arg | - arg.getExpr().(InOutExpr).getSubExpr() = v.getAnAccess() and - call.getAnArgument() = arg and + exists(ApplyExpr call, InOutExpr expr | + expr = [call.getAnArgument().getExpr(), call.getQualifier()] and + expr.getSubExpr() = v.getAnAccess() and bb.getNode(i).getNode().asAstNode() = call and certain = false ) diff --git a/swift/ql/lib/codeql/swift/dataflow/internal/TaintTrackingPrivate.qll b/swift/ql/lib/codeql/swift/dataflow/internal/TaintTrackingPrivate.qll index 1292e0cf181..b7552cb8049 100644 --- a/swift/ql/lib/codeql/swift/dataflow/internal/TaintTrackingPrivate.qll +++ b/swift/ql/lib/codeql/swift/dataflow/internal/TaintTrackingPrivate.qll @@ -28,11 +28,10 @@ private module Cached { // appendInterpolation(&$interpolated, n) // appendLiteral(&$interpolated, " years old.") // ``` - exists(ApplyExpr apply1, ApplyExpr apply2, ExprCfgNode e | - nodeFrom.asExpr() = [apply1, apply2].getAnArgument().getExpr() and - apply1.getFunction() = apply2 and - apply2.getStaticTarget().getName() = ["appendLiteral(_:)", "appendInterpolation(_:)"] and - e.getExpr() = apply2.getAnArgument().getExpr() and + exists(ApplyExpr apply, ExprCfgNode e | + nodeFrom.asExpr() = [apply.getAnArgument().getExpr(), apply.getQualifier()] and + apply.getStaticTarget().getName() = ["appendLiteral(_:)", "appendInterpolation(_:)"] and + e.getExpr() = [apply.getAnArgument().getExpr(), apply.getQualifier()] and nodeTo.asDefinition().(Ssa::WriteDefinition).isInoutDef(e) ) or diff --git a/swift/ql/lib/codeql/swift/elements.qll b/swift/ql/lib/codeql/swift/elements.qll index 993c558d634..86bd9301c0f 100644 --- a/swift/ql/lib/codeql/swift/elements.qll +++ b/swift/ql/lib/codeql/swift/elements.qll @@ -137,6 +137,7 @@ import codeql.swift.elements.expr.MagicIdentifierLiteralExpr import codeql.swift.elements.expr.MakeTemporarilyEscapableExpr import codeql.swift.elements.expr.MemberRefExpr import codeql.swift.elements.expr.MetatypeConversionExpr +import codeql.swift.elements.expr.MethodRefExpr import codeql.swift.elements.expr.NilLiteralExpr import codeql.swift.elements.expr.NumberLiteralExpr import codeql.swift.elements.expr.ObjCSelectorExpr diff --git a/swift/ql/lib/codeql/swift/elements/expr/ApplyExpr.qll b/swift/ql/lib/codeql/swift/elements/expr/ApplyExpr.qll index d3103b100a9..09efb4098fe 100644 --- a/swift/ql/lib/codeql/swift/elements/expr/ApplyExpr.qll +++ b/swift/ql/lib/codeql/swift/elements/expr/ApplyExpr.qll @@ -1,9 +1,25 @@ private import codeql.swift.generated.expr.ApplyExpr private import codeql.swift.elements.decl.AbstractFunctionDecl private import codeql.swift.elements.expr.DeclRefExpr +private import codeql.swift.elements.expr.MethodRefExpr +private import codeql.swift.elements.expr.ConstructorRefCallExpr class ApplyExpr extends ApplyExprBase { - AbstractFunctionDecl getStaticTarget() { result = this.getFunction().(DeclRefExpr).getDecl() } + AbstractFunctionDecl getStaticTarget() { + exists(Expr f | + f = this.getFunction() and + ( + result = f.(DeclRefExpr).getDecl() + or + result = f.(MethodRefExpr).getMethod() + or + result = f.(ConstructorRefCallExpr).getFunction().(DeclRefExpr).getDecl() + ) + ) + } + + /** Gets the method qualifier, if this is applying a method */ + Expr getQualifier() { none() } override string toString() { result = "call to " + this.getStaticTarget().toString() @@ -12,3 +28,11 @@ class ApplyExpr extends ApplyExprBase { result = "call to ..." } } + +class MethodApplyExpr extends ApplyExpr { + MethodApplyExpr() { this.getFunction() instanceof MethodRefExpr } + + AbstractFunctionDecl getMethod() { result = this.getFunction().(MethodRefExpr).getMethod() } + + override Expr getQualifier() { result = this.getFunction().(MethodRefExpr).getBase() } +} diff --git a/swift/ql/lib/codeql/swift/elements/expr/ArithmeticOperation.qll b/swift/ql/lib/codeql/swift/elements/expr/ArithmeticOperation.qll index 27e7e42e4fa..160aeaa1c3a 100644 --- a/swift/ql/lib/codeql/swift/elements/expr/ArithmeticOperation.qll +++ b/swift/ql/lib/codeql/swift/elements/expr/ArithmeticOperation.qll @@ -48,7 +48,7 @@ class BinaryArithmeticOperation extends BinaryExpr { * ``` */ class AddExpr extends BinaryExpr { - AddExpr() { this.getFunction().(DotSyntaxCallExpr).getStaticTarget().getName() = "+(_:_:)" } + AddExpr() { this.getStaticTarget().getName() = "+(_:_:)" } } /** @@ -58,7 +58,7 @@ class AddExpr extends BinaryExpr { * ``` */ class SubExpr extends BinaryExpr { - SubExpr() { this.getFunction().(DotSyntaxCallExpr).getStaticTarget().getName() = "-(_:_:)" } + SubExpr() { this.getStaticTarget().getName() = "-(_:_:)" } } /** @@ -68,7 +68,7 @@ class SubExpr extends BinaryExpr { * ``` */ class MulExpr extends BinaryExpr { - MulExpr() { this.getFunction().(DotSyntaxCallExpr).getStaticTarget().getName() = "*(_:_:)" } + MulExpr() { this.getStaticTarget().getName() = "*(_:_:)" } } /** @@ -78,7 +78,7 @@ class MulExpr extends BinaryExpr { * ``` */ class DivExpr extends BinaryExpr { - DivExpr() { this.getFunction().(DotSyntaxCallExpr).getStaticTarget().getName() = "/(_:_:)" } + DivExpr() { this.getStaticTarget().getName() = "/(_:_:)" } } /** @@ -88,7 +88,7 @@ class DivExpr extends BinaryExpr { * ``` */ class RemExpr extends BinaryExpr { - RemExpr() { this.getFunction().(DotSyntaxCallExpr).getStaticTarget().getName() = "%(_:_:)" } + RemExpr() { this.getStaticTarget().getName() = "%(_:_:)" } } /** @@ -108,5 +108,5 @@ class UnaryArithmeticOperation extends PrefixUnaryExpr { * ``` */ class UnaryMinusExpr extends PrefixUnaryExpr { - UnaryMinusExpr() { this.getFunction().(DotSyntaxCallExpr).getStaticTarget().getName() = "-(_:)" } + UnaryMinusExpr() { this.getStaticTarget().getName() = "-(_:)" } } diff --git a/swift/ql/lib/codeql/swift/elements/expr/DotSyntaxCallExprConstructor.qll b/swift/ql/lib/codeql/swift/elements/expr/DotSyntaxCallExprConstructor.qll index b73d9577d22..0e2eb5990e7 100644 --- a/swift/ql/lib/codeql/swift/elements/expr/DotSyntaxCallExprConstructor.qll +++ b/swift/ql/lib/codeql/swift/elements/expr/DotSyntaxCallExprConstructor.qll @@ -1,4 +1,5 @@ // generated by codegen/codegen.py, remove this comment if you wish to edit this file private import codeql.swift.generated.Raw +private import codeql.swift.generated.PureSynthConstructors -predicate constructDotSyntaxCallExpr(Raw::DotSyntaxCallExpr id) { any() } +predicate constructDotSyntaxCallExpr(Raw::DotSyntaxCallExpr id) { not constructMethodRefExpr(id) } diff --git a/swift/ql/lib/codeql/swift/elements/expr/LogicalOperation.qll b/swift/ql/lib/codeql/swift/elements/expr/LogicalOperation.qll index 5a550923199..107392d24f1 100644 --- a/swift/ql/lib/codeql/swift/elements/expr/LogicalOperation.qll +++ b/swift/ql/lib/codeql/swift/elements/expr/LogicalOperation.qll @@ -6,12 +6,10 @@ private import codeql.swift.elements.expr.DeclRefExpr private import codeql.swift.elements.decl.ConcreteFuncDecl private predicate unaryHasName(PrefixUnaryExpr e, string name) { - e.getFunction().(DotSyntaxCallExpr).getStaticTarget().getName() = name + e.getStaticTarget().getName() = name } -private predicate binaryHasName(BinaryExpr e, string name) { - e.getFunction().(DotSyntaxCallExpr).getStaticTarget().getName() = name -} +private predicate binaryHasName(BinaryExpr e, string name) { e.getStaticTarget().getName() = name } class LogicalAndExpr extends BinaryExpr { LogicalAndExpr() { binaryHasName(this, "&&(_:_:)") } diff --git a/swift/ql/lib/codeql/swift/elements/expr/MethodRefExpr.qll b/swift/ql/lib/codeql/swift/elements/expr/MethodRefExpr.qll new file mode 100644 index 00000000000..c2c54b7b041 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/expr/MethodRefExpr.qll @@ -0,0 +1,24 @@ +private import codeql.swift.generated.expr.MethodRefExpr +private import codeql.swift.elements.expr.Expr +private import codeql.swift.elements.decl.Decl +private import codeql.swift.elements.decl.AbstractFunctionDecl +private import codeql.swift.generated.Raw +private import codeql.swift.generated.Synth + +class MethodRefExpr extends MethodRefExprBase { + override string toString() { result = "." + this.getMember().toString() } + + override Expr getImmediateBase() { + result = Synth::convertExprFromRaw(this.getUnderlying().getBase()) + } + + override Decl getImmediateMember() { + result = + Synth::convertDeclFromRaw(this.getUnderlying().getFunction().(Raw::DeclRefExpr).getDecl()) + } + + AbstractFunctionDecl getMethod() { result = getMember() } + + cached + private Raw::DotSyntaxCallExpr getUnderlying() { this = Synth::TMethodRefExpr(result) } +} diff --git a/swift/ql/lib/codeql/swift/elements/expr/MethodRefExprConstructor.qll b/swift/ql/lib/codeql/swift/elements/expr/MethodRefExprConstructor.qll new file mode 100644 index 00000000000..88e5c90df94 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/expr/MethodRefExprConstructor.qll @@ -0,0 +1,5 @@ +private import codeql.swift.generated.Raw + +predicate constructMethodRefExpr(Raw::DotSyntaxCallExpr id) { + id.getFunction() instanceof Raw::DeclRefExpr +} diff --git a/swift/ql/lib/codeql/swift/generated/GetImmediateParent.qll b/swift/ql/lib/codeql/swift/generated/GetImmediateParent.qll index aa3cf948a62..59d1356b4a7 100644 --- a/swift/ql/lib/codeql/swift/generated/GetImmediateParent.qll +++ b/swift/ql/lib/codeql/swift/generated/GetImmediateParent.qll @@ -63,7 +63,7 @@ Element getAnImmediateChild(Element e) { or result = e.(DotSyntaxBaseIgnoredExpr).getImmediateSubExpr() or - result = e.(DynamicTypeExpr).getImmediateBaseExpr() + result = e.(DynamicTypeExpr).getImmediateBase() or result = e.(EnumIsCaseExpr).getImmediateSubExpr() or @@ -99,7 +99,7 @@ Element getAnImmediateChild(Element e) { or result = e.(LazyInitializerExpr).getImmediateSubExpr() or - result = e.(LookupExpr).getImmediateBaseExpr() + result = e.(LookupExpr).getImmediateBase() or result = e.(MakeTemporarilyEscapableExpr).getImmediateEscapingClosure() or @@ -123,7 +123,7 @@ Element getAnImmediateChild(Element e) { or result = e.(RebindSelfInConstructorExpr).getImmediateSelf() or - result = e.(SelfApplyExpr).getImmediateBaseExpr() + result = e.(SelfApplyExpr).getImmediateBase() or result = e.(SequenceExpr).getImmediateElement(_) or diff --git a/swift/ql/lib/codeql/swift/generated/PureSynthConstructors.qll b/swift/ql/lib/codeql/swift/generated/PureSynthConstructors.qll index e489ba5e842..3a4b7c6d6d4 100644 --- a/swift/ql/lib/codeql/swift/generated/PureSynthConstructors.qll +++ b/swift/ql/lib/codeql/swift/generated/PureSynthConstructors.qll @@ -1,2 +1,2 @@ - // generated by codegen/codegen.py +import codeql.swift.elements.expr.MethodRefExprConstructor diff --git a/swift/ql/lib/codeql/swift/generated/Raw.qll b/swift/ql/lib/codeql/swift/generated/Raw.qll index cfa204c5ec0..5a7658e6971 100644 --- a/swift/ql/lib/codeql/swift/generated/Raw.qll +++ b/swift/ql/lib/codeql/swift/generated/Raw.qll @@ -509,7 +509,7 @@ module Raw { class DynamicTypeExpr extends @dynamic_type_expr, Expr { override string toString() { result = "DynamicTypeExpr" } - Expr getBaseExpr() { dynamic_type_exprs(this, result) } + Expr getBase() { dynamic_type_exprs(this, result) } } class EditorPlaceholderExpr extends @editor_placeholder_expr, Expr { @@ -657,7 +657,7 @@ module Raw { class LiteralExpr extends @literal_expr, Expr { } class LookupExpr extends @lookup_expr, Expr { - Expr getBaseExpr() { lookup_exprs(this, result) } + Expr getBase() { lookup_exprs(this, result) } Decl getMember() { lookup_expr_members(this, result) } } @@ -1256,7 +1256,7 @@ module Raw { } class SelfApplyExpr extends @self_apply_expr, ApplyExpr { - Expr getBaseExpr() { self_apply_exprs(this, result) } + Expr getBase() { self_apply_exprs(this, result) } } class StringToPointerExpr extends @string_to_pointer_expr, ImplicitConversionExpr { diff --git a/swift/ql/lib/codeql/swift/generated/Synth.qll b/swift/ql/lib/codeql/swift/generated/Synth.qll index 220f4505b44..1923e661c7b 100644 --- a/swift/ql/lib/codeql/swift/generated/Synth.qll +++ b/swift/ql/lib/codeql/swift/generated/Synth.qll @@ -145,6 +145,7 @@ module Synth { } or TMemberRefExpr(Raw::MemberRefExpr id) { constructMemberRefExpr(id) } or TMetatypeConversionExpr(Raw::MetatypeConversionExpr id) { constructMetatypeConversionExpr(id) } or + TMethodRefExpr(Raw::DotSyntaxCallExpr id) { constructMethodRefExpr(id) } or TNilLiteralExpr(Raw::NilLiteralExpr id) { constructNilLiteralExpr(id) } or TObjCSelectorExpr(Raw::ObjCSelectorExpr id) { constructObjCSelectorExpr(id) } or TObjectLiteralExpr(Raw::ObjectLiteralExpr id) { constructObjectLiteralExpr(id) } or @@ -403,7 +404,7 @@ module Synth { TBuiltinLiteralExpr or TInterpolatedStringLiteralExpr or TNilLiteralExpr or TObjectLiteralExpr or TRegexLiteralExpr; - class TLookupExpr = TDynamicLookupExpr or TMemberRefExpr or TSubscriptExpr; + class TLookupExpr = TDynamicLookupExpr or TMemberRefExpr or TMethodRefExpr or TSubscriptExpr; class TNumberLiteralExpr = TFloatLiteralExpr or TIntegerLiteralExpr; @@ -892,6 +893,9 @@ module Synth { result = TMetatypeConversionExpr(e) } + cached + TMethodRefExpr convertMethodRefExprFromRaw(Raw::Element e) { result = TMethodRefExpr(e) } + cached TNilLiteralExpr convertNilLiteralExprFromRaw(Raw::Element e) { result = TNilLiteralExpr(e) } @@ -1846,6 +1850,8 @@ module Synth { or result = convertMemberRefExprFromRaw(e) or + result = convertMethodRefExprFromRaw(e) + or result = convertSubscriptExprFromRaw(e) } @@ -2547,6 +2553,9 @@ module Synth { e = TMetatypeConversionExpr(result) } + cached + Raw::Element convertMethodRefExprToRaw(TMethodRefExpr e) { e = TMethodRefExpr(result) } + cached Raw::Element convertNilLiteralExprToRaw(TNilLiteralExpr e) { e = TNilLiteralExpr(result) } @@ -3501,6 +3510,8 @@ module Synth { or result = convertMemberRefExprToRaw(e) or + result = convertMethodRefExprToRaw(e) + or result = convertSubscriptExprToRaw(e) } diff --git a/swift/ql/lib/codeql/swift/generated/SynthConstructors.qll b/swift/ql/lib/codeql/swift/generated/SynthConstructors.qll index 71606f9176e..934bee82c1b 100644 --- a/swift/ql/lib/codeql/swift/generated/SynthConstructors.qll +++ b/swift/ql/lib/codeql/swift/generated/SynthConstructors.qll @@ -103,6 +103,7 @@ import codeql.swift.elements.expr.MagicIdentifierLiteralExprConstructor import codeql.swift.elements.expr.MakeTemporarilyEscapableExprConstructor import codeql.swift.elements.expr.MemberRefExprConstructor import codeql.swift.elements.expr.MetatypeConversionExprConstructor +import codeql.swift.elements.expr.MethodRefExprConstructor import codeql.swift.elements.expr.NilLiteralExprConstructor import codeql.swift.elements.expr.ObjCSelectorExprConstructor import codeql.swift.elements.expr.ObjectLiteralExprConstructor diff --git a/swift/ql/lib/codeql/swift/generated/expr/DynamicTypeExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/DynamicTypeExpr.qll index 6bf61a1fc67..0ba1907a2a9 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/DynamicTypeExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/DynamicTypeExpr.qll @@ -6,12 +6,12 @@ import codeql.swift.elements.expr.Expr class DynamicTypeExprBase extends Synth::TDynamicTypeExpr, Expr { override string getAPrimaryQlClass() { result = "DynamicTypeExpr" } - Expr getImmediateBaseExpr() { + Expr getImmediateBase() { result = Synth::convertExprFromRaw(Synth::convertDynamicTypeExprToRaw(this) .(Raw::DynamicTypeExpr) - .getBaseExpr()) + .getBase()) } - final Expr getBaseExpr() { result = getImmediateBaseExpr().resolve() } + final Expr getBase() { result = getImmediateBase().resolve() } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/LookupExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/LookupExpr.qll index 8541bb81bce..30668251d85 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/LookupExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/LookupExpr.qll @@ -5,12 +5,12 @@ import codeql.swift.elements.decl.Decl import codeql.swift.elements.expr.Expr class LookupExprBase extends Synth::TLookupExpr, Expr { - Expr getImmediateBaseExpr() { + Expr getImmediateBase() { result = - Synth::convertExprFromRaw(Synth::convertLookupExprToRaw(this).(Raw::LookupExpr).getBaseExpr()) + Synth::convertExprFromRaw(Synth::convertLookupExprToRaw(this).(Raw::LookupExpr).getBase()) } - final Expr getBaseExpr() { result = getImmediateBaseExpr().resolve() } + final Expr getBase() { result = getImmediateBase().resolve() } Decl getImmediateMember() { result = diff --git a/swift/ql/lib/codeql/swift/generated/expr/MethodRefExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/MethodRefExpr.qll new file mode 100644 index 00000000000..859cda871a6 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/expr/MethodRefExpr.qll @@ -0,0 +1,8 @@ +// generated by codegen/codegen.py +private import codeql.swift.generated.Synth +private import codeql.swift.generated.Raw +import codeql.swift.elements.expr.LookupExpr + +class MethodRefExprBase extends Synth::TMethodRefExpr, LookupExpr { + override string getAPrimaryQlClass() { result = "MethodRefExpr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/expr/SelfApplyExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/SelfApplyExpr.qll index bab714b28f5..f3a32aee807 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/SelfApplyExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/SelfApplyExpr.qll @@ -5,12 +5,12 @@ import codeql.swift.elements.expr.ApplyExpr import codeql.swift.elements.expr.Expr class SelfApplyExprBase extends Synth::TSelfApplyExpr, ApplyExpr { - Expr getImmediateBaseExpr() { + Expr getImmediateBase() { result = Synth::convertExprFromRaw(Synth::convertSelfApplyExprToRaw(this) .(Raw::SelfApplyExpr) - .getBaseExpr()) + .getBase()) } - final Expr getBaseExpr() { result = getImmediateBaseExpr().resolve() } + final Expr getBase() { result = getImmediateBase().resolve() } } diff --git a/swift/ql/lib/swift.dbscheme b/swift/ql/lib/swift.dbscheme index 7206f9541cf..6e2c2b13890 100644 --- a/swift/ql/lib/swift.dbscheme +++ b/swift/ql/lib/swift.dbscheme @@ -908,7 +908,7 @@ dot_syntax_base_ignored_exprs( //dir=expr dynamic_type_exprs( //dir=expr unique int id: @dynamic_type_expr, - int base_expr: @expr ref + int base: @expr ref ); editor_placeholder_exprs( //dir=expr @@ -1048,13 +1048,14 @@ lazy_initializer_exprs( //dir=expr @lookup_expr = @dynamic_lookup_expr | @member_ref_expr +| @method_ref_expr | @subscript_expr ; #keyset[id] lookup_exprs( //dir=expr int id: @lookup_expr ref, - int base_expr: @expr ref + int base: @expr ref ); #keyset[id] @@ -1613,7 +1614,7 @@ prefix_unary_exprs( //dir=expr #keyset[id] self_apply_exprs( //dir=expr int id: @self_apply_expr ref, - int base_expr: @expr ref + int base: @expr ref ); array_exprs( //dir=expr @@ -1859,6 +1860,10 @@ member_ref_expr_has_ordinary_semantics( //dir=expr int id: @member_ref_expr ref ); +method_ref_exprs( //dir=expr + unique int id: @method_ref_expr +); + subscript_exprs( //dir=expr unique int id: @subscript_expr ); diff --git a/swift/ql/src/queries/Security/CWE-079/UnsafeWebViewFetch.ql b/swift/ql/src/queries/Security/CWE-079/UnsafeWebViewFetch.ql index 37bf5ec21c4..455cd7e3751 100644 --- a/swift/ql/src/queries/Security/CWE-079/UnsafeWebViewFetch.ql +++ b/swift/ql/src/queries/Security/CWE-079/UnsafeWebViewFetch.ql @@ -50,7 +50,7 @@ class Sink extends DataFlow::Node { ) and c.getName() = className and c.getAMember() = funcDecl and - call.getFunction().(ApplyExpr).getStaticTarget() = funcDecl + call.getStaticTarget() = funcDecl ) and // match up `funcName`, `paramName`, `arg`, `node`. funcDecl.getName() = funcName and diff --git a/swift/ql/src/queries/Security/CWE-135/StringLengthConflation.ql b/swift/ql/src/queries/Security/CWE-135/StringLengthConflation.ql index c9bdff012ce..552eca23772 100644 --- a/swift/ql/src/queries/Security/CWE-135/StringLengthConflation.ql +++ b/swift/ql/src/queries/Security/CWE-135/StringLengthConflation.ql @@ -58,7 +58,7 @@ class StringLengthConflationConfiguration extends DataFlow::Configuration { override predicate isSource(DataFlow::Node node, string flowstate) { // result of a call to `String.count` exists(MemberRefExpr member | - member.getBaseExpr().getType().getName() = "String" and + member.getBase().getType().getName() = "String" and member.getMember().(VarDecl).getName() = "count" and node.asExpr() = member and flowstate = "String" @@ -66,7 +66,7 @@ class StringLengthConflationConfiguration extends DataFlow::Configuration { or // result of a call to `NSString.length` exists(MemberRefExpr member | - member.getBaseExpr().getType().getName() = ["NSString", "NSMutableString"] and + member.getBase().getType().getName() = ["NSString", "NSMutableString"] and member.getMember().(VarDecl).getName() = "length" and node.asExpr() = member and flowstate = "NSString" @@ -74,7 +74,7 @@ class StringLengthConflationConfiguration extends DataFlow::Configuration { or // result of a call to `String.utf8.count` exists(MemberRefExpr member | - member.getBaseExpr().getType().getName() = "String.UTF8View" and + member.getBase().getType().getName() = "String.UTF8View" and member.getMember().(VarDecl).getName() = "count" and node.asExpr() = member and flowstate = "String.utf8" @@ -82,7 +82,7 @@ class StringLengthConflationConfiguration extends DataFlow::Configuration { or // result of a call to `String.utf16.count` exists(MemberRefExpr member | - member.getBaseExpr().getType().getName() = "String.UTF16View" and + member.getBase().getType().getName() = "String.UTF16View" and member.getMember().(VarDecl).getName() = "count" and node.asExpr() = member and flowstate = "String.utf16" @@ -90,7 +90,7 @@ class StringLengthConflationConfiguration extends DataFlow::Configuration { or // result of a call to `String.unicodeScalars.count` exists(MemberRefExpr member | - member.getBaseExpr().getType().getName() = "String.UnicodeScalarView" and + member.getBase().getType().getName() = "String.UnicodeScalarView" and member.getMember().(VarDecl).getName() = "count" and node.asExpr() = member and flowstate = "String.unicodeScalars" @@ -136,7 +136,7 @@ class StringLengthConflationConfiguration extends DataFlow::Configuration { ) and c.getName() = className and c.getAMember() = funcDecl and - call.getFunction().(ApplyExpr).getStaticTarget() = funcDecl and + call.getStaticTarget() = funcDecl and flowstate = "NSString" ) or @@ -169,7 +169,7 @@ class StringLengthConflationConfiguration extends DataFlow::Configuration { funcName = ["formIndex(_:offsetBy:)", "formIndex(_:offsetBy:limitBy:)"] and paramName = "distance" ) and - call.getFunction().(ApplyExpr).getStaticTarget() = funcDecl and + call.getStaticTarget() = funcDecl and flowstate = "String" ) and // match up `funcName`, `paramName`, `arg`, `node`. diff --git a/swift/ql/test/extractor-tests/expressions/all.expected b/swift/ql/test/extractor-tests/expressions/all.expected index b34ca7349cd..15d95241c4f 100644 --- a/swift/ql/test/extractor-tests/expressions/all.expected +++ b/swift/ql/test/extractor-tests/expressions/all.expected @@ -8,31 +8,31 @@ | expressions.swift:7:10:7:10 | OpaqueValueExpr | OpaqueValueExpr | | expressions.swift:7:10:7:10 | TapExpr | TapExpr | | expressions.swift:7:10:7:10 | hello | StringLiteralExpr | -| expressions.swift:7:11:7:10 | call to ... | CallExpr | +| expressions.swift:7:11:7:10 | call to appendLiteral(_:) | CallExpr | | expressions.swift:7:11:7:11 | $interpolation | DeclRefExpr | | expressions.swift:7:11:7:11 | &... | InOutExpr | -| expressions.swift:7:11:7:11 | call to appendLiteral(_:) | DotSyntaxCallExpr | +| expressions.swift:7:11:7:11 | .appendLiteral(_:) | MethodRefExpr | | expressions.swift:7:18:7:18 | $interpolation | DeclRefExpr | | expressions.swift:7:18:7:18 | &... | InOutExpr | +| expressions.swift:7:18:7:18 | .appendInterpolation(_:) | MethodRefExpr | | expressions.swift:7:18:7:18 | appendInterpolation(_:) | DeclRefExpr | -| expressions.swift:7:18:7:18 | call to appendInterpolation(_:) | DotSyntaxCallExpr | -| expressions.swift:7:18:7:20 | call to ... | CallExpr | +| expressions.swift:7:18:7:20 | call to appendInterpolation(_:) | CallExpr | | expressions.swift:7:19:7:19 | a | DeclRefExpr | | expressions.swift:7:21:7:21 | | StringLiteralExpr | | expressions.swift:7:21:7:21 | $interpolation | DeclRefExpr | | expressions.swift:7:21:7:21 | &... | InOutExpr | -| expressions.swift:7:21:7:21 | call to ... | CallExpr | -| expressions.swift:7:21:7:21 | call to appendLiteral(_:) | DotSyntaxCallExpr | +| expressions.swift:7:21:7:21 | .appendLiteral(_:) | MethodRefExpr | +| expressions.swift:7:21:7:21 | call to appendLiteral(_:) | CallExpr | | expressions.swift:8:15:8:15 | nil | NilLiteralExpr | | expressions.swift:15:9:15:9 | x | DeclRefExpr | -| expressions.swift:15:9:15:14 | ... call to !=(_:_:) ... | BinaryExpr | +| expressions.swift:15:9:15:14 | ... .!=(_:_:) ... | BinaryExpr | | expressions.swift:15:11:15:11 | !=(_:_:) | DeclRefExpr | +| expressions.swift:15:11:15:11 | .!=(_:_:) | MethodRefExpr | | expressions.swift:15:11:15:11 | Int.Type | TypeExpr | -| expressions.swift:15:11:15:11 | call to !=(_:_:) | DotSyntaxCallExpr | | expressions.swift:15:14:15:14 | 0 | IntegerLiteralExpr | | expressions.swift:16:11:16:11 | AnError.Type | TypeExpr | | expressions.swift:16:11:16:19 | (Error) ... | ErasureExpr | -| expressions.swift:16:11:16:19 | call to ... | DotSyntaxCallExpr | +| expressions.swift:16:11:16:19 | .failed | MethodRefExpr | | expressions.swift:16:19:16:19 | failed | DeclRefExpr | | expressions.swift:20:1:20:16 | try! ... | ForceTryExpr | | expressions.swift:20:6:20:6 | failure(_:) | DeclRefExpr | @@ -88,37 +88,37 @@ | expressions.swift:41:1:43:1 | call to closured(closure:) | CallExpr | | expressions.swift:41:10:43:1 | { ... } | ClosureExpr | | expressions.swift:42:12:42:12 | x | DeclRefExpr | -| expressions.swift:42:12:42:16 | ... call to +(_:_:) ... | BinaryExpr | +| expressions.swift:42:12:42:16 | ... .+(_:_:) ... | BinaryExpr | | expressions.swift:42:14:42:14 | +(_:_:) | DeclRefExpr | +| expressions.swift:42:14:42:14 | .+(_:_:) | MethodRefExpr | | expressions.swift:42:14:42:14 | Int.Type | TypeExpr | -| expressions.swift:42:14:42:14 | call to +(_:_:) | DotSyntaxCallExpr | | expressions.swift:42:16:42:16 | y | DeclRefExpr | | expressions.swift:44:1:44:1 | closured(closure:) | DeclRefExpr | | expressions.swift:44:1:46:1 | call to closured(closure:) | CallExpr | | expressions.swift:44:10:46:1 | { ... } | ClosureExpr | | expressions.swift:45:12:45:12 | x | DeclRefExpr | -| expressions.swift:45:12:45:16 | ... call to +(_:_:) ... | BinaryExpr | +| expressions.swift:45:12:45:16 | ... .+(_:_:) ... | BinaryExpr | | expressions.swift:45:14:45:14 | +(_:_:) | DeclRefExpr | +| expressions.swift:45:14:45:14 | .+(_:_:) | MethodRefExpr | | expressions.swift:45:14:45:14 | Int.Type | TypeExpr | -| expressions.swift:45:14:45:14 | call to +(_:_:) | DotSyntaxCallExpr | | expressions.swift:45:16:45:16 | y | DeclRefExpr | | expressions.swift:47:1:47:1 | closured(closure:) | DeclRefExpr | | expressions.swift:47:1:47:27 | call to closured(closure:) | CallExpr | | expressions.swift:47:10:47:27 | { ... } | ClosureExpr | | expressions.swift:47:19:47:19 | $0 | DeclRefExpr | -| expressions.swift:47:19:47:24 | ... call to +(_:_:) ... | BinaryExpr | +| expressions.swift:47:19:47:24 | ... .+(_:_:) ... | BinaryExpr | | expressions.swift:47:22:47:22 | +(_:_:) | DeclRefExpr | +| expressions.swift:47:22:47:22 | .+(_:_:) | MethodRefExpr | | expressions.swift:47:22:47:22 | Int.Type | TypeExpr | -| expressions.swift:47:22:47:22 | call to +(_:_:) | DotSyntaxCallExpr | | expressions.swift:47:24:47:24 | $1 | DeclRefExpr | | expressions.swift:48:1:48:1 | closured(closure:) | DeclRefExpr | | expressions.swift:48:1:48:20 | call to closured(closure:) | CallExpr | | expressions.swift:48:10:48:20 | { ... } | ClosureExpr | | expressions.swift:48:12:48:12 | $0 | DeclRefExpr | -| expressions.swift:48:12:48:17 | ... call to +(_:_:) ... | BinaryExpr | +| expressions.swift:48:12:48:17 | ... .+(_:_:) ... | BinaryExpr | | expressions.swift:48:15:48:15 | +(_:_:) | DeclRefExpr | +| expressions.swift:48:15:48:15 | .+(_:_:) | MethodRefExpr | | expressions.swift:48:15:48:15 | Int.Type | TypeExpr | -| expressions.swift:48:15:48:15 | call to +(_:_:) | DotSyntaxCallExpr | | expressions.swift:48:17:48:17 | $1 | DeclRefExpr | | expressions.swift:54:1:54:1 | _ | DiscardAssignmentExpr | | expressions.swift:54:1:54:8 | ... = ... | AssignExpr | @@ -139,10 +139,10 @@ | expressions.swift:60:35:60:61 | call to unsafeFunction(pointer:) | CallExpr | | expressions.swift:60:59:60:59 | $0 | DeclRefExpr | | expressions.swift:64:8:64:8 | x | DeclRefExpr | -| expressions.swift:64:8:64:12 | ... call to <(_:_:) ... | BinaryExpr | +| expressions.swift:64:8:64:12 | ... .<(_:_:) ... | BinaryExpr | +| expressions.swift:64:10:64:10 | .<(_:_:) | MethodRefExpr | | expressions.swift:64:10:64:10 | <(_:_:) | DeclRefExpr | | expressions.swift:64:10:64:10 | Int.Type | TypeExpr | -| expressions.swift:64:10:64:10 | call to <(_:_:) | DotSyntaxCallExpr | | expressions.swift:64:12:64:12 | 0 | IntegerLiteralExpr | | expressions.swift:73:5:73:5 | .xx | MemberRefExpr | | expressions.swift:73:5:73:5 | self | DeclRefExpr | @@ -177,10 +177,10 @@ | expressions.swift:88:1:88:7 | ...! | ForceValueExpr | | expressions.swift:88:3:88:3 | a | StringLiteralExpr | | expressions.swift:92:14:92:14 | Unmanaged.Type | TypeExpr | -| expressions.swift:92:14:92:24 | call to passRetained(_:) | DotSyntaxCallExpr | -| expressions.swift:92:14:92:44 | call to ... | CallExpr | -| expressions.swift:92:14:92:46 | call to toOpaque() | DotSyntaxCallExpr | -| expressions.swift:92:14:92:55 | call to ... | CallExpr | +| expressions.swift:92:14:92:24 | .passRetained(_:) | MethodRefExpr | +| expressions.swift:92:14:92:44 | call to passRetained(_:) | CallExpr | +| expressions.swift:92:14:92:46 | .toOpaque() | MethodRefExpr | +| expressions.swift:92:14:92:55 | call to toOpaque() | CallExpr | | expressions.swift:92:24:92:24 | passRetained(_:) | DeclRefExpr | | expressions.swift:92:37:92:37 | ToPtr.Type | TypeExpr | | expressions.swift:92:37:92:37 | call to init | ConstructorRefCallExpr | @@ -188,8 +188,8 @@ | expressions.swift:92:37:92:43 | call to ... | CallExpr | | expressions.swift:92:46:92:46 | toOpaque() | DeclRefExpr | | expressions.swift:93:1:93:16 | Unmanaged.Type | TypeExpr | -| expressions.swift:93:1:93:18 | call to fromOpaque(_:) | DotSyntaxCallExpr | -| expressions.swift:93:1:93:35 | call to ... | CallExpr | +| expressions.swift:93:1:93:18 | .fromOpaque(_:) | MethodRefExpr | +| expressions.swift:93:1:93:35 | call to fromOpaque(_:) | CallExpr | | expressions.swift:93:18:93:18 | fromOpaque(_:) | DeclRefExpr | | expressions.swift:93:29:93:29 | (UnsafeRawPointer) ... | PointerToPointerExpr | | expressions.swift:93:29:93:29 | opaque | DeclRefExpr | diff --git a/swift/ql/test/extractor-tests/generated/expr/ConstructorRefCallExpr/ConstructorRefCallExpr.expected b/swift/ql/test/extractor-tests/generated/expr/ConstructorRefCallExpr/ConstructorRefCallExpr.expected index d0b4bba175b..8c15ce5ba22 100644 --- a/swift/ql/test/extractor-tests/generated/expr/ConstructorRefCallExpr/ConstructorRefCallExpr.expected +++ b/swift/ql/test/extractor-tests/generated/expr/ConstructorRefCallExpr/ConstructorRefCallExpr.expected @@ -1,3 +1,3 @@ -| constructor_ref_calls.swift:7:9:7:9 | call to init | getFunction: | constructor_ref_calls.swift:7:9:7:9 | init | getBaseExpr: | constructor_ref_calls.swift:7:9:7:9 | X.Type | -| constructor_ref_calls.swift:8:10:8:10 | call to init | getFunction: | constructor_ref_calls.swift:8:10:8:10 | init | getBaseExpr: | constructor_ref_calls.swift:8:10:8:10 | Y.Type | -| constructor_ref_calls.swift:9:10:9:10 | call to init | getFunction: | constructor_ref_calls.swift:9:10:9:10 | init | getBaseExpr: | constructor_ref_calls.swift:9:10:9:10 | Y.Type | +| constructor_ref_calls.swift:7:9:7:9 | call to init | getFunction: | constructor_ref_calls.swift:7:9:7:9 | init | getBase: | constructor_ref_calls.swift:7:9:7:9 | X.Type | +| constructor_ref_calls.swift:8:10:8:10 | call to init | getFunction: | constructor_ref_calls.swift:8:10:8:10 | init | getBase: | constructor_ref_calls.swift:8:10:8:10 | Y.Type | +| constructor_ref_calls.swift:9:10:9:10 | call to init | getFunction: | constructor_ref_calls.swift:9:10:9:10 | init | getBase: | constructor_ref_calls.swift:9:10:9:10 | Y.Type | diff --git a/swift/ql/test/extractor-tests/generated/expr/ConstructorRefCallExpr/ConstructorRefCallExpr.ql b/swift/ql/test/extractor-tests/generated/expr/ConstructorRefCallExpr/ConstructorRefCallExpr.ql index 5f9ff65669a..0b88c75f62f 100644 --- a/swift/ql/test/extractor-tests/generated/expr/ConstructorRefCallExpr/ConstructorRefCallExpr.ql +++ b/swift/ql/test/extractor-tests/generated/expr/ConstructorRefCallExpr/ConstructorRefCallExpr.ql @@ -2,10 +2,10 @@ import codeql.swift.elements import TestUtils -from ConstructorRefCallExpr x, Expr getFunction, Expr getBaseExpr +from ConstructorRefCallExpr x, Expr getFunction, Expr getBase where toBeTested(x) and not x.isUnknown() and getFunction = x.getFunction() and - getBaseExpr = x.getBaseExpr() -select x, "getFunction:", getFunction, "getBaseExpr:", getBaseExpr + getBase = x.getBase() +select x, "getFunction:", getFunction, "getBase:", getBase diff --git a/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr.expected b/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr.expected index 0295bc61989..d2996aae3dc 100644 --- a/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr.expected +++ b/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr.expected @@ -1,9 +1 @@ -| dot_syntax_call.swift:7:13:7:13 | call to ... | getFunction: | dot_syntax_call.swift:7:13:7:13 | { ... } | getBaseExpr: | dot_syntax_call.swift:7:13:7:13 | self | -| dot_syntax_call.swift:7:13:7:13 | call to baz(_:) | getFunction: | dot_syntax_call.swift:7:13:7:13 | baz(_:) | getBaseExpr: | file://:0:0:0:0 | self | -| dot_syntax_call.swift:11:1:11:3 | call to foo(_:_:) | getFunction: | dot_syntax_call.swift:11:3:11:3 | foo(_:_:) | getBaseExpr: | dot_syntax_call.swift:11:1:11:1 | X.Type | -| dot_syntax_call.swift:12:1:12:3 | call to bar() | getFunction: | dot_syntax_call.swift:12:3:12:3 | bar() | getBaseExpr: | dot_syntax_call.swift:12:1:12:1 | X.Type | -| dot_syntax_call.swift:13:1:13:5 | call to baz(_:) | getFunction: | dot_syntax_call.swift:13:5:13:5 | baz(_:) | getBaseExpr: | dot_syntax_call.swift:13:1:13:3 | call to ... | -| dot_syntax_call.swift:15:9:15:11 | call to ... | getFunction: | dot_syntax_call.swift:15:11:15:11 | { ... } | getBaseExpr: | dot_syntax_call.swift:15:9:15:9 | X.Type | -| dot_syntax_call.swift:15:11:15:11 | call to bar() | getFunction: | dot_syntax_call.swift:15:11:15:11 | bar() | getBaseExpr: | file://:0:0:0:0 | self | -| dot_syntax_call.swift:16:9:16:13 | call to ... | getFunction: | dot_syntax_call.swift:16:13:16:13 | { ... } | getBaseExpr: | dot_syntax_call.swift:16:9:16:11 | call to ... | -| dot_syntax_call.swift:16:13:16:13 | call to baz(_:) | getFunction: | dot_syntax_call.swift:16:13:16:13 | baz(_:) | getBaseExpr: | file://:0:0:0:0 | self | +| dot_syntax_call.swift:9:9:9:11 | call to ... | getFunction: | dot_syntax_call.swift:9:11:9:11 | { ... } | getBase: | dot_syntax_call.swift:9:9:9:9 | X.Type | diff --git a/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr.ql b/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr.ql index d4fce9de8bc..775b6f0f34f 100644 --- a/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr.ql +++ b/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr.ql @@ -2,10 +2,10 @@ import codeql.swift.elements import TestUtils -from DotSyntaxCallExpr x, Expr getFunction, Expr getBaseExpr +from DotSyntaxCallExpr x, Expr getFunction, Expr getBase where toBeTested(x) and not x.isUnknown() and getFunction = x.getFunction() and - getBaseExpr = x.getBaseExpr() -select x, "getFunction:", getFunction, "getBaseExpr:", getBaseExpr + getBase = x.getBase() +select x, "getFunction:", getFunction, "getBase:", getBase diff --git a/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr_getArgument.expected b/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr_getArgument.expected index 62c890446a3..ba594961b2b 100644 --- a/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr_getArgument.expected +++ b/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr_getArgument.expected @@ -1,9 +1 @@ -| dot_syntax_call.swift:7:13:7:13 | call to ... | 0 | dot_syntax_call.swift:7:13:7:13 | : self | -| dot_syntax_call.swift:7:13:7:13 | call to baz(_:) | 0 | file://:0:0:0:0 | : self | -| dot_syntax_call.swift:11:1:11:3 | call to foo(_:_:) | 0 | dot_syntax_call.swift:11:1:11:1 | : X.Type | -| dot_syntax_call.swift:12:1:12:3 | call to bar() | 0 | dot_syntax_call.swift:12:1:12:1 | : X.Type | -| dot_syntax_call.swift:13:1:13:5 | call to baz(_:) | 0 | dot_syntax_call.swift:13:1:13:3 | : call to ... | -| dot_syntax_call.swift:15:9:15:11 | call to ... | 0 | dot_syntax_call.swift:15:9:15:9 | : X.Type | -| dot_syntax_call.swift:15:11:15:11 | call to bar() | 0 | file://:0:0:0:0 | : self | -| dot_syntax_call.swift:16:9:16:13 | call to ... | 0 | dot_syntax_call.swift:16:9:16:11 | : call to ... | -| dot_syntax_call.swift:16:13:16:13 | call to baz(_:) | 0 | file://:0:0:0:0 | : self | +| dot_syntax_call.swift:9:9:9:11 | call to ... | 0 | dot_syntax_call.swift:9:9:9:9 | : X.Type | diff --git a/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr_getType.expected b/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr_getType.expected index 1aa59ceee6f..b818fe3a8a1 100644 --- a/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr_getType.expected +++ b/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr_getType.expected @@ -1,9 +1 @@ -| dot_syntax_call.swift:7:13:7:13 | call to ... | (Int) -> () | -| dot_syntax_call.swift:7:13:7:13 | call to baz(_:) | (Int) -> () | -| dot_syntax_call.swift:11:1:11:3 | call to foo(_:_:) | (Int, Int) -> () | -| dot_syntax_call.swift:12:1:12:3 | call to bar() | () -> () | -| dot_syntax_call.swift:13:1:13:5 | call to baz(_:) | (Int) -> () | -| dot_syntax_call.swift:15:9:15:11 | call to ... | () -> () | -| dot_syntax_call.swift:15:11:15:11 | call to bar() | () -> () | -| dot_syntax_call.swift:16:9:16:13 | call to ... | (Int) -> () | -| dot_syntax_call.swift:16:13:16:13 | call to baz(_:) | (Int) -> () | +| dot_syntax_call.swift:9:9:9:11 | call to ... | () -> () | diff --git a/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/dot_syntax_call.swift b/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/dot_syntax_call.swift index 18e978f3dca..825a1079fd6 100644 --- a/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/dot_syntax_call.swift +++ b/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/dot_syntax_call.swift @@ -1,16 +1,9 @@ class X { static func foo(_: Int, _:Int) {} class func bar() {} - func baz(_: Int) {} - - init() { - let f = baz - } } X.foo(1, 2) X.bar() -X().baz(42) let f = X.bar -let g = X().baz diff --git a/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr.expected b/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr.expected new file mode 100644 index 00000000000..5569b8a47de --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr.expected @@ -0,0 +1,4 @@ +| method_refs.swift:5:13:5:13 | .bar(_:) | getBase: | file://:0:0:0:0 | self | +| method_refs.swift:6:5:6:5 | .bar(_:) | getBase: | method_refs.swift:6:5:6:5 | self | +| method_refs.swift:11:1:11:3 | .bar(_:) | getBase: | method_refs.swift:11:1:11:1 | x | +| method_refs.swift:13:11:13:11 | .bar(_:) | getBase: | file://:0:0:0:0 | self | diff --git a/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr.ql b/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr.ql new file mode 100644 index 00000000000..b8f9243c3b7 --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr.ql @@ -0,0 +1,10 @@ +// generated by codegen/codegen.py +import codeql.swift.elements +import TestUtils + +from MethodRefExpr x, Expr getBase +where + toBeTested(x) and + not x.isUnknown() and + getBase = x.getBase() +select x, "getBase:", getBase diff --git a/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getMember.expected b/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getMember.expected new file mode 100644 index 00000000000..dd3f2c4eb42 --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getMember.expected @@ -0,0 +1,4 @@ +| method_refs.swift:5:13:5:13 | .bar(_:) | method_refs.swift:2:3:2:21 | bar(_:) | +| method_refs.swift:6:5:6:5 | .bar(_:) | method_refs.swift:2:3:2:21 | bar(_:) | +| method_refs.swift:11:1:11:3 | .bar(_:) | method_refs.swift:2:3:2:21 | bar(_:) | +| method_refs.swift:13:11:13:11 | .bar(_:) | method_refs.swift:2:3:2:21 | bar(_:) | diff --git a/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getMember.ql b/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getMember.ql new file mode 100644 index 00000000000..4d30d95381d --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getMember.ql @@ -0,0 +1,7 @@ +// generated by codegen/codegen.py +import codeql.swift.elements +import TestUtils + +from MethodRefExpr x +where toBeTested(x) and not x.isUnknown() +select x, x.getMember() diff --git a/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getType.expected b/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getType.expected new file mode 100644 index 00000000000..b9f7f52d9f7 --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getType.expected @@ -0,0 +1,4 @@ +| method_refs.swift:5:13:5:13 | .bar(_:) | (Int) -> () | +| method_refs.swift:6:5:6:5 | .bar(_:) | (Int) -> () | +| method_refs.swift:11:1:11:3 | .bar(_:) | (Int) -> () | +| method_refs.swift:13:11:13:11 | .bar(_:) | (Int) -> () | diff --git a/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getType.ql b/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getType.ql new file mode 100644 index 00000000000..becb5f2e4a2 --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getType.ql @@ -0,0 +1,7 @@ +// generated by codegen/codegen.py +import codeql.swift.elements +import TestUtils + +from MethodRefExpr x +where toBeTested(x) and not x.isUnknown() +select x, x.getType() diff --git a/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/method_refs.swift b/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/method_refs.swift new file mode 100644 index 00000000000..84fda171efe --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/method_refs.swift @@ -0,0 +1,13 @@ +class X { + func bar(_: Int) {} + + init() { + let f = bar + bar(0) + } +} + +let x = X() +x.bar(42) + +let f = x.bar diff --git a/swift/ql/test/extractor-tests/statements/ConditionElements.expected b/swift/ql/test/extractor-tests/statements/ConditionElements.expected index 301cc5ec682..e7f18b329d8 100644 --- a/swift/ql/test/extractor-tests/statements/ConditionElements.expected +++ b/swift/ql/test/extractor-tests/statements/ConditionElements.expected @@ -1,6 +1,6 @@ -| statements.swift:3:8:3:13 | ... call to ==(_:_:) ... | statements.swift:3:8:3:13 | ... call to ==(_:_:) ... | -| statements.swift:10:17:10:24 | ... call to <(_:_:) ... | statements.swift:10:18:10:22 | ... call to <(_:_:) ... | -| statements.swift:39:9:39:14 | ... call to !=(_:_:) ... | statements.swift:39:9:39:14 | ... call to !=(_:_:) ... | +| statements.swift:3:8:3:13 | ... .==(_:_:) ... | statements.swift:3:8:3:13 | ... .==(_:_:) ... | +| statements.swift:10:17:10:24 | ... .<(_:_:) ... | statements.swift:10:18:10:22 | ... .<(_:_:) ... | +| statements.swift:39:9:39:14 | ... .!=(_:_:) ... | statements.swift:39:9:39:14 | ... .!=(_:_:) ... | | statements.swift:65:4:65:19 | let ... = ... | statements.swift:65:9:65:15 | let ... | | statements.swift:65:4:65:19 | let ... = ... | statements.swift:65:19:65:19 | x | | statements.swift:67:4:67:20 | .some(...) = ... | statements.swift:67:9:67:16 | .some(...) | diff --git a/swift/ql/test/extractor-tests/types/Types.expected b/swift/ql/test/extractor-tests/types/Types.expected index d68e3f2ea5a..5fabd2589a5 100644 --- a/swift/ql/test/extractor-tests/types/Types.expected +++ b/swift/ql/test/extractor-tests/types/Types.expected @@ -5,12 +5,12 @@ | types.swift:3:6:3:6 | default terminator | String | | types.swift:3:7:3:7 | x | Int | | types.swift:3:7:3:11 | (Any) ... | Any | -| types.swift:3:7:3:11 | ... call to +(_:_:) ... | Int | +| types.swift:3:7:3:11 | ... .+(_:_:) ... | Int | | types.swift:3:7:3:11 | [...] | Any... | | types.swift:3:7:3:11 | [...] | Any... | | types.swift:3:9:3:9 | +(_:_:) | (Int.Type) -> (Int, Int) -> Int | +| types.swift:3:9:3:9 | .+(_:_:) | (Int, Int) -> Int | | types.swift:3:9:3:9 | Int.Type | Int.Type | -| types.swift:3:9:3:9 | call to +(_:_:) | (Int, Int) -> Int | | types.swift:3:11:3:11 | 10 | Int | | types.swift:7:16:7:16 | X.Type | X.Type | | types.swift:7:16:7:16 | call to init | () -> X | @@ -25,10 +25,10 @@ | types.swift:14:22:14:31 | call to ... | C.Nested | | types.swift:14:24:14:24 | init | (C.Nested.Type) -> () -> C.Nested | | types.swift:17:10:17:10 | x | Int | -| types.swift:17:10:17:14 | ... call to +(_:_:) ... | Int | +| types.swift:17:10:17:14 | ... .+(_:_:) ... | Int | | types.swift:17:12:17:12 | +(_:_:) | (Int.Type) -> (Int, Int) -> Int | +| types.swift:17:12:17:12 | .+(_:_:) | (Int, Int) -> Int | | types.swift:17:12:17:12 | Int.Type | Int.Type | -| types.swift:17:12:17:12 | call to +(_:_:) | (Int, Int) -> Int | | types.swift:17:14:17:14 | y | Int | | types.swift:21:10:21:10 | f | (Int) -> Int | | types.swift:21:10:21:13 | call to ... | Int | diff --git a/swift/ql/test/library-tests/controlflow/graph/Cfg.expected b/swift/ql/test/library-tests/controlflow/graph/Cfg.expected index d213a61081a..bbb5ff15fcb 100644 --- a/swift/ql/test/library-tests/controlflow/graph/Cfg.expected +++ b/swift/ql/test/library-tests/controlflow/graph/Cfg.expected @@ -28,7 +28,7 @@ cfg.swift: #-----| -> x # 15| x -#-----| -> ==(_:_:) +#-----| -> .==(_:_:) # 15| return ... #-----| return -> exit isZero(x:) (normal) @@ -36,20 +36,17 @@ cfg.swift: # 15| x #-----| -> 0 -# 15| ... call to ==(_:_:) ... +# 15| ... .==(_:_:) ... #-----| -> return ... -# 15| ==(_:_:) +# 15| .==(_:_:) #-----| -> Int.Type # 15| Int.Type -#-----| -> call to ==(_:_:) - -# 15| call to ==(_:_:) #-----| -> x # 15| 0 -#-----| -> ... call to ==(_:_:) ... +#-----| -> ... .==(_:_:) ... # 17| enter mightThrow(x:) #-----| -> mightThrow(x:) @@ -71,38 +68,32 @@ cfg.swift: # 18| x #-----| -> 0 -# 18| ... call to >=(_:_:) ... -#-----| false -> error1 +# 18| ... .>=(_:_:) ... +#-----| false -> .error1 #-----| true -> guard ... else { ... } # 18| StmtCondition -#-----| -> >=(_:_:) +#-----| -> .>=(_:_:) -# 18| >=(_:_:) +# 18| .>=(_:_:) #-----| -> Int.Type # 18| Int.Type -#-----| -> call to >=(_:_:) - -# 18| call to >=(_:_:) #-----| -> x # 18| 0 -#-----| -> ... call to >=(_:_:) ... +#-----| -> ... .>=(_:_:) ... # 19| throw ... #-----| exception -> exit mightThrow(x:) (normal) # 19| MyError.Type -#-----| -> call to ... +#-----| -> (Error) ... # 19| (Error) ... #-----| -> throw ... -# 19| call to ... -#-----| -> (Error) ... - -# 19| error1 +# 19| .error1 #-----| -> MyError.Type # 21| guard ... else { ... } @@ -111,33 +102,30 @@ cfg.swift: # 21| x #-----| -> 0 -# 21| ... call to <=(_:_:) ... +# 21| ... .<=(_:_:) ... #-----| true -> exit mightThrow(x:) (normal) -#-----| false -> error3 +#-----| false -> .error3 # 21| StmtCondition -#-----| -> <=(_:_:) +#-----| -> .<=(_:_:) -# 21| <=(_:_:) +# 21| .<=(_:_:) #-----| -> Int.Type # 21| Int.Type -#-----| -> call to <=(_:_:) - -# 21| call to <=(_:_:) #-----| -> x # 21| 0 -#-----| -> ... call to <=(_:_:) ... +#-----| -> ... .<=(_:_:) ... # 22| throw ... #-----| exception -> exit mightThrow(x:) (normal) # 22| MyError.Type -#-----| -> call to ... +#-----| -> .+(_:_:) -# 22| call to ... -#-----| -> +(_:_:) +# 22| .error3 +#-----| -> MyError.Type # 22| (Error) ... #-----| -> throw ... @@ -145,26 +133,20 @@ cfg.swift: # 22| call to ... #-----| -> (Error) ... -# 22| error3 -#-----| -> MyError.Type - # 22| x #-----| -> 1 -# 22| ... call to +(_:_:) ... +# 22| ... .+(_:_:) ... #-----| -> call to ... -# 22| +(_:_:) +# 22| .+(_:_:) #-----| -> Int.Type # 22| Int.Type -#-----| -> call to +(_:_:) - -# 22| call to +(_:_:) #-----| -> x # 22| 1 -#-----| -> ... call to +(_:_:) ... +#-----| -> ... .+(_:_:) ... # 26| enter tryCatch(x:) #-----| -> tryCatch(x:) @@ -379,12 +361,13 @@ cfg.swift: #-----| -> [...] # 40| OpaqueValueExpr +#-----| -> .appendLiteral(_:) # 40| TapExpr #-----| -> "..." # 40| Unknown error -#-----| -> call to ... +#-----| -> call to appendLiteral(_:) # 40| [...] #-----| -> [...] @@ -392,49 +375,47 @@ cfg.swift: # 40| [...] #-----| -> default separator -# 40| call to ... -#-----| -> appendInterpolation(_:) +# 40| call to appendLiteral(_:) +#-----| -> .appendInterpolation(_:) # 40| $interpolation #-----| -> &... # 40| &... -#-----| -> call to appendLiteral(_:) - -# 40| call to appendLiteral(_:) #-----| -> Unknown error +# 40| .appendLiteral(_:) +#-----| -> $interpolation + # 40| $interpolation #-----| -> &... # 40| &... -#-----| -> call to appendInterpolation(_:) +#-----| -> error -# 40| appendInterpolation(_:) +# 40| .appendInterpolation(_:) #-----| -> $interpolation # 40| call to appendInterpolation(_:) -#-----| -> error - -# 40| call to ... +#-----| -> .appendLiteral(_:) # 40| error -#-----| -> call to ... +#-----| -> call to appendInterpolation(_:) # 40| -#-----| -> call to ... +#-----| -> call to appendLiteral(_:) # 40| $interpolation #-----| -> &... # 40| &... -#-----| -> call to appendLiteral(_:) +#-----| -> -# 40| call to ... -#-----| -> TapExpr +# 40| .appendLiteral(_:) +#-----| -> $interpolation # 40| call to appendLiteral(_:) -#-----| -> +#-----| -> TapExpr # 42| return ... #-----| return -> exit tryCatch(x:) (normal) @@ -468,7 +449,7 @@ cfg.swift: #-----| -> exit { ... } # 46| { ... } -#-----| -> +(_:_:) +#-----| -> .+(_:_:) # 46| { ... } #-----| -> return ... @@ -479,20 +460,17 @@ cfg.swift: # 47| s #-----| -> -# 47| ... call to +(_:_:) ... +# 47| ... .+(_:_:) ... #-----| -> return ... -# 47| +(_:_:) +# 47| .+(_:_:) #-----| -> String.Type # 47| String.Type -#-----| -> call to +(_:_:) - -# 47| call to +(_:_:) #-----| -> s # 47| -#-----| -> ... call to +(_:_:) ... +#-----| -> ... .+(_:_:) ... # 51| createClosure2(x:) #-----| -> x @@ -523,7 +501,7 @@ cfg.swift: #-----| -> f(y:) # 52| y -#-----| -> +(_:_:) +#-----| -> .+(_:_:) # 53| return ... #-----| return -> exit f(y:) (normal) @@ -531,20 +509,17 @@ cfg.swift: # 53| x #-----| -> y -# 53| ... call to +(_:_:) ... +# 53| ... .+(_:_:) ... #-----| -> return ... -# 53| +(_:_:) +# 53| .+(_:_:) #-----| -> Int.Type # 53| Int.Type -#-----| -> call to +(_:_:) - -# 53| call to +(_:_:) #-----| -> x # 53| y -#-----| -> ... call to +(_:_:) ... +#-----| -> ... .+(_:_:) ... # 55| return ... #-----| return -> exit createClosure2(x:) (normal) @@ -584,28 +559,25 @@ cfg.swift: #-----| -> return ... # 60| y -#-----| -> +(_:_:) +#-----| -> .+(_:_:) # 60| x #-----| -> y -# 60| ... call to +(_:_:) ... +# 60| ... .+(_:_:) ... #-----| -> return ... # 60| return ... #-----| return -> exit { ... } (normal) -# 60| +(_:_:) +# 60| .+(_:_:) #-----| -> Int.Type # 60| Int.Type -#-----| -> call to +(_:_:) - -# 60| call to +(_:_:) #-----| -> x # 60| y -#-----| -> ... call to +(_:_:) ... +#-----| -> ... .+(_:_:) ... # 64| callClosures() #-----| -> x1 @@ -722,11 +694,11 @@ cfg.swift: # 71| init #-----| -> Int.Type -# 71| call to ... +# 71| call to init #-----| -> var ... = ... # 71| s -#-----| -> call to ... +#-----| -> call to init # 72| return ... #-----| return -> exit maybeParseInt(s:) (normal) @@ -773,7 +745,7 @@ cfg.swift: #-----| -> n # 77| n -#-----| -> +(_:_:) +#-----| -> .+(_:_:) # 77| n #-----| match -> maybeParseInt(s:) @@ -799,16 +771,13 @@ cfg.swift: # 78| (Int?) ... #-----| -> return ... -# 78| ... call to +(_:_:) ... +# 78| ... .+(_:_:) ... #-----| -> (Int?) ... -# 78| +(_:_:) +# 78| .+(_:_:) #-----| -> Int.Type # 78| Int.Type -#-----| -> call to +(_:_:) - -# 78| call to +(_:_:) #-----| -> nBang # 78| (Int?) ... @@ -818,7 +787,7 @@ cfg.swift: #-----| -> (Int?) ... # 78| ...! -#-----| -> ... call to +(_:_:) ... +#-----| -> ... .+(_:_:) ... # 81| enter testInOut() #-----| -> testInOut() @@ -861,7 +830,7 @@ cfg.swift: #-----| -> a # 85| a -#-----| -> +(_:_:) +#-----| -> .+(_:_:) # 85| ... = ... #-----| -> exit add(a:) (normal) @@ -872,20 +841,17 @@ cfg.swift: # 85| a #-----| -> (Int) ... -# 85| ... call to +(_:_:) ... +# 85| ... .+(_:_:) ... #-----| -> ... = ... -# 85| +(_:_:) +# 85| .+(_:_:) #-----| -> Int.Type # 85| Int.Type -#-----| -> call to +(_:_:) - -# 85| call to +(_:_:) #-----| -> a # 85| 1 -#-----| -> ... call to +(_:_:) ... +#-----| -> ... .+(_:_:) ... # 88| addOptional(a:) #-----| -> a @@ -947,7 +913,7 @@ cfg.swift: #-----| -> tempOptional # 94| call to addOptional(a:) -#-----| -> +(_:_:) +#-----| -> .+(_:_:) # 94| &... #-----| -> call to addOptional(a:) @@ -964,16 +930,13 @@ cfg.swift: # 95| temp #-----| -> (Int) ... -# 95| ... call to +(_:_:) ... +# 95| ... .+(_:_:) ... #-----| -> return ... -# 95| +(_:_:) +# 95| .+(_:_:) #-----| -> Int.Type # 95| Int.Type -#-----| -> call to +(_:_:) - -# 95| call to +(_:_:) #-----| -> temp # 95| (Int?) ... @@ -983,7 +946,7 @@ cfg.swift: #-----| -> (Int?) ... # 95| ...! -#-----| -> ... call to +(_:_:) ... +#-----| -> ... .+(_:_:) ... # 98| deinit #-----| -> { ... } @@ -1096,11 +1059,11 @@ cfg.swift: # 110| init #-----| -> C.Type -# 110| call to ... +# 110| call to init #-----| -> var ... = ... # 110| 42 -#-----| -> call to ... +#-----| -> call to init # 111| var ... = ... #-----| -> n1 @@ -1142,20 +1105,17 @@ cfg.swift: #-----| -> n4 # 113| n3 -#-----| match -> getMyInt() +#-----| match -> .getMyInt() # 113| c #-----| -> call to getMyInt() -# 113| call to getMyInt() -#-----| -> call to ... - -# 113| call to ... -#-----| -> var ... = ... - -# 113| getMyInt() +# 113| .getMyInt() #-----| -> c +# 113| call to getMyInt() +#-----| -> var ... = ... + # 114| var ... = ... #-----| -> n4 @@ -1163,7 +1123,7 @@ cfg.swift: #-----| -> n5 # 114| n4 -#-----| match -> getMyInt() +#-----| match -> .getMyInt() # 114| c #-----| -> .self @@ -1171,15 +1131,12 @@ cfg.swift: # 114| .self #-----| -> call to getMyInt() -# 114| call to getMyInt() -#-----| -> call to ... - -# 114| call to ... -#-----| -> var ... = ... - -# 114| getMyInt() +# 114| .getMyInt() #-----| -> c +# 114| call to getMyInt() +#-----| -> var ... = ... + # 116| var ... = ... #-----| -> n5 @@ -1220,20 +1177,17 @@ cfg.swift: #-----| -> n8 # 118| n7 -#-----| match -> getMyInt() +#-----| match -> .getMyInt() # 118| param #-----| -> call to getMyInt() -# 118| call to getMyInt() -#-----| -> call to ... - -# 118| call to ... -#-----| -> var ... = ... - -# 118| getMyInt() +# 118| .getMyInt() #-----| -> param +# 118| call to getMyInt() +#-----| -> var ... = ... + # 119| var ... = ... #-----| -> n8 @@ -1241,7 +1195,7 @@ cfg.swift: #-----| -> n9 # 119| n8 -#-----| match -> getMyInt() +#-----| match -> .getMyInt() # 119| param #-----| -> .self @@ -1249,15 +1203,12 @@ cfg.swift: # 119| .self #-----| -> call to getMyInt() -# 119| call to getMyInt() -#-----| -> call to ... - -# 119| call to ... -#-----| -> var ... = ... - -# 119| getMyInt() +# 119| .getMyInt() #-----| -> param +# 119| call to getMyInt() +#-----| -> var ... = ... + # 121| var ... = ... #-----| -> n9 @@ -1304,7 +1255,7 @@ cfg.swift: #-----| -> n12 # 123| n11 -#-----| match -> getMyInt() +#-----| match -> .getMyInt() # 123| (C) ... #-----| -> call to getMyInt() @@ -1312,15 +1263,12 @@ cfg.swift: # 123| inoutParam #-----| -> (C) ... -# 123| call to getMyInt() -#-----| -> call to ... - -# 123| call to ... -#-----| -> var ... = ... - -# 123| getMyInt() +# 123| .getMyInt() #-----| -> inoutParam +# 123| call to getMyInt() +#-----| -> var ... = ... + # 124| var ... = ... #-----| -> n12 @@ -1328,7 +1276,7 @@ cfg.swift: #-----| -> n13 # 124| n12 -#-----| match -> getMyInt() +#-----| match -> .getMyInt() # 124| inoutParam #-----| -> .self @@ -1339,15 +1287,12 @@ cfg.swift: # 124| .self #-----| -> (C) ... -# 124| call to getMyInt() -#-----| -> call to ... - -# 124| call to ... -#-----| -> var ... = ... - -# 124| getMyInt() +# 124| .getMyInt() #-----| -> inoutParam +# 124| call to getMyInt() +#-----| -> var ... = ... + # 126| var ... = ... #-----| -> n13 @@ -1394,7 +1339,7 @@ cfg.swift: #-----| -> n16 # 128| n15 -#-----| match -> getMyInt() +#-----| match -> .getMyInt() # 128| opt #-----| -> ...! @@ -1402,15 +1347,12 @@ cfg.swift: # 128| ...! #-----| -> call to getMyInt() -# 128| call to getMyInt() -#-----| -> call to ... - -# 128| call to ... -#-----| -> var ... = ... - -# 128| getMyInt() +# 128| .getMyInt() #-----| -> opt +# 128| call to getMyInt() +#-----| -> var ... = ... + # 129| var ... = ... #-----| -> n16 @@ -1418,7 +1360,7 @@ cfg.swift: #-----| -> n17 # 129| n16 -#-----| match -> getMyInt() +#-----| match -> .getMyInt() # 129| opt #-----| -> ...! @@ -1429,15 +1371,12 @@ cfg.swift: # 129| .self #-----| -> call to getMyInt() -# 129| call to getMyInt() -#-----| -> call to ... - -# 129| call to ... -#-----| -> var ... = ... - -# 129| getMyInt() +# 129| .getMyInt() #-----| -> opt +# 129| call to getMyInt() +#-----| -> var ... = ... + # 131| var ... = ... #-----| -> n17 @@ -1496,7 +1435,7 @@ cfg.swift: #-----| -> n20 # 133| n19 -#-----| match -> getMyInt() +#-----| match -> .getMyInt() # 133| opt #-----| -> ...? @@ -1504,8 +1443,8 @@ cfg.swift: # 133| ...? #-----| -> call to getMyInt() -# 133| call to getMyInt() -#-----| -> call to ... +# 133| .getMyInt() +#-----| -> opt # 133| (Int?) ... #-----| -> OptionalEvaluationExpr @@ -1513,12 +1452,9 @@ cfg.swift: # 133| OptionalEvaluationExpr #-----| -> var ... = ... -# 133| call to ... +# 133| call to getMyInt() #-----| -> (Int?) ... -# 133| getMyInt() -#-----| -> opt - # 134| var ... = ... #-----| -> n20 @@ -1526,7 +1462,7 @@ cfg.swift: #-----| -> exit testMemberRef(param:inoutParam:opt:) (normal) # 134| n20 -#-----| match -> getMyInt() +#-----| match -> .getMyInt() # 134| opt #-----| -> ...? @@ -1537,8 +1473,8 @@ cfg.swift: # 134| .self #-----| -> call to getMyInt() -# 134| call to getMyInt() -#-----| -> call to ... +# 134| .getMyInt() +#-----| -> opt # 134| (Int?) ... #-----| -> OptionalEvaluationExpr @@ -1546,12 +1482,9 @@ cfg.swift: # 134| OptionalEvaluationExpr #-----| -> var ... = ... -# 134| call to ... +# 134| call to getMyInt() #-----| -> (Int?) ... -# 134| getMyInt() -#-----| -> opt - # 137| enter patterns(x:) #-----| -> patterns(x:) @@ -1564,7 +1497,7 @@ cfg.swift: #-----| -> x # 137| x -#-----| -> ...(_:_:) +#-----| -> ....(_:_:) # 138| for ... in ... { ... } #-----| non-empty -> _ @@ -1576,20 +1509,17 @@ cfg.swift: # 138| 0 #-----| -> 10 -# 138| ... call to ...(_:_:) ... +# 138| ... ....(_:_:) ... #-----| -> for ... in ... { ... } -# 138| ...(_:_:) +# 138| ....(_:_:) #-----| -> Int.Type # 138| Int.Type -#-----| -> call to ...(_:_:) - -# 138| call to ...(_:_:) #-----| -> 0 # 138| 10 -#-----| -> ... call to ...(_:_:) ... +#-----| -> ... ....(_:_:) ... # 138| { ... } #-----| -> for ... in ... { ... } @@ -1805,24 +1735,21 @@ cfg.swift: # 182| x #-----| -> 2 -# 182| ... call to >(_:_:) ... +# 182| ... .>(_:_:) ... #-----| true -> print(_:separator:terminator:) #-----| false -> if ... then { ... } else { ... } # 182| StmtCondition -#-----| -> >(_:_:) +#-----| -> .>(_:_:) -# 182| >(_:_:) +# 182| .>(_:_:) #-----| -> Int.Type # 182| Int.Type -#-----| -> call to >(_:_:) - -# 182| call to >(_:_:) #-----| -> x # 182| 2 -#-----| -> ... call to >(_:_:) ... +#-----| -> ... .>(_:_:) ... # 183| print(_:separator:terminator:) #-----| -> x is greater than 2 @@ -1854,96 +1781,87 @@ cfg.swift: # 185| x #-----| -> 2 -# 185| ... call to <=(_:_:) ... -#-----| false -> [false] ... call to &&(_:_:) ... +# 185| ... .<=(_:_:) ... +#-----| false -> [false] ... .&&(_:_:) ... #-----| true -> { ... } -# 185| ... call to &&(_:_:) ... +# 185| ... .&&(_:_:) ... #-----| exception -> exit m1(x:) (normal) -#-----| false -> [false] ... call to &&(_:_:) ... +#-----| false -> [false] ... .&&(_:_:) ... #-----| true -> { ... } -# 185| [false] ... call to &&(_:_:) ... +# 185| [false] ... .&&(_:_:) ... #-----| exception -> exit m1(x:) (normal) -#-----| false -> [false] ... call to &&(_:_:) ... +#-----| false -> [false] ... .&&(_:_:) ... -# 185| ... call to &&(_:_:) ... +# 185| ... .&&(_:_:) ... #-----| exception -> exit m1(x:) (normal) #-----| true -> print(_:separator:terminator:) #-----| false -> print(_:separator:terminator:) # 185| StmtCondition -#-----| -> <=(_:_:) +#-----| -> .<=(_:_:) -# 185| [false] ... call to &&(_:_:) ... +# 185| [false] ... .&&(_:_:) ... #-----| exception -> exit m1(x:) (normal) #-----| false -> print(_:separator:terminator:) -# 185| <=(_:_:) +# 185| .<=(_:_:) #-----| -> Int.Type # 185| Int.Type -#-----| -> call to <=(_:_:) - -# 185| call to <=(_:_:) #-----| -> x # 185| 2 -#-----| -> ... call to <=(_:_:) ... +#-----| -> ... .<=(_:_:) ... # 185| x #-----| -> 0 -# 185| ... call to >(_:_:) ... +# 185| ... .>(_:_:) ... #-----| -> return ... # 185| return ... -#-----| -> ... call to &&(_:_:) ... +#-----| -> ... .&&(_:_:) ... # 185| { ... } -#-----| -> >(_:_:) +#-----| -> .>(_:_:) -# 185| >(_:_:) +# 185| .>(_:_:) #-----| -> Int.Type # 185| Int.Type -#-----| -> call to >(_:_:) - -# 185| call to >(_:_:) #-----| -> x # 185| 0 -#-----| -> ... call to >(_:_:) ... +#-----| -> ... .>(_:_:) ... -# 185| call to ... +# 185| call to !(_:) #-----| -> return ... # 185| return ... -#-----| -> ... call to &&(_:_:) ... +#-----| -> ... .&&(_:_:) ... # 185| { ... } -#-----| -> ==(_:_:) +#-----| -> .==(_:_:) # 185| (...) -#-----| -> call to ... +#-----| -> call to !(_:) # 185| x #-----| -> 5 -# 185| ... call to ==(_:_:) ... +# 185| ... .==(_:_:) ... #-----| -> (...) -# 185| ==(_:_:) +# 185| .==(_:_:) #-----| -> Int.Type # 185| Int.Type -#-----| -> call to ==(_:_:) - -# 185| call to ==(_:_:) #-----| -> x # 185| 5 -#-----| -> ... call to ==(_:_:) ... +#-----| -> ... .==(_:_:) ... # 186| print(_:separator:terminator:) #-----| -> x is 1 @@ -2052,45 +1970,39 @@ cfg.swift: # 201| x #-----| -> (Int) ... -# 201| ... call to <(_:_:) ... +# 201| ... .<(_:_:) ... #-----| true -> x #-----| false -> x # 201| StmtCondition -#-----| -> <(_:_:) +#-----| -> .<(_:_:) -# 201| <(_:_:) +# 201| .<(_:_:) #-----| -> Int.Type # 201| Int.Type -#-----| -> call to <(_:_:) - -# 201| call to <(_:_:) #-----| -> x # 201| 0 -#-----| -> ... call to <(_:_:) ... +#-----| -> ... .<(_:_:) ... # 202| x -#-----| -> -(_:) +#-----| -> .-(_:) # 202| ... = ... #-----| -> if ... then { ... } -# 202| -(_:) +# 202| .-(_:) #-----| -> Int.Type # 202| Int.Type -#-----| -> call to -(_:) - -# 202| call to -(_:) #-----| -> x -# 202| call to ... +# 202| call to -(_:) #-----| -> ... = ... # 202| (Int) ... -#-----| -> call to ... +#-----| -> call to -(_:) # 202| x #-----| -> (Int) ... @@ -2104,27 +2016,24 @@ cfg.swift: # 203| x #-----| -> (Int) ... -# 203| ... call to >(_:_:) ... +# 203| ... .>(_:_:) ... #-----| true -> x #-----| false -> x # 203| StmtCondition -#-----| -> >(_:_:) +#-----| -> .>(_:_:) -# 203| >(_:_:) +# 203| .>(_:_:) #-----| -> Int.Type # 203| Int.Type -#-----| -> call to >(_:_:) - -# 203| call to >(_:_:) #-----| -> x # 203| 10 -#-----| -> ... call to >(_:_:) ... +#-----| -> ... .>(_:_:) ... # 204| x -#-----| -> -(_:_:) +#-----| -> .-(_:_:) # 204| ... = ... #-----| -> x @@ -2135,20 +2044,17 @@ cfg.swift: # 204| x #-----| -> (Int) ... -# 204| ... call to -(_:_:) ... +# 204| ... .-(_:_:) ... #-----| -> ... = ... -# 204| -(_:_:) +# 204| .-(_:_:) #-----| -> Int.Type # 204| Int.Type -#-----| -> call to -(_:_:) - -# 204| call to -(_:_:) #-----| -> x # 204| 1 -#-----| -> ... call to -(_:_:) ... +#-----| -> ... .-(_:_:) ... # 207| return ... #-----| return -> exit m3(x:) (normal) @@ -2286,11 +2192,11 @@ cfg.swift: # 224| StmtCondition #-----| -> true -# 224| [false] call to ... +# 224| [false] call to !(_:) #-----| false -> exit constant_condition() (normal) # 224| true -#-----| true -> [false] call to ... +#-----| true -> [false] call to !(_:) # 229| empty_else(b:) #-----| -> b @@ -2397,15 +2303,15 @@ cfg.swift: #-----| true -> print(_:separator:terminator:) # 238| b1 -#-----| true -> [true] ... call to ||(_:_:) ... +#-----| true -> [true] ... .||(_:_:) ... #-----| false -> { ... } -# 238| ... call to ||(_:_:) ... +# 238| ... .||(_:_:) ... #-----| exception -> exit disjunct(b1:b2:) (normal) #-----| false -> [false] (...) #-----| true -> [true] (...) -# 238| [true] ... call to ||(_:_:) ... +# 238| [true] ... .||(_:_:) ... #-----| exception -> exit disjunct(b1:b2:) (normal) #-----| true -> [true] (...) @@ -2413,7 +2319,7 @@ cfg.swift: #-----| -> return ... # 238| return ... -#-----| -> ... call to ||(_:_:) ... +#-----| -> ... .||(_:_:) ... # 238| { ... } #-----| -> b2 @@ -2466,25 +2372,22 @@ cfg.swift: #-----| -> d # 244| c -#-----| match -> +(_:_:) +#-----| match -> .+(_:_:) # 244| a #-----| -> b -# 244| ... call to +(_:_:) ... +# 244| ... .+(_:_:) ... #-----| -> var ... = ... -# 244| +(_:_:) +# 244| .+(_:_:) #-----| -> Int.Type # 244| Int.Type -#-----| -> call to +(_:_:) - -# 244| call to +(_:_:) #-----| -> a # 244| b -#-----| -> ... call to +(_:_:) ... +#-----| -> ... .+(_:_:) ... # 245| var ... = ... #-----| -> d @@ -2493,25 +2396,22 @@ cfg.swift: #-----| -> e # 245| d -#-----| match -> -(_:_:) +#-----| match -> .-(_:_:) # 245| a #-----| -> b -# 245| ... call to -(_:_:) ... +# 245| ... .-(_:_:) ... #-----| -> var ... = ... -# 245| -(_:_:) +# 245| .-(_:_:) #-----| -> Int.Type # 245| Int.Type -#-----| -> call to -(_:_:) - -# 245| call to -(_:_:) #-----| -> a # 245| b -#-----| -> ... call to -(_:_:) ... +#-----| -> ... .-(_:_:) ... # 246| var ... = ... #-----| -> e @@ -2520,25 +2420,22 @@ cfg.swift: #-----| -> f # 246| e -#-----| match -> *(_:_:) +#-----| match -> .*(_:_:) # 246| a #-----| -> b -# 246| ... call to *(_:_:) ... +# 246| ... .*(_:_:) ... #-----| -> var ... = ... -# 246| *(_:_:) +# 246| .*(_:_:) #-----| -> Int.Type # 246| Int.Type -#-----| -> call to *(_:_:) - -# 246| call to *(_:_:) #-----| -> a # 246| b -#-----| -> ... call to *(_:_:) ... +#-----| -> ... .*(_:_:) ... # 247| var ... = ... #-----| -> f @@ -2547,25 +2444,22 @@ cfg.swift: #-----| -> g # 247| f -#-----| match -> /(_:_:) +#-----| match -> ./(_:_:) # 247| a #-----| -> b -# 247| ... call to /(_:_:) ... +# 247| ... ./(_:_:) ... #-----| -> var ... = ... -# 247| /(_:_:) +# 247| ./(_:_:) #-----| -> Int.Type # 247| Int.Type -#-----| -> call to /(_:_:) - -# 247| call to /(_:_:) #-----| -> a # 247| b -#-----| -> ... call to /(_:_:) ... +#-----| -> ... ./(_:_:) ... # 248| var ... = ... #-----| -> g @@ -2574,25 +2468,22 @@ cfg.swift: #-----| -> h # 248| g -#-----| match -> %(_:_:) +#-----| match -> .%(_:_:) # 248| a #-----| -> b -# 248| ... call to %(_:_:) ... +# 248| ... .%(_:_:) ... #-----| -> var ... = ... -# 248| %(_:_:) +# 248| .%(_:_:) #-----| -> Int.Type # 248| Int.Type -#-----| -> call to %(_:_:) - -# 248| call to %(_:_:) #-----| -> a # 248| b -#-----| -> ... call to %(_:_:) ... +#-----| -> ... .%(_:_:) ... # 249| var ... = ... #-----| -> h @@ -2601,25 +2492,22 @@ cfg.swift: #-----| -> i # 249| h -#-----| match -> &(_:_:) +#-----| match -> .&(_:_:) # 249| a #-----| -> b -# 249| ... call to &(_:_:) ... +# 249| ... .&(_:_:) ... #-----| -> var ... = ... -# 249| &(_:_:) +# 249| .&(_:_:) #-----| -> Int.Type # 249| Int.Type -#-----| -> call to &(_:_:) - -# 249| call to &(_:_:) #-----| -> a # 249| b -#-----| -> ... call to &(_:_:) ... +#-----| -> ... .&(_:_:) ... # 250| var ... = ... #-----| -> i @@ -2628,25 +2516,22 @@ cfg.swift: #-----| -> j # 250| i -#-----| match -> |(_:_:) +#-----| match -> .|(_:_:) # 250| a #-----| -> b -# 250| ... call to |(_:_:) ... +# 250| ... .|(_:_:) ... #-----| -> var ... = ... -# 250| Int.Type -#-----| -> call to |(_:_:) - -# 250| call to |(_:_:) -#-----| -> a - -# 250| |(_:_:) +# 250| .|(_:_:) #-----| -> Int.Type +# 250| Int.Type +#-----| -> a + # 250| b -#-----| -> ... call to |(_:_:) ... +#-----| -> ... .|(_:_:) ... # 251| var ... = ... #-----| -> j @@ -2655,25 +2540,22 @@ cfg.swift: #-----| -> k # 251| j -#-----| match -> ^(_:_:) +#-----| match -> .^(_:_:) # 251| a #-----| -> b -# 251| ... call to ^(_:_:) ... +# 251| ... .^(_:_:) ... #-----| -> var ... = ... -# 251| Int.Type -#-----| -> call to ^(_:_:) - -# 251| ^(_:_:) +# 251| .^(_:_:) #-----| -> Int.Type -# 251| call to ^(_:_:) +# 251| Int.Type #-----| -> a # 251| b -#-----| -> ... call to ^(_:_:) ... +#-----| -> ... .^(_:_:) ... # 252| var ... = ... #-----| -> k @@ -2682,25 +2564,22 @@ cfg.swift: #-----| -> l # 252| k -#-----| match -> <<(_:_:) +#-----| match -> .<<(_:_:) # 252| a #-----| -> b -# 252| ... call to <<(_:_:) ... +# 252| ... .<<(_:_:) ... #-----| -> var ... = ... -# 252| <<(_:_:) +# 252| .<<(_:_:) #-----| -> Int.Type # 252| Int.Type -#-----| -> call to <<(_:_:) - -# 252| call to <<(_:_:) #-----| -> a # 252| b -#-----| -> ... call to <<(_:_:) ... +#-----| -> ... .<<(_:_:) ... # 253| var ... = ... #-----| -> l @@ -2709,25 +2588,22 @@ cfg.swift: #-----| -> o # 253| l -#-----| match -> >>(_:_:) +#-----| match -> .>>(_:_:) # 253| a #-----| -> b -# 253| ... call to >>(_:_:) ... +# 253| ... .>>(_:_:) ... #-----| -> var ... = ... -# 253| >>(_:_:) +# 253| .>>(_:_:) #-----| -> Int.Type # 253| Int.Type -#-----| -> call to >>(_:_:) - -# 253| call to >>(_:_:) #-----| -> a # 253| b -#-----| -> ... call to >>(_:_:) ... +#-----| -> ... .>>(_:_:) ... # 254| var ... = ... #-----| -> o @@ -2736,25 +2612,22 @@ cfg.swift: #-----| -> p # 254| o -#-----| match -> ==(_:_:) +#-----| match -> .==(_:_:) # 254| a #-----| -> b -# 254| ... call to ==(_:_:) ... +# 254| ... .==(_:_:) ... #-----| -> var ... = ... -# 254| ==(_:_:) +# 254| .==(_:_:) #-----| -> Int.Type # 254| Int.Type -#-----| -> call to ==(_:_:) - -# 254| call to ==(_:_:) #-----| -> a # 254| b -#-----| -> ... call to ==(_:_:) ... +#-----| -> ... .==(_:_:) ... # 255| var ... = ... #-----| -> p @@ -2763,25 +2636,22 @@ cfg.swift: #-----| -> q # 255| p -#-----| match -> !=(_:_:) +#-----| match -> .!=(_:_:) # 255| a #-----| -> b -# 255| ... call to !=(_:_:) ... +# 255| ... .!=(_:_:) ... #-----| -> var ... = ... -# 255| !=(_:_:) +# 255| .!=(_:_:) #-----| -> Int.Type # 255| Int.Type -#-----| -> call to !=(_:_:) - -# 255| call to !=(_:_:) #-----| -> a # 255| b -#-----| -> ... call to !=(_:_:) ... +#-----| -> ... .!=(_:_:) ... # 256| var ... = ... #-----| -> q @@ -2790,25 +2660,22 @@ cfg.swift: #-----| -> r # 256| q -#-----| match -> <(_:_:) +#-----| match -> .<(_:_:) # 256| a #-----| -> b -# 256| ... call to <(_:_:) ... +# 256| ... .<(_:_:) ... #-----| -> var ... = ... -# 256| <(_:_:) +# 256| .<(_:_:) #-----| -> Int.Type # 256| Int.Type -#-----| -> call to <(_:_:) - -# 256| call to <(_:_:) #-----| -> a # 256| b -#-----| -> ... call to <(_:_:) ... +#-----| -> ... .<(_:_:) ... # 257| var ... = ... #-----| -> r @@ -2817,25 +2684,22 @@ cfg.swift: #-----| -> s # 257| r -#-----| match -> <=(_:_:) +#-----| match -> .<=(_:_:) # 257| a #-----| -> b -# 257| ... call to <=(_:_:) ... +# 257| ... .<=(_:_:) ... #-----| -> var ... = ... -# 257| <=(_:_:) +# 257| .<=(_:_:) #-----| -> Int.Type # 257| Int.Type -#-----| -> call to <=(_:_:) - -# 257| call to <=(_:_:) #-----| -> a # 257| b -#-----| -> ... call to <=(_:_:) ... +#-----| -> ... .<=(_:_:) ... # 258| var ... = ... #-----| -> s @@ -2844,25 +2708,22 @@ cfg.swift: #-----| -> t # 258| s -#-----| match -> >(_:_:) +#-----| match -> .>(_:_:) # 258| a #-----| -> b -# 258| ... call to >(_:_:) ... +# 258| ... .>(_:_:) ... #-----| -> var ... = ... -# 258| >(_:_:) +# 258| .>(_:_:) #-----| -> Int.Type # 258| Int.Type -#-----| -> call to >(_:_:) - -# 258| call to >(_:_:) #-----| -> a # 258| b -#-----| -> ... call to >(_:_:) ... +#-----| -> ... .>(_:_:) ... # 259| var ... = ... #-----| -> t @@ -2871,25 +2732,22 @@ cfg.swift: #-----| -> exit binaryExprs(a:b:) (normal) # 259| t -#-----| match -> >=(_:_:) +#-----| match -> .>=(_:_:) # 259| a #-----| -> b -# 259| ... call to >=(_:_:) ... +# 259| ... .>=(_:_:) ... #-----| -> var ... = ... -# 259| >=(_:_:) +# 259| .>=(_:_:) #-----| -> Int.Type # 259| Int.Type -#-----| -> call to >=(_:_:) - -# 259| call to >=(_:_:) #-----| -> a # 259| b -#-----| -> ... call to >=(_:_:) ... +#-----| -> ... .>=(_:_:) ... # 262| enter interpolatedString(x:y:) #-----| -> interpolatedString(x:y:) @@ -2911,173 +2769,163 @@ cfg.swift: #-----| return -> exit interpolatedString(x:y:) (normal) # 263| -#-----| -> call to ... +#-----| -> call to appendLiteral(_:) # 263| "..." #-----| -> return ... # 263| OpaqueValueExpr +#-----| -> .appendLiteral(_:) # 263| TapExpr #-----| -> "..." -# 263| call to ... -#-----| -> appendInterpolation(_:) +# 263| call to appendLiteral(_:) +#-----| -> .appendInterpolation(_:) # 263| $interpolation #-----| -> &... # 263| &... -#-----| -> call to appendLiteral(_:) - -# 263| call to appendLiteral(_:) #-----| -> +# 263| .appendLiteral(_:) +#-----| -> $interpolation + # 263| $interpolation #-----| -> &... # 263| &... -#-----| -> call to appendInterpolation(_:) - -# 263| appendInterpolation(_:) -#-----| -> $interpolation - -# 263| call to appendInterpolation(_:) #-----| -> x -# 263| call to ... +# 263| .appendInterpolation(_:) +#-----| -> $interpolation + +# 263| call to appendInterpolation(_:) +#-----| -> .appendLiteral(_:) # 263| x -#-----| -> call to ... +#-----| -> call to appendInterpolation(_:) # 263| + -#-----| -> call to ... +#-----| -> call to appendLiteral(_:) # 263| $interpolation #-----| -> &... # 263| &... -#-----| -> call to appendLiteral(_:) - -# 263| call to ... -#-----| -> appendInterpolation(_:) - -# 263| call to appendLiteral(_:) #-----| -> + -# 263| $interpolation -#-----| -> &... - -# 263| &... -#-----| -> call to appendInterpolation(_:) - -# 263| appendInterpolation(_:) +# 263| .appendLiteral(_:) #-----| -> $interpolation -# 263| call to appendInterpolation(_:) -#-----| -> y - -# 263| call to ... - -# 263| y -#-----| -> call to ... - -# 263| is equal to -#-----| -> call to ... - -# 263| $interpolation -#-----| -> &... - -# 263| &... -#-----| -> call to appendLiteral(_:) - -# 263| call to ... -#-----| -> appendInterpolation(_:) - # 263| call to appendLiteral(_:) -#-----| -> is equal to +#-----| -> .appendInterpolation(_:) # 263| $interpolation #-----| -> &... # 263| &... -#-----| -> call to appendInterpolation(_:) +#-----| -> y -# 263| appendInterpolation(_:) +# 263| .appendInterpolation(_:) #-----| -> $interpolation # 263| call to appendInterpolation(_:) -#-----| -> +(_:_:) +#-----| -> .appendLiteral(_:) -# 263| call to ... +# 263| y +#-----| -> call to appendInterpolation(_:) + +# 263| is equal to +#-----| -> call to appendLiteral(_:) + +# 263| $interpolation +#-----| -> &... + +# 263| &... +#-----| -> is equal to + +# 263| .appendLiteral(_:) +#-----| -> $interpolation + +# 263| call to appendLiteral(_:) +#-----| -> .appendInterpolation(_:) + +# 263| $interpolation +#-----| -> &... + +# 263| &... +#-----| -> .+(_:_:) + +# 263| .appendInterpolation(_:) +#-----| -> $interpolation + +# 263| call to appendInterpolation(_:) +#-----| -> .appendLiteral(_:) # 263| x #-----| -> y -# 263| ... call to +(_:_:) ... -#-----| -> call to ... +# 263| ... .+(_:_:) ... +#-----| -> call to appendInterpolation(_:) -# 263| +(_:_:) +# 263| .+(_:_:) #-----| -> Int.Type # 263| Int.Type -#-----| -> call to +(_:_:) - -# 263| call to +(_:_:) #-----| -> x # 263| y -#-----| -> ... call to +(_:_:) ... +#-----| -> ... .+(_:_:) ... # 263| and here is a zero: -#-----| -> call to ... - -# 263| $interpolation -#-----| -> &... - -# 263| &... #-----| -> call to appendLiteral(_:) -# 263| call to ... -#-----| -> appendInterpolation(_:) +# 263| $interpolation +#-----| -> &... + +# 263| &... +#-----| -> and here is a zero: + +# 263| .appendLiteral(_:) +#-----| -> $interpolation # 263| call to appendLiteral(_:) -#-----| -> and here is a zero: +#-----| -> .appendInterpolation(_:) # 263| $interpolation #-----| -> &... # 263| &... -#-----| -> call to appendInterpolation(_:) +#-----| -> returnZero() -# 263| appendInterpolation(_:) +# 263| .appendInterpolation(_:) #-----| -> $interpolation # 263| call to appendInterpolation(_:) -#-----| -> returnZero() - -# 263| call to ... +#-----| -> .appendLiteral(_:) # 263| returnZero() #-----| -> call to returnZero() # 263| call to returnZero() -#-----| -> call to ... +#-----| -> call to appendInterpolation(_:) # 263| -#-----| -> call to ... +#-----| -> call to appendLiteral(_:) # 263| $interpolation #-----| -> &... # 263| &... -#-----| -> call to appendLiteral(_:) +#-----| -> -# 263| call to ... -#-----| -> TapExpr +# 263| .appendLiteral(_:) +#-----| -> $interpolation # 263| call to appendLiteral(_:) -#-----| -> +#-----| -> TapExpr # 266| enter testSubscriptExpr() #-----| -> testSubscriptExpr() @@ -3145,7 +2993,7 @@ cfg.swift: #-----| -> 0 # 268| setter for ... = ... -#-----| -> +=(_:_:) +#-----| -> .+=(_:_:) # 268| 0 #-----| -> ...[...] @@ -3165,23 +3013,20 @@ cfg.swift: # 269| getter for ...[...] #-----| -> &... -# 269| ... call to +=(_:_:) ... -#-----| -> -=(_:_:) +# 269| ... .+=(_:_:) ... +#-----| -> .-=(_:_:) # 269| 1 #-----| -> getter for ...[...] -# 269| +=(_:_:) +# 269| .+=(_:_:) #-----| -> Int.Type # 269| Int.Type -#-----| -> call to +=(_:_:) - -# 269| call to +=(_:_:) #-----| -> a # 269| 1 -#-----| -> ... call to +=(_:_:) ... +#-----| -> ... .+=(_:_:) ... # 270| &... #-----| -> 2 @@ -3195,23 +3040,20 @@ cfg.swift: # 270| getter for ...[...] #-----| -> &... -# 270| ... call to -=(_:_:) ... -#-----| -> *=(_:_:) +# 270| ... .-=(_:_:) ... +#-----| -> .*=(_:_:) # 270| 2 #-----| -> getter for ...[...] -# 270| -=(_:_:) +# 270| .-=(_:_:) #-----| -> Int.Type # 270| Int.Type -#-----| -> call to -=(_:_:) - -# 270| call to -=(_:_:) #-----| -> a # 270| 1 -#-----| -> ... call to -=(_:_:) ... +#-----| -> ... .-=(_:_:) ... # 271| &... #-----| -> 3 @@ -3225,23 +3067,20 @@ cfg.swift: # 271| getter for ...[...] #-----| -> &... -# 271| ... call to *=(_:_:) ... -#-----| -> /=(_:_:) +# 271| ... .*=(_:_:) ... +#-----| -> ./=(_:_:) # 271| 3 #-----| -> getter for ...[...] -# 271| *=(_:_:) +# 271| .*=(_:_:) #-----| -> Int.Type # 271| Int.Type -#-----| -> call to *=(_:_:) - -# 271| call to *=(_:_:) #-----| -> a # 271| 1 -#-----| -> ... call to *=(_:_:) ... +#-----| -> ... .*=(_:_:) ... # 272| &... #-----| -> 4 @@ -3255,23 +3094,20 @@ cfg.swift: # 272| getter for ...[...] #-----| -> &... -# 272| ... call to /=(_:_:) ... -#-----| -> %=(_:_:) +# 272| ... ./=(_:_:) ... +#-----| -> .%=(_:_:) # 272| 4 #-----| -> getter for ...[...] -# 272| /=(_:_:) +# 272| ./=(_:_:) #-----| -> Int.Type # 272| Int.Type -#-----| -> call to /=(_:_:) - -# 272| call to /=(_:_:) #-----| -> a # 272| 1 -#-----| -> ... call to /=(_:_:) ... +#-----| -> ... ./=(_:_:) ... # 273| &... #-----| -> 5 @@ -3285,23 +3121,20 @@ cfg.swift: # 273| getter for ...[...] #-----| -> &... -# 273| ... call to %=(_:_:) ... -#-----| -> &=(_:_:) +# 273| ... .%=(_:_:) ... +#-----| -> .&=(_:_:) # 273| 5 #-----| -> getter for ...[...] -# 273| %=(_:_:) +# 273| .%=(_:_:) #-----| -> Int.Type # 273| Int.Type -#-----| -> call to %=(_:_:) - -# 273| call to %=(_:_:) #-----| -> a # 273| 1 -#-----| -> ... call to %=(_:_:) ... +#-----| -> ... .%=(_:_:) ... # 274| &... #-----| -> 6 @@ -3315,23 +3148,20 @@ cfg.swift: # 274| getter for ...[...] #-----| -> &... -# 274| ... call to &=(_:_:) ... -#-----| -> |=(_:_:) +# 274| ... .&=(_:_:) ... +#-----| -> .|=(_:_:) # 274| 6 #-----| -> getter for ...[...] -# 274| &=(_:_:) +# 274| .&=(_:_:) #-----| -> Int.Type # 274| Int.Type -#-----| -> call to &=(_:_:) - -# 274| call to &=(_:_:) #-----| -> a # 274| 1 -#-----| -> ... call to &=(_:_:) ... +#-----| -> ... .&=(_:_:) ... # 275| &... #-----| -> 7 @@ -3345,23 +3175,20 @@ cfg.swift: # 275| getter for ...[...] #-----| -> &... -# 275| ... call to |=(_:_:) ... -#-----| -> ^=(_:_:) +# 275| ... .|=(_:_:) ... +#-----| -> .^=(_:_:) # 275| 7 #-----| -> getter for ...[...] -# 275| Int.Type -#-----| -> call to |=(_:_:) - -# 275| call to |=(_:_:) -#-----| -> a - -# 275| |=(_:_:) +# 275| .|=(_:_:) #-----| -> Int.Type +# 275| Int.Type +#-----| -> a + # 275| 1 -#-----| -> ... call to |=(_:_:) ... +#-----| -> ... .|=(_:_:) ... # 276| &... #-----| -> 8 @@ -3375,23 +3202,20 @@ cfg.swift: # 276| getter for ...[...] #-----| -> &... -# 276| ... call to ^=(_:_:) ... -#-----| -> <<=(_:_:) +# 276| ... .^=(_:_:) ... +#-----| -> .<<=(_:_:) # 276| 8 #-----| -> getter for ...[...] -# 276| Int.Type -#-----| -> call to ^=(_:_:) - -# 276| ^=(_:_:) +# 276| .^=(_:_:) #-----| -> Int.Type -# 276| call to ^=(_:_:) +# 276| Int.Type #-----| -> a # 276| 1 -#-----| -> ... call to ^=(_:_:) ... +#-----| -> ... .^=(_:_:) ... # 277| &... #-----| -> 9 @@ -3405,23 +3229,20 @@ cfg.swift: # 277| getter for ...[...] #-----| -> &... -# 277| ... call to <<=(_:_:) ... -#-----| -> >>=(_:_:) +# 277| ... .<<=(_:_:) ... +#-----| -> .>>=(_:_:) # 277| 9 #-----| -> getter for ...[...] -# 277| <<=(_:_:) +# 277| .<<=(_:_:) #-----| -> Int.Type # 277| Int.Type -#-----| -> call to <<=(_:_:) - -# 277| call to <<=(_:_:) #-----| -> a # 277| 1 -#-----| -> ... call to <<=(_:_:) ... +#-----| -> ... .<<=(_:_:) ... # 278| &... #-----| -> 10 @@ -3435,23 +3256,20 @@ cfg.swift: # 278| getter for ...[...] #-----| -> &... -# 278| ... call to >>=(_:_:) ... +# 278| ... .>>=(_:_:) ... #-----| -> tupleWithA # 278| 10 #-----| -> getter for ...[...] -# 278| >>=(_:_:) +# 278| .>>=(_:_:) #-----| -> Int.Type # 278| Int.Type -#-----| -> call to >>=(_:_:) - -# 278| call to >>=(_:_:) #-----| -> a # 278| 1 -#-----| -> ... call to >>=(_:_:) ... +#-----| -> ... .>>=(_:_:) ... # 280| var ... = ... #-----| -> tupleWithA @@ -3625,7 +3443,7 @@ cfg.swift: #-----| -> &... # 284| ...[...] -#-----| -> +(_:_:) +#-----| -> .+(_:_:) # 284| setter for ... = ... #-----| -> b @@ -3645,23 +3463,20 @@ cfg.swift: # 284| getter for ...[...] #-----| -> (Int) ... -# 284| ... call to +(_:_:) ... +# 284| ... .+(_:_:) ... #-----| -> setter for ... = ... # 284| 0 #-----| -> getter for ...[...] -# 284| +(_:_:) +# 284| .+(_:_:) #-----| -> Int.Type # 284| Int.Type -#-----| -> call to +(_:_:) - -# 284| call to +(_:_:) #-----| -> b # 284| 1 -#-----| -> ... call to +(_:_:) ... +#-----| -> ... .+(_:_:) ... # 285| &... #-----| -> 2 @@ -3670,7 +3485,7 @@ cfg.swift: #-----| -> &... # 285| ...[...] -#-----| -> -(_:_:) +#-----| -> .-(_:_:) # 285| setter for ... = ... #-----| -> b @@ -3690,23 +3505,20 @@ cfg.swift: # 285| getter for ...[...] #-----| -> (Int) ... -# 285| ... call to -(_:_:) ... +# 285| ... .-(_:_:) ... #-----| -> setter for ... = ... # 285| 1 #-----| -> getter for ...[...] -# 285| -(_:_:) +# 285| .-(_:_:) #-----| -> Int.Type # 285| Int.Type -#-----| -> call to -(_:_:) - -# 285| call to -(_:_:) #-----| -> b # 285| 1 -#-----| -> ... call to -(_:_:) ... +#-----| -> ... .-(_:_:) ... # 286| &... #-----| -> 3 @@ -3715,7 +3527,7 @@ cfg.swift: #-----| -> &... # 286| ...[...] -#-----| -> *(_:_:) +#-----| -> .*(_:_:) # 286| setter for ... = ... #-----| -> b @@ -3735,23 +3547,20 @@ cfg.swift: # 286| getter for ...[...] #-----| -> (Int) ... -# 286| ... call to *(_:_:) ... +# 286| ... .*(_:_:) ... #-----| -> setter for ... = ... # 286| 2 #-----| -> getter for ...[...] -# 286| *(_:_:) +# 286| .*(_:_:) #-----| -> Int.Type # 286| Int.Type -#-----| -> call to *(_:_:) - -# 286| call to *(_:_:) #-----| -> b # 286| 1 -#-----| -> ... call to *(_:_:) ... +#-----| -> ... .*(_:_:) ... # 287| &... #-----| -> 4 @@ -3760,7 +3569,7 @@ cfg.swift: #-----| -> &... # 287| ...[...] -#-----| -> /(_:_:) +#-----| -> ./(_:_:) # 287| setter for ... = ... #-----| -> b @@ -3780,23 +3589,20 @@ cfg.swift: # 287| getter for ...[...] #-----| -> (Int) ... -# 287| ... call to /(_:_:) ... +# 287| ... ./(_:_:) ... #-----| -> setter for ... = ... # 287| 3 #-----| -> getter for ...[...] -# 287| /(_:_:) +# 287| ./(_:_:) #-----| -> Int.Type # 287| Int.Type -#-----| -> call to /(_:_:) - -# 287| call to /(_:_:) #-----| -> b # 287| 1 -#-----| -> ... call to /(_:_:) ... +#-----| -> ... ./(_:_:) ... # 288| &... #-----| -> 5 @@ -3805,7 +3611,7 @@ cfg.swift: #-----| -> &... # 288| ...[...] -#-----| -> %(_:_:) +#-----| -> .%(_:_:) # 288| setter for ... = ... #-----| -> b @@ -3825,23 +3631,20 @@ cfg.swift: # 288| getter for ...[...] #-----| -> (Int) ... -# 288| ... call to %(_:_:) ... +# 288| ... .%(_:_:) ... #-----| -> setter for ... = ... # 288| 4 #-----| -> getter for ...[...] -# 288| %(_:_:) +# 288| .%(_:_:) #-----| -> Int.Type # 288| Int.Type -#-----| -> call to %(_:_:) - -# 288| call to %(_:_:) #-----| -> b # 288| 1 -#-----| -> ... call to %(_:_:) ... +#-----| -> ... .%(_:_:) ... # 289| &... #-----| -> 6 @@ -3850,7 +3653,7 @@ cfg.swift: #-----| -> &... # 289| ...[...] -#-----| -> &(_:_:) +#-----| -> .&(_:_:) # 289| setter for ... = ... #-----| -> b @@ -3870,23 +3673,20 @@ cfg.swift: # 289| getter for ...[...] #-----| -> (Int) ... -# 289| ... call to &(_:_:) ... +# 289| ... .&(_:_:) ... #-----| -> setter for ... = ... # 289| 5 #-----| -> getter for ...[...] -# 289| &(_:_:) +# 289| .&(_:_:) #-----| -> Int.Type # 289| Int.Type -#-----| -> call to &(_:_:) - -# 289| call to &(_:_:) #-----| -> b # 289| 1 -#-----| -> ... call to &(_:_:) ... +#-----| -> ... .&(_:_:) ... # 290| &... #-----| -> 7 @@ -3895,7 +3695,7 @@ cfg.swift: #-----| -> &... # 290| ...[...] -#-----| -> |(_:_:) +#-----| -> .|(_:_:) # 290| setter for ... = ... #-----| -> b @@ -3915,23 +3715,20 @@ cfg.swift: # 290| getter for ...[...] #-----| -> (Int) ... -# 290| ... call to |(_:_:) ... +# 290| ... .|(_:_:) ... #-----| -> setter for ... = ... # 290| 6 #-----| -> getter for ...[...] -# 290| Int.Type -#-----| -> call to |(_:_:) - -# 290| call to |(_:_:) -#-----| -> b - -# 290| |(_:_:) +# 290| .|(_:_:) #-----| -> Int.Type +# 290| Int.Type +#-----| -> b + # 290| 1 -#-----| -> ... call to |(_:_:) ... +#-----| -> ... .|(_:_:) ... # 291| &... #-----| -> 8 @@ -3940,7 +3737,7 @@ cfg.swift: #-----| -> &... # 291| ...[...] -#-----| -> ^(_:_:) +#-----| -> .^(_:_:) # 291| setter for ... = ... #-----| -> b @@ -3960,23 +3757,20 @@ cfg.swift: # 291| getter for ...[...] #-----| -> (Int) ... -# 291| ... call to ^(_:_:) ... +# 291| ... .^(_:_:) ... #-----| -> setter for ... = ... # 291| 7 #-----| -> getter for ...[...] -# 291| Int.Type -#-----| -> call to ^(_:_:) - -# 291| ^(_:_:) +# 291| .^(_:_:) #-----| -> Int.Type -# 291| call to ^(_:_:) +# 291| Int.Type #-----| -> b # 291| 1 -#-----| -> ... call to ^(_:_:) ... +#-----| -> ... .^(_:_:) ... # 292| &... #-----| -> 9 @@ -3985,7 +3779,7 @@ cfg.swift: #-----| -> &... # 292| ...[...] -#-----| -> <<(_:_:) +#-----| -> .<<(_:_:) # 292| setter for ... = ... #-----| -> b @@ -4005,23 +3799,20 @@ cfg.swift: # 292| getter for ...[...] #-----| -> (Int) ... -# 292| ... call to <<(_:_:) ... +# 292| ... .<<(_:_:) ... #-----| -> setter for ... = ... # 292| 8 #-----| -> getter for ...[...] -# 292| <<(_:_:) +# 292| .<<(_:_:) #-----| -> Int.Type # 292| Int.Type -#-----| -> call to <<(_:_:) - -# 292| call to <<(_:_:) #-----| -> b # 292| 1 -#-----| -> ... call to <<(_:_:) ... +#-----| -> ... .<<(_:_:) ... # 293| &... #-----| -> 10 @@ -4030,7 +3821,7 @@ cfg.swift: #-----| -> &... # 293| ...[...] -#-----| -> >>(_:_:) +#-----| -> .>>(_:_:) # 293| setter for ... = ... #-----| -> (...) @@ -4050,23 +3841,20 @@ cfg.swift: # 293| getter for ...[...] #-----| -> (Int) ... -# 293| ... call to >>(_:_:) ... +# 293| ... .>>(_:_:) ... #-----| -> setter for ... = ... # 293| 9 #-----| -> getter for ...[...] -# 293| >>(_:_:) +# 293| .>>(_:_:) #-----| -> Int.Type # 293| Int.Type -#-----| -> call to >>(_:_:) - -# 293| call to >>(_:_:) #-----| -> b # 293| 1 -#-----| -> ... call to >>(_:_:) ... +#-----| -> ... .>>(_:_:) ... # 295| var ... = ... #-----| -> a1 @@ -4099,7 +3887,7 @@ cfg.swift: #-----| match -> a5 # 295| a5 -#-----| -> +(_:_:) +#-----| -> .+(_:_:) # 295| a5 #-----| match -> tupleWithA @@ -4119,16 +3907,13 @@ cfg.swift: # 296| a1 #-----| -> b -# 296| ... call to +(_:_:) ... -#-----| -> +(_:_:) +# 296| ... .+(_:_:) ... +#-----| -> .+(_:_:) -# 296| +(_:_:) +# 296| .+(_:_:) #-----| -> Int.Type # 296| Int.Type -#-----| -> call to +(_:_:) - -# 296| call to +(_:_:) #-----| -> a1 # 296| &... @@ -4138,7 +3923,7 @@ cfg.swift: #-----| -> &... # 296| (Int) ... -#-----| -> ... call to +(_:_:) ... +#-----| -> ... .+(_:_:) ... # 296| getter for ...[...] #-----| -> (Int) ... @@ -4149,16 +3934,13 @@ cfg.swift: # 296| a2 #-----| -> b -# 296| ... call to +(_:_:) ... -#-----| -> +(_:_:) +# 296| ... .+(_:_:) ... +#-----| -> .+(_:_:) -# 296| +(_:_:) +# 296| .+(_:_:) #-----| -> Int.Type # 296| Int.Type -#-----| -> call to +(_:_:) - -# 296| call to +(_:_:) #-----| -> a2 # 296| &... @@ -4168,7 +3950,7 @@ cfg.swift: #-----| -> &... # 296| (Int) ... -#-----| -> ... call to +(_:_:) ... +#-----| -> ... .+(_:_:) ... # 296| getter for ...[...] #-----| -> (Int) ... @@ -4179,16 +3961,13 @@ cfg.swift: # 296| a3 #-----| -> b -# 296| ... call to +(_:_:) ... -#-----| -> +(_:_:) +# 296| ... .+(_:_:) ... +#-----| -> .+(_:_:) -# 296| +(_:_:) +# 296| .+(_:_:) #-----| -> Int.Type # 296| Int.Type -#-----| -> call to +(_:_:) - -# 296| call to +(_:_:) #-----| -> a3 # 296| &... @@ -4198,7 +3977,7 @@ cfg.swift: #-----| -> &... # 296| (Int) ... -#-----| -> ... call to +(_:_:) ... +#-----| -> ... .+(_:_:) ... # 296| getter for ...[...] #-----| -> (Int) ... @@ -4209,16 +3988,13 @@ cfg.swift: # 296| a4 #-----| -> b -# 296| ... call to +(_:_:) ... -#-----| -> +(_:_:) +# 296| ... .+(_:_:) ... +#-----| -> .+(_:_:) -# 296| +(_:_:) +# 296| .+(_:_:) #-----| -> Int.Type # 296| Int.Type -#-----| -> call to +(_:_:) - -# 296| call to +(_:_:) #-----| -> a4 # 296| &... @@ -4228,7 +4004,7 @@ cfg.swift: #-----| -> &... # 296| (Int) ... -#-----| -> ... call to +(_:_:) ... +#-----| -> ... .+(_:_:) ... # 296| getter for ...[...] #-----| -> (Int) ... @@ -4239,16 +4015,13 @@ cfg.swift: # 296| a5 #-----| -> b -# 296| ... call to +(_:_:) ... +# 296| ... .+(_:_:) ... #-----| -> (...) -# 296| +(_:_:) +# 296| .+(_:_:) #-----| -> Int.Type # 296| Int.Type -#-----| -> call to +(_:_:) - -# 296| call to +(_:_:) #-----| -> a5 # 296| &... @@ -4258,7 +4031,7 @@ cfg.swift: #-----| -> &... # 296| (Int) ... -#-----| -> ... call to +(_:_:) ... +#-----| -> ... .+(_:_:) ... # 296| getter for ...[...] #-----| -> (Int) ... @@ -4289,30 +4062,27 @@ cfg.swift: # 300| x #-----| -> (Int) ... -# 300| ... call to >=(_:_:) ... +# 300| ... .>=(_:_:) ... #-----| false -> exit loop1(x:) (normal) #-----| true -> print(_:separator:terminator:) # 300| StmtCondition -#-----| -> >=(_:_:) +#-----| -> .>=(_:_:) -# 300| >=(_:_:) +# 300| .>=(_:_:) #-----| -> Int.Type # 300| Int.Type -#-----| -> call to >=(_:_:) - -# 300| call to >=(_:_:) #-----| -> x # 300| 0 -#-----| -> ... call to >=(_:_:) ... +#-----| -> ... .>=(_:_:) ... # 301| print(_:separator:terminator:) #-----| -> x # 301| call to print(_:separator:terminator:) -#-----| -> -=(_:_:) +#-----| -> .-=(_:_:) # 301| default separator #-----| -> default terminator @@ -4341,20 +4111,17 @@ cfg.swift: # 302| x #-----| -> &... -# 302| ... call to -=(_:_:) ... +# 302| ... .-=(_:_:) ... #-----| -> StmtCondition -# 302| -=(_:_:) +# 302| .-=(_:_:) #-----| -> Int.Type # 302| Int.Type -#-----| -> call to -=(_:_:) - -# 302| call to -=(_:_:) #-----| -> x # 302| 1 -#-----| -> ... call to -=(_:_:) ... +#-----| -> ... .-=(_:_:) ... # 306| enter loop2(x:) #-----| -> loop2(x:) @@ -4379,30 +4146,27 @@ cfg.swift: # 307| x #-----| -> (Int) ... -# 307| ... call to >=(_:_:) ... +# 307| ... .>=(_:_:) ... #-----| true -> print(_:separator:terminator:) #-----| false -> print(_:separator:terminator:) # 307| StmtCondition -#-----| -> >=(_:_:) +#-----| -> .>=(_:_:) -# 307| >=(_:_:) +# 307| .>=(_:_:) #-----| -> Int.Type # 307| Int.Type -#-----| -> call to >=(_:_:) - -# 307| call to >=(_:_:) #-----| -> x # 307| 0 -#-----| -> ... call to >=(_:_:) ... +#-----| -> ... .>=(_:_:) ... # 308| print(_:separator:terminator:) #-----| -> x # 308| call to print(_:separator:terminator:) -#-----| -> -=(_:_:) +#-----| -> .-=(_:_:) # 308| default separator #-----| -> default terminator @@ -4431,20 +4195,17 @@ cfg.swift: # 309| x #-----| -> &... -# 309| ... call to -=(_:_:) ... +# 309| ... .-=(_:_:) ... #-----| -> if ... then { ... } else { ... } -# 309| -=(_:_:) +# 309| .-=(_:_:) #-----| -> Int.Type # 309| Int.Type -#-----| -> call to -=(_:_:) - -# 309| call to -=(_:_:) #-----| -> x # 309| 1 -#-----| -> ... call to -=(_:_:) ... +#-----| -> ... .-=(_:_:) ... # 310| if ... then { ... } else { ... } #-----| -> StmtCondition @@ -4455,24 +4216,21 @@ cfg.swift: # 310| x #-----| -> (Int) ... -# 310| ... call to >(_:_:) ... +# 310| ... .>(_:_:) ... #-----| true -> break #-----| false -> if ... then { ... } # 310| StmtCondition -#-----| -> >(_:_:) +#-----| -> .>(_:_:) -# 310| >(_:_:) +# 310| .>(_:_:) #-----| -> Int.Type # 310| Int.Type -#-----| -> call to >(_:_:) - -# 310| call to >(_:_:) #-----| -> x # 310| 100 -#-----| -> ... call to >(_:_:) ... +#-----| -> ... .>(_:_:) ... # 311| break #-----| -> print(_:separator:terminator:) @@ -4486,24 +4244,21 @@ cfg.swift: # 313| x #-----| -> (Int) ... -# 313| ... call to >(_:_:) ... +# 313| ... .>(_:_:) ... #-----| true -> continue #-----| false -> print(_:separator:terminator:) # 313| StmtCondition -#-----| -> >(_:_:) +#-----| -> .>(_:_:) -# 313| >(_:_:) +# 313| .>(_:_:) #-----| -> Int.Type # 313| Int.Type -#-----| -> call to >(_:_:) - -# 313| call to >(_:_:) #-----| -> x # 313| 50 -#-----| -> ... call to >(_:_:) ... +#-----| -> ... .>(_:_:) ... # 314| continue #-----| continue -> StmtCondition @@ -4579,24 +4334,21 @@ cfg.swift: # 322| x #-----| -> (Int) ... -# 322| ... call to >=(_:_:) ... +# 322| ... .>=(_:_:) ... #-----| false -> exit labeledLoop(x:) (normal) #-----| true -> while ... { ... } # 322| StmtCondition -#-----| -> >=(_:_:) +#-----| -> .>=(_:_:) -# 322| >=(_:_:) +# 322| .>=(_:_:) #-----| -> Int.Type # 322| Int.Type -#-----| -> call to >=(_:_:) - -# 322| call to >=(_:_:) #-----| -> x # 322| 0 -#-----| -> ... call to >=(_:_:) ... +#-----| -> ... .>=(_:_:) ... # 323| while ... { ... } #-----| -> StmtCondition @@ -4607,30 +4359,27 @@ cfg.swift: # 323| x #-----| -> (Int) ... -# 323| ... call to >=(_:_:) ... +# 323| ... .>=(_:_:) ... #-----| true -> print(_:separator:terminator:) #-----| false -> print(_:separator:terminator:) # 323| StmtCondition -#-----| -> >=(_:_:) +#-----| -> .>=(_:_:) -# 323| >=(_:_:) +# 323| .>=(_:_:) #-----| -> Int.Type # 323| Int.Type -#-----| -> call to >=(_:_:) - -# 323| call to >=(_:_:) #-----| -> x # 323| 0 -#-----| -> ... call to >=(_:_:) ... +#-----| -> ... .>=(_:_:) ... # 324| print(_:separator:terminator:) #-----| -> x # 324| call to print(_:separator:terminator:) -#-----| -> -=(_:_:) +#-----| -> .-=(_:_:) # 324| default separator #-----| -> default terminator @@ -4659,20 +4408,17 @@ cfg.swift: # 325| x #-----| -> &... -# 325| ... call to -=(_:_:) ... +# 325| ... .-=(_:_:) ... #-----| -> if ... then { ... } else { ... } -# 325| -=(_:_:) +# 325| .-=(_:_:) #-----| -> Int.Type # 325| Int.Type -#-----| -> call to -=(_:_:) - -# 325| call to -=(_:_:) #-----| -> x # 325| 1 -#-----| -> ... call to -=(_:_:) ... +#-----| -> ... .-=(_:_:) ... # 326| if ... then { ... } else { ... } #-----| -> StmtCondition @@ -4683,24 +4429,21 @@ cfg.swift: # 326| x #-----| -> (Int) ... -# 326| ... call to >(_:_:) ... +# 326| ... .>(_:_:) ... #-----| true -> break outer #-----| false -> if ... then { ... } # 326| StmtCondition -#-----| -> >(_:_:) +#-----| -> .>(_:_:) -# 326| >(_:_:) +# 326| .>(_:_:) #-----| -> Int.Type # 326| Int.Type -#-----| -> call to >(_:_:) - -# 326| call to >(_:_:) #-----| -> x # 326| 100 -#-----| -> ... call to >(_:_:) ... +#-----| -> ... .>(_:_:) ... # 327| break outer #-----| -> exit labeledLoop(x:) (normal) @@ -4714,24 +4457,21 @@ cfg.swift: # 329| x #-----| -> (Int) ... -# 329| ... call to >(_:_:) ... +# 329| ... .>(_:_:) ... #-----| true -> continue inner #-----| false -> print(_:separator:terminator:) # 329| StmtCondition -#-----| -> >(_:_:) +#-----| -> .>(_:_:) -# 329| >(_:_:) +# 329| .>(_:_:) #-----| -> Int.Type # 329| Int.Type -#-----| -> call to >(_:_:) - -# 329| call to >(_:_:) #-----| -> x # 329| 50 -#-----| -> ... call to >(_:_:) ... +#-----| -> ... .>(_:_:) ... # 330| continue inner #-----| continue -> StmtCondition @@ -4805,7 +4545,7 @@ cfg.swift: #-----| -> x # 340| call to print(_:separator:terminator:) -#-----| -> -=(_:_:) +#-----| -> .-=(_:_:) # 340| default separator #-----| -> default terminator @@ -4834,20 +4574,17 @@ cfg.swift: # 341| x #-----| -> &... -# 341| ... call to -=(_:_:) ... -#-----| -> >=(_:_:) +# 341| ... .-=(_:_:) ... +#-----| -> .>=(_:_:) -# 341| -=(_:_:) +# 341| .-=(_:_:) #-----| -> Int.Type # 341| Int.Type -#-----| -> call to -=(_:_:) - -# 341| call to -=(_:_:) #-----| -> x # 341| 1 -#-----| -> ... call to -=(_:_:) ... +#-----| -> ... .-=(_:_:) ... # 342| (Int) ... #-----| -> 0 @@ -4855,21 +4592,18 @@ cfg.swift: # 342| x #-----| -> (Int) ... -# 342| ... call to >=(_:_:) ... +# 342| ... .>=(_:_:) ... #-----| false -> exit testRepeat(x:) (normal) #-----| true -> print(_:separator:terminator:) -# 342| >=(_:_:) +# 342| .>=(_:_:) #-----| -> Int.Type # 342| Int.Type -#-----| -> call to >=(_:_:) - -# 342| call to >=(_:_:) #-----| -> x # 342| 0 -#-----| -> ... call to >=(_:_:) ... +#-----| -> ... .>=(_:_:) ... # 345| enter loop_with_identity_expr() #-----| -> loop_with_identity_expr() @@ -4898,13 +4632,13 @@ cfg.swift: #-----| -> StmtCondition # 347| StmtCondition -#-----| -> <(_:_:) +#-----| -> .<(_:_:) # 347| [false] (...) #-----| false -> exit loop_with_identity_expr() (normal) # 347| [true] (...) -#-----| true -> +=(_:_:) +#-----| true -> .+=(_:_:) # 347| (Int) ... #-----| -> 10 @@ -4912,21 +4646,18 @@ cfg.swift: # 347| x #-----| -> (Int) ... -# 347| ... call to <(_:_:) ... +# 347| ... .<(_:_:) ... #-----| false -> [false] (...) #-----| true -> [true] (...) -# 347| <(_:_:) +# 347| .<(_:_:) #-----| -> Int.Type # 347| Int.Type -#-----| -> call to <(_:_:) - -# 347| call to <(_:_:) #-----| -> x # 347| 10 -#-----| -> ... call to <(_:_:) ... +#-----| -> ... .<(_:_:) ... # 348| &... #-----| -> 1 @@ -4934,20 +4665,17 @@ cfg.swift: # 348| x #-----| -> &... -# 348| ... call to +=(_:_:) ... +# 348| ... .+=(_:_:) ... #-----| -> StmtCondition -# 348| +=(_:_:) +# 348| .+=(_:_:) #-----| -> Int.Type # 348| Int.Type -#-----| -> call to +=(_:_:) - -# 348| call to +=(_:_:) #-----| -> x # 348| 1 -#-----| -> ... call to +=(_:_:) ... +#-----| -> ... .+=(_:_:) ... # 352| deinit #-----| -> { ... } @@ -5034,7 +4762,7 @@ cfg.swift: #-----| -> c # 363| c -#-----| -> getMyInt() +#-----| -> .getMyInt() # 364| return ... #-----| return -> exit testOptional(c:) (normal) @@ -5045,17 +4773,17 @@ cfg.swift: # 364| ...? #-----| -> call to getOptional() -# 364| call to getOptional() -#-----| -> call to ... +# 364| .getOptional() +#-----| -> c -# 364| call to ... +# 364| call to getOptional() #-----| -> ...? # 364| ...? #-----| -> call to getMyInt() -# 364| call to getMyInt() -#-----| -> call to ... +# 364| .getMyInt() +#-----| -> .getOptional() # 364| (Int?) ... #-----| -> OptionalEvaluationExpr @@ -5063,15 +4791,9 @@ cfg.swift: # 364| OptionalEvaluationExpr #-----| -> return ... -# 364| call to ... +# 364| call to getMyInt() #-----| -> (Int?) ... -# 364| getOptional() -#-----| -> c - -# 364| getMyInt() -#-----| -> getOptional() - # 367| enter testCapture(x:y:) #-----| -> testCapture(x:y:) @@ -5110,7 +4832,7 @@ cfg.swift: #-----| -> { ... } # 368| z -#-----| match -> +(_:_:) +#-----| match -> .+(_:_:) # 368| var ... = ... #-----| -> t @@ -5118,20 +4840,17 @@ cfg.swift: # 368| x #-----| -> y -# 368| ... call to +(_:_:) ... +# 368| ... .+(_:_:) ... #-----| -> var ... = ... -# 368| +(_:_:) +# 368| .+(_:_:) #-----| -> Int.Type # 368| Int.Type -#-----| -> call to +(_:_:) - -# 368| call to +(_:_:) #-----| -> x # 368| y -#-----| -> ... call to +(_:_:) ... +#-----| -> ... .+(_:_:) ... # 368| t #-----| match -> literal @@ -5160,7 +4879,7 @@ cfg.swift: #-----| -> t # 373| t -#-----| -> +(_:_:) +#-----| -> .+(_:_:) # 374| return ... #-----| return -> exit testTupleElement(t:) (normal) @@ -5171,59 +4890,50 @@ cfg.swift: # 374| .0 #-----| -> t -# 374| ... call to +(_:_:) ... +# 374| ... .+(_:_:) ... #-----| -> t -# 374| ... call to +(_:_:) ... +# 374| ... .+(_:_:) ... #-----| -> 1 -# 374| ... call to +(_:_:) ... +# 374| ... .+(_:_:) ... #-----| -> return ... -# 374| +(_:_:) +# 374| .+(_:_:) #-----| -> Int.Type # 374| Int.Type -#-----| -> call to +(_:_:) - -# 374| call to +(_:_:) #-----| -> t # 374| t #-----| -> .1 # 374| .1 -#-----| -> ... call to +(_:_:) ... +#-----| -> ... .+(_:_:) ... -# 374| +(_:_:) +# 374| .+(_:_:) #-----| -> Int.Type # 374| Int.Type -#-----| -> call to +(_:_:) - -# 374| call to +(_:_:) -#-----| -> +(_:_:) +#-----| -> .+(_:_:) # 374| t #-----| -> .2 # 374| .2 -#-----| -> ... call to +(_:_:) ... +#-----| -> ... .+(_:_:) ... -# 374| +(_:_:) +# 374| .+(_:_:) #-----| -> Int.Type # 374| Int.Type -#-----| -> call to +(_:_:) - -# 374| call to +(_:_:) -#-----| -> +(_:_:) +#-----| -> .+(_:_:) # 374| (...) #-----| -> .0 # 374| .0 -#-----| -> ... call to +(_:_:) ... +#-----| -> ... .+(_:_:) ... # 374| 1 #-----| -> 2 diff --git a/swift/ql/test/library-tests/controlflow/graph/cfg.swift b/swift/ql/test/library-tests/controlflow/graph/cfg.swift index 166f6ecafdc..76e88c7d55d 100644 --- a/swift/ql/test/library-tests/controlflow/graph/cfg.swift +++ b/swift/ql/test/library-tests/controlflow/graph/cfg.swift @@ -398,7 +398,7 @@ class Structors { deinit { field = 0 - } + } } func dictionaryLiteral(x: Int, y: Int) -> [String: Int] { @@ -462,4 +462,4 @@ func test(a : A) { var apply_kpGet_bs_0_x = a[keyPath: kpGet_bs_0_x] var apply_kpGet_mayB_force_x = a[keyPath: kpGet_mayB_force_x] var apply_kpGet_mayB_x = a[keyPath: kpGet_mayB_x] -} \ No newline at end of file +} diff --git a/swift/ql/test/library-tests/dataflow/taint/LocalTaint.expected b/swift/ql/test/library-tests/dataflow/taint/LocalTaint.expected index a7c44e9b566..e734b36c2dc 100644 --- a/swift/ql/test/library-tests/dataflow/taint/LocalTaint.expected +++ b/swift/ql/test/library-tests/dataflow/taint/LocalTaint.expected @@ -1,131 +1,100 @@ | data.swift:12:6:12:6 | WriteDef | data.swift:16:12:16:12 | dataClean | -| data.swift:12:18:12:36 | call to ... | data.swift:12:6:12:6 | WriteDef | +| data.swift:12:18:12:36 | call to init | data.swift:12:6:12:6 | WriteDef | | data.swift:13:6:13:6 | WriteDef | data.swift:14:26:14:26 | dataTainted | -| data.swift:13:20:13:38 | call to ... | data.swift:13:6:13:6 | WriteDef | +| data.swift:13:20:13:38 | call to init | data.swift:13:6:13:6 | WriteDef | | data.swift:14:6:14:6 | WriteDef | data.swift:18:12:18:12 | dataTainted2 | -| data.swift:14:21:14:37 | call to ... | data.swift:14:6:14:6 | WriteDef | +| data.swift:14:21:14:37 | call to init | data.swift:14:6:14:6 | WriteDef | | data.swift:14:26:14:26 | dataTainted | data.swift:17:12:17:12 | dataTainted | | data.swift:16:12:16:12 | dataClean | data.swift:20:33:20:33 | dataClean | -| file://:0:0:0:0 | Phi | string.swift:7:14:7:14 | $interpolation | -| file://:0:0:0:0 | Phi | string.swift:9:14:9:14 | $interpolation | -| file://:0:0:0:0 | Phi | string.swift:11:14:11:14 | $interpolation | -| file://:0:0:0:0 | Phi | string.swift:14:14:14:14 | $interpolation | -| file://:0:0:0:0 | Phi | string.swift:16:14:16:14 | $interpolation | -| file://:0:0:0:0 | Phi | string.swift:18:14:18:14 | $interpolation | -| file://:0:0:0:0 | Phi | string.swift:21:14:21:14 | $interpolation | | string.swift:5:7:5:7 | WriteDef | string.swift:7:16:7:16 | x | | string.swift:5:11:5:18 | call to source() | string.swift:5:7:5:7 | WriteDef | -| string.swift:7:13:7:13 | WriteDef | file://:0:0:0:0 | Phi | +| string.swift:7:13:7:13 | WriteDef | string.swift:7:14:7:14 | Phi | +| string.swift:7:14:7:13 | WriteDef | string.swift:7:15:7:15 | $interpolation | | string.swift:7:14:7:14 | $interpolation | string.swift:7:14:7:14 | &... | -| string.swift:7:14:7:14 | : &... | string.swift:7:14:7:14 | WriteDef | -| string.swift:7:14:7:14 | WriteDef | string.swift:7:15:7:15 | $interpolation | +| string.swift:7:14:7:14 | Phi | string.swift:7:14:7:14 | $interpolation | | string.swift:7:15:7:15 | $interpolation | string.swift:7:15:7:15 | &... | -| string.swift:7:15:7:15 | : &... | string.swift:7:15:7:15 | WriteDef | -| string.swift:7:15:7:15 | WriteDef | string.swift:7:18:7:18 | $interpolation | +| string.swift:7:15:7:17 | WriteDef | string.swift:7:18:7:18 | $interpolation | | string.swift:7:16:7:16 | x | string.swift:9:16:9:16 | x | | string.swift:7:18:7:18 | $interpolation | string.swift:7:18:7:18 | &... | -| string.swift:7:18:7:18 | : &... | string.swift:7:18:7:18 | WriteDef | | string.swift:7:18:7:18 | WriteDef | string.swift:7:13:7:13 | TapExpr | -| string.swift:9:13:9:13 | WriteDef | file://:0:0:0:0 | Phi | +| string.swift:9:13:9:13 | WriteDef | string.swift:9:14:9:14 | Phi | +| string.swift:9:14:9:13 | WriteDef | string.swift:9:15:9:15 | $interpolation | | string.swift:9:14:9:14 | $interpolation | string.swift:9:14:9:14 | &... | -| string.swift:9:14:9:14 | : &... | string.swift:9:14:9:14 | WriteDef | -| string.swift:9:14:9:14 | WriteDef | string.swift:9:15:9:15 | $interpolation | +| string.swift:9:14:9:14 | Phi | string.swift:9:14:9:14 | $interpolation | | string.swift:9:15:9:15 | $interpolation | string.swift:9:15:9:15 | &... | -| string.swift:9:15:9:15 | : &... | string.swift:9:15:9:15 | WriteDef | -| string.swift:9:15:9:15 | WriteDef | string.swift:9:18:9:18 | $interpolation | +| string.swift:9:15:9:17 | WriteDef | string.swift:9:18:9:18 | $interpolation | | string.swift:9:16:9:16 | x | string.swift:9:21:9:21 | x | | string.swift:9:18:9:18 | $interpolation | string.swift:9:18:9:18 | &... | -| string.swift:9:18:9:18 | : &... | string.swift:9:18:9:18 | WriteDef | | string.swift:9:18:9:18 | WriteDef | string.swift:9:20:9:20 | $interpolation | | string.swift:9:20:9:20 | $interpolation | string.swift:9:20:9:20 | &... | -| string.swift:9:20:9:20 | : &... | string.swift:9:20:9:20 | WriteDef | -| string.swift:9:20:9:20 | WriteDef | string.swift:9:23:9:23 | $interpolation | +| string.swift:9:20:9:22 | WriteDef | string.swift:9:23:9:23 | $interpolation | | string.swift:9:21:9:21 | x | string.swift:11:16:11:16 | x | | string.swift:9:23:9:23 | $interpolation | string.swift:9:23:9:23 | &... | -| string.swift:9:23:9:23 | : &... | string.swift:9:23:9:23 | WriteDef | | string.swift:9:23:9:23 | WriteDef | string.swift:9:13:9:13 | TapExpr | -| string.swift:11:13:11:13 | WriteDef | file://:0:0:0:0 | Phi | +| string.swift:11:13:11:13 | WriteDef | string.swift:11:14:11:14 | Phi | +| string.swift:11:14:11:13 | WriteDef | string.swift:11:15:11:15 | $interpolation | | string.swift:11:14:11:14 | $interpolation | string.swift:11:14:11:14 | &... | -| string.swift:11:14:11:14 | : &... | string.swift:11:14:11:14 | WriteDef | -| string.swift:11:14:11:14 | WriteDef | string.swift:11:15:11:15 | $interpolation | +| string.swift:11:14:11:14 | Phi | string.swift:11:14:11:14 | $interpolation | | string.swift:11:15:11:15 | $interpolation | string.swift:11:15:11:15 | &... | -| string.swift:11:15:11:15 | : &... | string.swift:11:15:11:15 | WriteDef | -| string.swift:11:15:11:15 | WriteDef | string.swift:11:18:11:18 | $interpolation | +| string.swift:11:15:11:17 | WriteDef | string.swift:11:18:11:18 | $interpolation | | string.swift:11:16:11:16 | x | string.swift:11:26:11:26 | x | | string.swift:11:18:11:18 | $interpolation | string.swift:11:18:11:18 | &... | -| string.swift:11:18:11:18 | : &... | string.swift:11:18:11:18 | WriteDef | | string.swift:11:18:11:18 | WriteDef | string.swift:11:20:11:20 | $interpolation | | string.swift:11:20:11:20 | $interpolation | string.swift:11:20:11:20 | &... | -| string.swift:11:20:11:20 | : &... | string.swift:11:20:11:20 | WriteDef | -| string.swift:11:20:11:20 | WriteDef | string.swift:11:23:11:23 | $interpolation | +| string.swift:11:20:11:22 | WriteDef | string.swift:11:23:11:23 | $interpolation | | string.swift:11:23:11:23 | $interpolation | string.swift:11:23:11:23 | &... | -| string.swift:11:23:11:23 | : &... | string.swift:11:23:11:23 | WriteDef | | string.swift:11:23:11:23 | WriteDef | string.swift:11:25:11:25 | $interpolation | | string.swift:11:25:11:25 | $interpolation | string.swift:11:25:11:25 | &... | -| string.swift:11:25:11:25 | : &... | string.swift:11:25:11:25 | WriteDef | -| string.swift:11:25:11:25 | WriteDef | string.swift:11:28:11:28 | $interpolation | +| string.swift:11:25:11:27 | WriteDef | string.swift:11:28:11:28 | $interpolation | | string.swift:11:26:11:26 | x | string.swift:16:16:16:16 | x | | string.swift:11:28:11:28 | $interpolation | string.swift:11:28:11:28 | &... | -| string.swift:11:28:11:28 | : &... | string.swift:11:28:11:28 | WriteDef | | string.swift:11:28:11:28 | WriteDef | string.swift:11:13:11:13 | TapExpr | | string.swift:13:7:13:7 | WriteDef | string.swift:14:16:14:16 | y | | string.swift:13:11:13:11 | 42 | string.swift:13:7:13:7 | WriteDef | -| string.swift:14:13:14:13 | WriteDef | file://:0:0:0:0 | Phi | +| string.swift:14:13:14:13 | WriteDef | string.swift:14:14:14:14 | Phi | +| string.swift:14:14:14:13 | WriteDef | string.swift:14:15:14:15 | $interpolation | | string.swift:14:14:14:14 | $interpolation | string.swift:14:14:14:14 | &... | -| string.swift:14:14:14:14 | : &... | string.swift:14:14:14:14 | WriteDef | -| string.swift:14:14:14:14 | WriteDef | string.swift:14:15:14:15 | $interpolation | +| string.swift:14:14:14:14 | Phi | string.swift:14:14:14:14 | $interpolation | | string.swift:14:15:14:15 | $interpolation | string.swift:14:15:14:15 | &... | -| string.swift:14:15:14:15 | : &... | string.swift:14:15:14:15 | WriteDef | -| string.swift:14:15:14:15 | WriteDef | string.swift:14:18:14:18 | $interpolation | +| string.swift:14:15:14:17 | WriteDef | string.swift:14:18:14:18 | $interpolation | | string.swift:14:16:14:16 | y | string.swift:16:27:16:27 | y | | string.swift:14:18:14:18 | $interpolation | string.swift:14:18:14:18 | &... | -| string.swift:14:18:14:18 | : &... | string.swift:14:18:14:18 | WriteDef | | string.swift:14:18:14:18 | WriteDef | string.swift:14:13:14:13 | TapExpr | -| string.swift:16:13:16:13 | WriteDef | file://:0:0:0:0 | Phi | +| string.swift:16:13:16:13 | WriteDef | string.swift:16:14:16:14 | Phi | +| string.swift:16:14:16:13 | WriteDef | string.swift:16:15:16:15 | $interpolation | | string.swift:16:14:16:14 | $interpolation | string.swift:16:14:16:14 | &... | -| string.swift:16:14:16:14 | : &... | string.swift:16:14:16:14 | WriteDef | -| string.swift:16:14:16:14 | WriteDef | string.swift:16:15:16:15 | $interpolation | +| string.swift:16:14:16:14 | Phi | string.swift:16:14:16:14 | $interpolation | | string.swift:16:15:16:15 | $interpolation | string.swift:16:15:16:15 | &... | -| string.swift:16:15:16:15 | : &... | string.swift:16:15:16:15 | WriteDef | -| string.swift:16:15:16:15 | WriteDef | string.swift:16:18:16:18 | $interpolation | +| string.swift:16:15:16:17 | WriteDef | string.swift:16:18:16:18 | $interpolation | | string.swift:16:16:16:16 | x | string.swift:18:27:18:27 | x | | string.swift:16:18:16:18 | $interpolation | string.swift:16:18:16:18 | &... | -| string.swift:16:18:16:18 | : &... | string.swift:16:18:16:18 | WriteDef | | string.swift:16:18:16:18 | WriteDef | string.swift:16:26:16:26 | $interpolation | | string.swift:16:26:16:26 | $interpolation | string.swift:16:26:16:26 | &... | -| string.swift:16:26:16:26 | : &... | string.swift:16:26:16:26 | WriteDef | -| string.swift:16:26:16:26 | WriteDef | string.swift:16:29:16:29 | $interpolation | +| string.swift:16:26:16:28 | WriteDef | string.swift:16:29:16:29 | $interpolation | | string.swift:16:27:16:27 | y | string.swift:18:16:18:16 | y | | string.swift:16:29:16:29 | $interpolation | string.swift:16:29:16:29 | &... | -| string.swift:16:29:16:29 | : &... | string.swift:16:29:16:29 | WriteDef | | string.swift:16:29:16:29 | WriteDef | string.swift:16:13:16:13 | TapExpr | -| string.swift:18:13:18:13 | WriteDef | file://:0:0:0:0 | Phi | +| string.swift:18:13:18:13 | WriteDef | string.swift:18:14:18:14 | Phi | +| string.swift:18:14:18:13 | WriteDef | string.swift:18:15:18:15 | $interpolation | | string.swift:18:14:18:14 | $interpolation | string.swift:18:14:18:14 | &... | -| string.swift:18:14:18:14 | : &... | string.swift:18:14:18:14 | WriteDef | -| string.swift:18:14:18:14 | WriteDef | string.swift:18:15:18:15 | $interpolation | +| string.swift:18:14:18:14 | Phi | string.swift:18:14:18:14 | $interpolation | | string.swift:18:15:18:15 | $interpolation | string.swift:18:15:18:15 | &... | -| string.swift:18:15:18:15 | : &... | string.swift:18:15:18:15 | WriteDef | -| string.swift:18:15:18:15 | WriteDef | string.swift:18:18:18:18 | $interpolation | +| string.swift:18:15:18:17 | WriteDef | string.swift:18:18:18:18 | $interpolation | | string.swift:18:18:18:18 | $interpolation | string.swift:18:18:18:18 | &... | -| string.swift:18:18:18:18 | : &... | string.swift:18:18:18:18 | WriteDef | | string.swift:18:18:18:18 | WriteDef | string.swift:18:26:18:26 | $interpolation | | string.swift:18:26:18:26 | $interpolation | string.swift:18:26:18:26 | &... | -| string.swift:18:26:18:26 | : &... | string.swift:18:26:18:26 | WriteDef | -| string.swift:18:26:18:26 | WriteDef | string.swift:18:29:18:29 | $interpolation | +| string.swift:18:26:18:28 | WriteDef | string.swift:18:29:18:29 | $interpolation | | string.swift:18:29:18:29 | $interpolation | string.swift:18:29:18:29 | &... | -| string.swift:18:29:18:29 | : &... | string.swift:18:29:18:29 | WriteDef | | string.swift:18:29:18:29 | WriteDef | string.swift:18:13:18:13 | TapExpr | | string.swift:20:3:20:7 | WriteDef | string.swift:21:16:21:16 | x | | string.swift:20:7:20:7 | 0 | string.swift:20:3:20:7 | WriteDef | -| string.swift:21:13:21:13 | WriteDef | file://:0:0:0:0 | Phi | +| string.swift:21:13:21:13 | WriteDef | string.swift:21:14:21:14 | Phi | +| string.swift:21:14:21:13 | WriteDef | string.swift:21:15:21:15 | $interpolation | | string.swift:21:14:21:14 | $interpolation | string.swift:21:14:21:14 | &... | -| string.swift:21:14:21:14 | : &... | string.swift:21:14:21:14 | WriteDef | -| string.swift:21:14:21:14 | WriteDef | string.swift:21:15:21:15 | $interpolation | +| string.swift:21:14:21:14 | Phi | string.swift:21:14:21:14 | $interpolation | | string.swift:21:15:21:15 | $interpolation | string.swift:21:15:21:15 | &... | -| string.swift:21:15:21:15 | : &... | string.swift:21:15:21:15 | WriteDef | -| string.swift:21:15:21:15 | WriteDef | string.swift:21:18:21:18 | $interpolation | +| string.swift:21:15:21:17 | WriteDef | string.swift:21:18:21:18 | $interpolation | | string.swift:21:18:21:18 | $interpolation | string.swift:21:18:21:18 | &... | -| string.swift:21:18:21:18 | : &... | string.swift:21:18:21:18 | WriteDef | | string.swift:21:18:21:18 | WriteDef | string.swift:21:13:21:13 | TapExpr | | string.swift:27:7:27:7 | WriteDef | string.swift:30:13:30:13 | clean | | string.swift:27:15:27:15 | abcdef | string.swift:27:7:27:7 | WriteDef | @@ -154,20 +123,17 @@ | string.swift:51:7:51:7 | WriteDef | string.swift:53:13:53:13 | str2 | | string.swift:51:14:51:14 | abc | string.swift:51:7:51:7 | WriteDef | | string.swift:53:13:53:13 | str2 | string.swift:55:3:55:3 | str2 | -| string.swift:55:3:55:3 | : &... | string.swift:55:3:55:8 | WriteDef | | string.swift:55:3:55:3 | str2 | string.swift:55:3:55:3 | &... | -| string.swift:55:3:55:8 | WriteDef | string.swift:56:13:56:13 | str2 | +| string.swift:55:3:55:20 | WriteDef | string.swift:56:13:56:13 | str2 | | string.swift:56:13:56:13 | str2 | string.swift:58:3:58:3 | str2 | -| string.swift:58:3:58:3 | : &... | string.swift:58:3:58:8 | WriteDef | | string.swift:58:3:58:3 | str2 | string.swift:58:3:58:3 | &... | -| string.swift:58:3:58:8 | WriteDef | string.swift:59:13:59:13 | str2 | +| string.swift:58:3:58:24 | WriteDef | string.swift:59:13:59:13 | str2 | | string.swift:59:13:59:13 | str2 | string.swift:69:13:69:13 | str2 | | string.swift:61:7:61:7 | WriteDef | string.swift:63:13:63:13 | str3 | | string.swift:61:14:61:14 | abc | string.swift:61:7:61:7 | WriteDef | | string.swift:63:13:63:13 | str3 | string.swift:65:3:65:3 | str3 | -| string.swift:65:3:65:3 | : &... | string.swift:65:3:65:8 | WriteDef | | string.swift:65:3:65:3 | str3 | string.swift:65:3:65:3 | &... | -| string.swift:65:3:65:8 | WriteDef | string.swift:66:13:66:13 | str3 | +| string.swift:65:3:65:32 | WriteDef | string.swift:66:13:66:13 | str3 | | string.swift:66:13:66:13 | str3 | string.swift:68:3:68:3 | str3 | | string.swift:68:3:68:3 | str3 | string.swift:68:3:68:3 | &... | | string.swift:73:7:73:7 | WriteDef | string.swift:77:20:77:20 | clean | @@ -195,28 +161,28 @@ | url.swift:13:6:13:6 | WriteDef | url.swift:15:31:15:31 | tainted | | url.swift:13:16:13:23 | call to source() | url.swift:13:6:13:6 | WriteDef | | url.swift:14:6:14:6 | WriteDef | url.swift:17:12:17:12 | urlClean | -| url.swift:14:17:14:34 | call to ... | url.swift:14:17:14:35 | ...! | +| url.swift:14:17:14:34 | call to init | url.swift:14:17:14:35 | ...! | | url.swift:14:17:14:35 | ...! | url.swift:14:6:14:6 | WriteDef | | url.swift:14:29:14:29 | clean | url.swift:20:24:20:24 | clean | | url.swift:15:6:15:6 | WriteDef | url.swift:18:12:18:12 | urlTainted | -| url.swift:15:19:15:38 | call to ... | url.swift:15:19:15:39 | ...! | +| url.swift:15:19:15:38 | call to init | url.swift:15:19:15:39 | ...! | | url.swift:15:19:15:39 | ...! | url.swift:15:6:15:6 | WriteDef | | url.swift:15:31:15:31 | tainted | url.swift:21:24:21:24 | tainted | | url.swift:17:12:17:12 | urlClean | url.swift:22:43:22:43 | urlClean | | url.swift:18:12:18:12 | urlTainted | url.swift:23:43:23:43 | urlTainted | -| url.swift:20:12:20:46 | call to ... | url.swift:20:12:20:47 | ...! | +| url.swift:20:12:20:46 | call to init | url.swift:20:12:20:47 | ...! | | url.swift:20:24:20:24 | clean | url.swift:22:24:22:24 | clean | -| url.swift:21:12:21:48 | call to ... | url.swift:21:12:21:49 | ...! | +| url.swift:21:12:21:48 | call to init | url.swift:21:12:21:49 | ...! | | url.swift:21:24:21:24 | tainted | url.swift:29:25:29:25 | tainted | -| url.swift:22:12:22:51 | call to ... | url.swift:22:12:22:52 | ...! | +| url.swift:22:12:22:51 | call to init | url.swift:22:12:22:52 | ...! | | url.swift:22:24:22:24 | clean | url.swift:23:24:23:24 | clean | -| url.swift:23:12:23:53 | call to ... | url.swift:23:12:23:54 | ...! | +| url.swift:23:12:23:53 | call to init | url.swift:23:12:23:54 | ...! | | url.swift:23:24:23:24 | clean | url.swift:25:25:25:25 | clean | | url.swift:25:25:25:25 | clean | url.swift:34:26:34:26 | clean | | url.swift:29:25:29:25 | tainted | url.swift:38:28:38:28 | tainted | | url.swift:34:2:34:31 | WriteDef | url.swift:35:12:35:12 | urlClean2 | -| url.swift:34:14:34:31 | call to ... | url.swift:34:2:34:31 | WriteDef | +| url.swift:34:14:34:31 | call to init | url.swift:34:2:34:31 | WriteDef | | url.swift:35:12:35:12 | urlClean2 | url.swift:35:12:35:12 | ...! | | url.swift:38:2:38:35 | WriteDef | url.swift:39:12:39:12 | urlTainted2 | -| url.swift:38:16:38:35 | call to ... | url.swift:38:2:38:35 | WriteDef | +| url.swift:38:16:38:35 | call to init | url.swift:38:2:38:35 | WriteDef | | url.swift:39:12:39:12 | urlTainted2 | url.swift:39:12:39:12 | ...! | diff --git a/swift/ql/test/library-tests/dataflow/taint/Taint.expected b/swift/ql/test/library-tests/dataflow/taint/Taint.expected index dbfb89540bf..e8532ed6d9d 100644 --- a/swift/ql/test/library-tests/dataflow/taint/Taint.expected +++ b/swift/ql/test/library-tests/dataflow/taint/Taint.expected @@ -5,10 +5,10 @@ edges | string.swift:5:11:5:18 | call to source() : | string.swift:16:13:16:13 | "..." | | string.swift:5:11:5:18 | call to source() : | string.swift:18:13:18:13 | "..." | | string.swift:28:17:28:25 | call to source2() : | string.swift:31:13:31:13 | tainted | -| string.swift:28:17:28:25 | call to source2() : | string.swift:34:13:34:21 | ... call to +(_:_:) ... | -| string.swift:28:17:28:25 | call to source2() : | string.swift:35:13:35:23 | ... call to +(_:_:) ... | -| string.swift:28:17:28:25 | call to source2() : | string.swift:36:13:36:23 | ... call to +(_:_:) ... | -| string.swift:28:17:28:25 | call to source2() : | string.swift:39:13:39:29 | ... call to +(_:_:) ... | +| string.swift:28:17:28:25 | call to source2() : | string.swift:34:13:34:21 | ... .+(_:_:) ... | +| string.swift:28:17:28:25 | call to source2() : | string.swift:35:13:35:23 | ... .+(_:_:) ... | +| string.swift:28:17:28:25 | call to source2() : | string.swift:36:13:36:23 | ... .+(_:_:) ... | +| string.swift:28:17:28:25 | call to source2() : | string.swift:39:13:39:29 | ... .+(_:_:) ... | | try.swift:9:17:9:24 | call to source() : | try.swift:9:13:9:24 | try ... | | try.swift:15:17:15:24 | call to source() : | try.swift:15:12:15:24 | try! ... | | try.swift:18:18:18:25 | call to source() : | try.swift:18:12:18:27 | ...! | @@ -25,10 +25,10 @@ nodes | string.swift:18:13:18:13 | "..." | semmle.label | "..." | | string.swift:28:17:28:25 | call to source2() : | semmle.label | call to source2() : | | string.swift:31:13:31:13 | tainted | semmle.label | tainted | -| string.swift:34:13:34:21 | ... call to +(_:_:) ... | semmle.label | ... call to +(_:_:) ... | -| string.swift:35:13:35:23 | ... call to +(_:_:) ... | semmle.label | ... call to +(_:_:) ... | -| string.swift:36:13:36:23 | ... call to +(_:_:) ... | semmle.label | ... call to +(_:_:) ... | -| string.swift:39:13:39:29 | ... call to +(_:_:) ... | semmle.label | ... call to +(_:_:) ... | +| string.swift:34:13:34:21 | ... .+(_:_:) ... | semmle.label | ... .+(_:_:) ... | +| string.swift:35:13:35:23 | ... .+(_:_:) ... | semmle.label | ... .+(_:_:) ... | +| string.swift:36:13:36:23 | ... .+(_:_:) ... | semmle.label | ... .+(_:_:) ... | +| string.swift:39:13:39:29 | ... .+(_:_:) ... | semmle.label | ... .+(_:_:) ... | | try.swift:9:13:9:24 | try ... | semmle.label | try ... | | try.swift:9:17:9:24 | call to source() : | semmle.label | call to source() : | | try.swift:15:12:15:24 | try! ... | semmle.label | try! ... | @@ -48,10 +48,10 @@ subpaths | string.swift:16:13:16:13 | "..." | string.swift:5:11:5:18 | call to source() : | string.swift:16:13:16:13 | "..." | result | | string.swift:18:13:18:13 | "..." | string.swift:5:11:5:18 | call to source() : | string.swift:18:13:18:13 | "..." | result | | string.swift:31:13:31:13 | tainted | string.swift:28:17:28:25 | call to source2() : | string.swift:31:13:31:13 | tainted | result | -| string.swift:34:13:34:21 | ... call to +(_:_:) ... | string.swift:28:17:28:25 | call to source2() : | string.swift:34:13:34:21 | ... call to +(_:_:) ... | result | -| string.swift:35:13:35:23 | ... call to +(_:_:) ... | string.swift:28:17:28:25 | call to source2() : | string.swift:35:13:35:23 | ... call to +(_:_:) ... | result | -| string.swift:36:13:36:23 | ... call to +(_:_:) ... | string.swift:28:17:28:25 | call to source2() : | string.swift:36:13:36:23 | ... call to +(_:_:) ... | result | -| string.swift:39:13:39:29 | ... call to +(_:_:) ... | string.swift:28:17:28:25 | call to source2() : | string.swift:39:13:39:29 | ... call to +(_:_:) ... | result | +| string.swift:34:13:34:21 | ... .+(_:_:) ... | string.swift:28:17:28:25 | call to source2() : | string.swift:34:13:34:21 | ... .+(_:_:) ... | result | +| string.swift:35:13:35:23 | ... .+(_:_:) ... | string.swift:28:17:28:25 | call to source2() : | string.swift:35:13:35:23 | ... .+(_:_:) ... | result | +| string.swift:36:13:36:23 | ... .+(_:_:) ... | string.swift:28:17:28:25 | call to source2() : | string.swift:36:13:36:23 | ... .+(_:_:) ... | result | +| string.swift:39:13:39:29 | ... .+(_:_:) ... | string.swift:28:17:28:25 | call to source2() : | string.swift:39:13:39:29 | ... .+(_:_:) ... | result | | try.swift:9:13:9:24 | try ... | try.swift:9:17:9:24 | call to source() : | try.swift:9:13:9:24 | try ... | result | | try.swift:15:12:15:24 | try! ... | try.swift:15:17:15:24 | call to source() : | try.swift:15:12:15:24 | try! ... | result | | try.swift:18:12:18:27 | ...! | try.swift:18:18:18:25 | call to source() : | try.swift:18:12:18:27 | ...! | result | diff --git a/swift/ql/test/library-tests/dataflow/taint/string.swift b/swift/ql/test/library-tests/dataflow/taint/string.swift index fe0425baa0b..6f5e5876a65 100644 --- a/swift/ql/test/library-tests/dataflow/taint/string.swift +++ b/swift/ql/test/library-tests/dataflow/taint/string.swift @@ -3,7 +3,7 @@ func sink(arg: String) {} func taintThroughInterpolatedStrings() { var x = source() - + sink(arg: "\(x)") // $ tainted=5 sink(arg: "\(x) \(x)") // $ tainted=5 @@ -83,7 +83,7 @@ func taintThroughStringOperations() { sink(arg: clean.description) sink(arg: tainted.description) // $ MISSING: tainted=74 - + sink(arg: clean.debugDescription) sink(arg: tainted.debugDescription) // $ MISSING: tainted=74 } diff --git a/swift/ql/test/library-tests/elements/expr/arithmeticoperation/arithmeticoperation.expected b/swift/ql/test/library-tests/elements/expr/arithmeticoperation/arithmeticoperation.expected index 3d20366aec6..248df8d5d40 100644 --- a/swift/ql/test/library-tests/elements/expr/arithmeticoperation/arithmeticoperation.expected +++ b/swift/ql/test/library-tests/elements/expr/arithmeticoperation/arithmeticoperation.expected @@ -1,6 +1,6 @@ -| arithmeticoperation.swift:6:6:6:10 | ... call to +(_:_:) ... | AddExpr, BinaryArithmeticOperation | -| arithmeticoperation.swift:7:6:7:10 | ... call to -(_:_:) ... | BinaryArithmeticOperation, SubExpr | -| arithmeticoperation.swift:8:6:8:10 | ... call to *(_:_:) ... | BinaryArithmeticOperation, MulExpr | -| arithmeticoperation.swift:9:6:9:10 | ... call to /(_:_:) ... | BinaryArithmeticOperation, DivExpr | -| arithmeticoperation.swift:10:6:10:10 | ... call to %(_:_:) ... | BinaryArithmeticOperation, RemExpr | -| arithmeticoperation.swift:11:6:11:7 | call to ... | UnaryArithmeticOperation, UnaryMinusExpr | +| arithmeticoperation.swift:6:6:6:10 | ... .+(_:_:) ... | AddExpr, BinaryArithmeticOperation | +| arithmeticoperation.swift:7:6:7:10 | ... .-(_:_:) ... | BinaryArithmeticOperation, SubExpr | +| arithmeticoperation.swift:8:6:8:10 | ... .*(_:_:) ... | BinaryArithmeticOperation, MulExpr | +| arithmeticoperation.swift:9:6:9:10 | ... ./(_:_:) ... | BinaryArithmeticOperation, DivExpr | +| arithmeticoperation.swift:10:6:10:10 | ... .%(_:_:) ... | BinaryArithmeticOperation, RemExpr | +| arithmeticoperation.swift:11:6:11:7 | call to -(_:) | UnaryArithmeticOperation, UnaryMinusExpr | diff --git a/swift/ql/test/library-tests/elements/expr/logicaloperation/logicaloperation.expected b/swift/ql/test/library-tests/elements/expr/logicaloperation/logicaloperation.expected index 1b3ccaab17f..6092826ef8f 100644 --- a/swift/ql/test/library-tests/elements/expr/logicaloperation/logicaloperation.expected +++ b/swift/ql/test/library-tests/elements/expr/logicaloperation/logicaloperation.expected @@ -1,6 +1,6 @@ -| logicaloperation.swift:4:6:4:11 | ... call to &&(_:_:) ... | BinaryLogicalExpr, LogicalAndExpr | -| logicaloperation.swift:5:6:5:11 | ... call to \|\|(_:_:) ... | BinaryLogicalExpr, LogicalOrExpr | -| logicaloperation.swift:6:6:6:7 | call to ... | NotExpr, UnaryLogicalOperation | -| logicaloperation.swift:7:6:7:21 | call to ... | NotExpr, UnaryLogicalOperation | -| logicaloperation.swift:7:8:7:20 | ... call to \|\|(_:_:) ... | BinaryLogicalExpr, LogicalOrExpr | -| logicaloperation.swift:7:9:7:14 | ... call to &&(_:_:) ... | BinaryLogicalExpr, LogicalAndExpr | +| logicaloperation.swift:4:6:4:11 | ... .&&(_:_:) ... | BinaryLogicalExpr, LogicalAndExpr | +| logicaloperation.swift:5:6:5:11 | ... .\|\|(_:_:) ... | BinaryLogicalExpr, LogicalOrExpr | +| logicaloperation.swift:6:6:6:7 | call to !(_:) | NotExpr, UnaryLogicalOperation | +| logicaloperation.swift:7:6:7:21 | call to !(_:) | NotExpr, UnaryLogicalOperation | +| logicaloperation.swift:7:8:7:20 | ... .\|\|(_:_:) ... | BinaryLogicalExpr, LogicalOrExpr | +| logicaloperation.swift:7:9:7:14 | ... .&&(_:_:) ... | BinaryLogicalExpr, LogicalAndExpr | diff --git a/swift/ql/test/library-tests/parent/parent.expected b/swift/ql/test/library-tests/parent/parent.expected index 28a1e0a35ec..aad9dd63b0c 100644 --- a/swift/ql/test/library-tests/parent/parent.expected +++ b/swift/ql/test/library-tests/parent/parent.expected @@ -25,20 +25,18 @@ | declarations.swift:3:7:3:14 | ... as ... | TypedPattern | declarations.swift:3:14:3:14 | Int | TypeRepr | | declarations.swift:4:5:4:24 | get | AccessorDecl | declarations.swift:4:9:4:24 | { ... } | BraceStmt | | declarations.swift:4:9:4:24 | { ... } | BraceStmt | declarations.swift:4:11:4:22 | return ... | ReturnStmt | -| declarations.swift:4:11:4:22 | return ... | ReturnStmt | declarations.swift:4:18:4:22 | ... call to +(_:_:) ... | BinaryExpr | +| declarations.swift:4:11:4:22 | return ... | ReturnStmt | declarations.swift:4:18:4:22 | ... .+(_:_:) ... | BinaryExpr | | declarations.swift:4:18:4:18 | .x | MemberRefExpr | declarations.swift:4:18:4:18 | self | DeclRefExpr | -| declarations.swift:4:18:4:22 | ... call to +(_:_:) ... | BinaryExpr | declarations.swift:4:20:4:20 | call to +(_:_:) | DotSyntaxCallExpr | +| declarations.swift:4:18:4:22 | ... .+(_:_:) ... | BinaryExpr | declarations.swift:4:20:4:20 | .+(_:_:) | MethodRefExpr | | declarations.swift:4:20:4:20 | Int.Type | TypeExpr | declarations.swift:4:20:4:20 | Int | TypeRepr | -| declarations.swift:4:20:4:20 | call to +(_:_:) | DotSyntaxCallExpr | declarations.swift:4:20:4:20 | +(_:_:) | DeclRefExpr | | declarations.swift:5:5:5:38 | set | AccessorDecl | declarations.swift:5:9:5:9 | newValue | ParamDecl | | declarations.swift:5:5:5:38 | set | AccessorDecl | declarations.swift:5:19:5:38 | { ... } | BraceStmt | | declarations.swift:5:19:5:38 | { ... } | BraceStmt | declarations.swift:5:21:5:36 | ... = ... | AssignExpr | | declarations.swift:5:21:5:21 | .x | MemberRefExpr | declarations.swift:5:21:5:21 | self | DeclRefExpr | | declarations.swift:5:21:5:36 | ... = ... | AssignExpr | declarations.swift:5:21:5:21 | .x | MemberRefExpr | -| declarations.swift:5:21:5:36 | ... = ... | AssignExpr | declarations.swift:5:25:5:36 | ... call to -(_:_:) ... | BinaryExpr | -| declarations.swift:5:25:5:36 | ... call to -(_:_:) ... | BinaryExpr | declarations.swift:5:34:5:34 | call to -(_:_:) | DotSyntaxCallExpr | +| declarations.swift:5:21:5:36 | ... = ... | AssignExpr | declarations.swift:5:25:5:36 | ... .-(_:_:) ... | BinaryExpr | +| declarations.swift:5:25:5:36 | ... .-(_:_:) ... | BinaryExpr | declarations.swift:5:34:5:34 | .-(_:_:) | MethodRefExpr | | declarations.swift:5:34:5:34 | Int.Type | TypeExpr | declarations.swift:5:34:5:34 | Int | TypeRepr | -| declarations.swift:5:34:5:34 | call to -(_:_:) | DotSyntaxCallExpr | declarations.swift:5:34:5:34 | -(_:_:) | DeclRefExpr | | declarations.swift:9:7:9:7 | deinit | DestructorDecl | declarations.swift:9:7:9:7 | { ... } | BraceStmt | | declarations.swift:9:7:9:7 | init | ConstructorDecl | declarations.swift:9:7:9:7 | { ... } | BraceStmt | | declarations.swift:9:7:9:7 | { ... } | BraceStmt | declarations.swift:9:7:9:7 | return | ReturnStmt | @@ -148,7 +146,7 @@ | declarations.swift:76:19:79:1 | { ... } | BraceStmt | declarations.swift:77:20:77:20 | x | ConcreteVarDecl | | declarations.swift:76:19:79:1 | { ... } | BraceStmt | declarations.swift:78:3:78:10 | return ... | ReturnStmt | | declarations.swift:77:4:77:4 | ZeroWrapper.Type | TypeExpr | declarations.swift:77:4:77:4 | ZeroWrapper | TypeRepr | -| declarations.swift:77:4:77:4 | call to ... | CallExpr | declarations.swift:77:4:77:4 | call to init | ConstructorRefCallExpr | +| declarations.swift:77:4:77:4 | call to init | CallExpr | declarations.swift:77:4:77:4 | call to init | ConstructorRefCallExpr | | declarations.swift:77:4:77:4 | call to init | ConstructorRefCallExpr | declarations.swift:77:4:77:4 | init | DeclRefExpr | | declarations.swift:77:16:77:23 | var ... = ... | PatternBindingDecl | declarations.swift:77:20:77:23 | ... as ... | TypedPattern | | declarations.swift:77:20:77:20 | ... as ... | TypedPattern | declarations.swift:77:20:77:20 | _x | NamedPattern | @@ -241,7 +239,7 @@ | declarations.swift:115:7:115:7 | yield ... | YieldStmt | file://:0:0:0:0 | &... | InOutExpr | | declarations.swift:115:7:115:7 | { ... } | BraceStmt | declarations.swift:115:7:115:7 | yield ... | YieldStmt | | declarations.swift:115:7:115:7 | { ... } | BraceStmt | file://:0:0:0:0 | ... = ... | AssignExpr | -| declarations.swift:115:7:115:7 | { ... } | BraceStmt | file://:0:0:0:0 | call to ... | CallExpr | +| declarations.swift:115:7:115:7 | { ... } | BraceStmt | file://:0:0:0:0 | call to willSet | CallExpr | | declarations.swift:115:7:115:7 | { ... } | BraceStmt | file://:0:0:0:0 | return ... | ReturnStmt | | declarations.swift:115:7:115:21 | ... as ... | TypedPattern | declarations.swift:115:7:115:7 | hasWillSet1 | NamedPattern | | declarations.swift:115:7:115:21 | ... as ... | TypedPattern | declarations.swift:115:21:115:21 | Int | TypeRepr | @@ -259,7 +257,7 @@ | declarations.swift:119:7:119:7 | yield ... | YieldStmt | file://:0:0:0:0 | &... | InOutExpr | | declarations.swift:119:7:119:7 | { ... } | BraceStmt | declarations.swift:119:7:119:7 | yield ... | YieldStmt | | declarations.swift:119:7:119:7 | { ... } | BraceStmt | file://:0:0:0:0 | ... = ... | AssignExpr | -| declarations.swift:119:7:119:7 | { ... } | BraceStmt | file://:0:0:0:0 | call to ... | CallExpr | +| declarations.swift:119:7:119:7 | { ... } | BraceStmt | file://:0:0:0:0 | call to willSet | CallExpr | | declarations.swift:119:7:119:7 | { ... } | BraceStmt | file://:0:0:0:0 | return ... | ReturnStmt | | declarations.swift:119:7:119:21 | ... as ... | TypedPattern | declarations.swift:119:7:119:7 | hasWillSet2 | NamedPattern | | declarations.swift:119:7:119:21 | ... as ... | TypedPattern | declarations.swift:119:21:119:21 | Int | TypeRepr | @@ -277,7 +275,7 @@ | declarations.swift:123:7:123:7 | yield ... | YieldStmt | file://:0:0:0:0 | &... | InOutExpr | | declarations.swift:123:7:123:7 | { ... } | BraceStmt | declarations.swift:123:7:123:7 | yield ... | YieldStmt | | declarations.swift:123:7:123:7 | { ... } | BraceStmt | file://:0:0:0:0 | ... = ... | AssignExpr | -| declarations.swift:123:7:123:7 | { ... } | BraceStmt | file://:0:0:0:0 | call to ... | CallExpr | +| declarations.swift:123:7:123:7 | { ... } | BraceStmt | file://:0:0:0:0 | call to didSet | CallExpr | | declarations.swift:123:7:123:7 | { ... } | BraceStmt | file://:0:0:0:0 | return ... | ReturnStmt | | declarations.swift:123:7:123:7 | { ... } | BraceStmt | file://:0:0:0:0 | tmp | ConcreteVarDecl | | declarations.swift:123:7:123:7 | { ... } | BraceStmt | file://:0:0:0:0 | var ... = ... | PatternBindingDecl | @@ -297,8 +295,8 @@ | declarations.swift:127:7:127:7 | yield ... | YieldStmt | file://:0:0:0:0 | &... | InOutExpr | | declarations.swift:127:7:127:7 | { ... } | BraceStmt | declarations.swift:127:7:127:7 | yield ... | YieldStmt | | declarations.swift:127:7:127:7 | { ... } | BraceStmt | file://:0:0:0:0 | ... = ... | AssignExpr | -| declarations.swift:127:7:127:7 | { ... } | BraceStmt | file://:0:0:0:0 | call to ... | CallExpr | -| declarations.swift:127:7:127:7 | { ... } | BraceStmt | file://:0:0:0:0 | call to ... | CallExpr | +| declarations.swift:127:7:127:7 | { ... } | BraceStmt | file://:0:0:0:0 | call to didSet | CallExpr | +| declarations.swift:127:7:127:7 | { ... } | BraceStmt | file://:0:0:0:0 | call to didSet | CallExpr | | declarations.swift:127:7:127:7 | { ... } | BraceStmt | file://:0:0:0:0 | return ... | ReturnStmt | | declarations.swift:127:7:127:20 | ... as ... | TypedPattern | declarations.swift:127:7:127:7 | hasDidSet2 | NamedPattern | | declarations.swift:127:7:127:20 | ... as ... | TypedPattern | declarations.swift:127:20:127:20 | Int | TypeRepr | @@ -316,8 +314,8 @@ | declarations.swift:131:7:131:7 | yield ... | YieldStmt | file://:0:0:0:0 | &... | InOutExpr | | declarations.swift:131:7:131:7 | { ... } | BraceStmt | declarations.swift:131:7:131:7 | yield ... | YieldStmt | | declarations.swift:131:7:131:7 | { ... } | BraceStmt | file://:0:0:0:0 | ... = ... | AssignExpr | -| declarations.swift:131:7:131:7 | { ... } | BraceStmt | file://:0:0:0:0 | call to ... | CallExpr | -| declarations.swift:131:7:131:7 | { ... } | BraceStmt | file://:0:0:0:0 | call to ... | CallExpr | +| declarations.swift:131:7:131:7 | { ... } | BraceStmt | file://:0:0:0:0 | call to didSet | CallExpr | +| declarations.swift:131:7:131:7 | { ... } | BraceStmt | file://:0:0:0:0 | call to willSet | CallExpr | | declarations.swift:131:7:131:7 | { ... } | BraceStmt | file://:0:0:0:0 | return ... | ReturnStmt | | declarations.swift:131:7:131:17 | ... as ... | TypedPattern | declarations.swift:131:7:131:7 | hasBoth | NamedPattern | | declarations.swift:131:7:131:17 | ... as ... | TypedPattern | declarations.swift:131:17:131:17 | Int | TypeRepr | @@ -327,9 +325,8 @@ | declarations.swift:139:3:141:3 | id() | ConcreteFuncDecl | declarations.swift:139:20:141:3 | { ... } | BraceStmt | | declarations.swift:139:20:141:3 | { ... } | BraceStmt | declarations.swift:140:5:140:12 | return ... | ReturnStmt | | declarations.swift:140:5:140:12 | return ... | ReturnStmt | declarations.swift:140:12:140:12 | self | DeclRefExpr | -| declarations.swift:144:1:144:4 | call to id() | DotSyntaxCallExpr | declarations.swift:144:4:144:4 | id() | DeclRefExpr | -| declarations.swift:144:1:144:7 | call to ... | CallExpr | declarations.swift:144:1:144:4 | call to id() | DotSyntaxCallExpr | -| declarations.swift:144:1:144:7 | { ... } | BraceStmt | declarations.swift:144:1:144:7 | call to ... | CallExpr | +| declarations.swift:144:1:144:7 | call to id() | CallExpr | declarations.swift:144:1:144:4 | .id() | MethodRefExpr | +| declarations.swift:144:1:144:7 | { ... } | BraceStmt | declarations.swift:144:1:144:7 | call to id() | CallExpr | | declarations.swift:144:1:144:7 | { ... } | TopLevelCodeDecl | declarations.swift:144:1:144:7 | { ... } | BraceStmt | | expressions.swift:1:1:1:9 | var ... = ... | PatternBindingDecl | expressions.swift:1:5:1:5 | a | NamedPattern | | expressions.swift:1:1:1:9 | var ... = ... | PatternBindingDecl | expressions.swift:1:9:1:9 | 15 | IntegerLiteralExpr | @@ -364,19 +361,16 @@ | expressions.swift:7:10:7:10 | "..." | InterpolatedStringLiteralExpr | file://:0:0:0:0 | 6 | IntegerLiteralExpr | | expressions.swift:7:10:7:10 | TapExpr | TapExpr | expressions.swift:7:10:7:10 | OpaqueValueExpr | OpaqueValueExpr | | expressions.swift:7:10:7:10 | TapExpr | TapExpr | expressions.swift:7:10:7:10 | { ... } | BraceStmt | -| expressions.swift:7:10:7:10 | { ... } | BraceStmt | expressions.swift:7:11:7:10 | call to ... | CallExpr | -| expressions.swift:7:10:7:10 | { ... } | BraceStmt | expressions.swift:7:18:7:20 | call to ... | CallExpr | -| expressions.swift:7:10:7:10 | { ... } | BraceStmt | expressions.swift:7:21:7:21 | call to ... | CallExpr | +| expressions.swift:7:10:7:10 | { ... } | BraceStmt | expressions.swift:7:11:7:10 | call to appendLiteral(_:) | CallExpr | +| expressions.swift:7:10:7:10 | { ... } | BraceStmt | expressions.swift:7:18:7:20 | call to appendInterpolation(_:) | CallExpr | +| expressions.swift:7:10:7:10 | { ... } | BraceStmt | expressions.swift:7:21:7:21 | call to appendLiteral(_:) | CallExpr | | expressions.swift:7:10:7:10 | { ... } | BraceStmt | file://:0:0:0:0 | $interpolation | ConcreteVarDecl | -| expressions.swift:7:11:7:10 | call to ... | CallExpr | expressions.swift:7:11:7:11 | call to appendLiteral(_:) | DotSyntaxCallExpr | +| expressions.swift:7:11:7:10 | call to appendLiteral(_:) | CallExpr | expressions.swift:7:11:7:11 | .appendLiteral(_:) | MethodRefExpr | | expressions.swift:7:11:7:11 | &... | InOutExpr | expressions.swift:7:11:7:11 | $interpolation | DeclRefExpr | -| expressions.swift:7:11:7:11 | call to appendLiteral(_:) | DotSyntaxCallExpr | file://:0:0:0:0 | appendLiteral(_:) | DeclRefExpr | | expressions.swift:7:18:7:18 | &... | InOutExpr | expressions.swift:7:18:7:18 | $interpolation | DeclRefExpr | -| expressions.swift:7:18:7:18 | call to appendInterpolation(_:) | DotSyntaxCallExpr | expressions.swift:7:18:7:18 | appendInterpolation(_:) | DeclRefExpr | -| expressions.swift:7:18:7:20 | call to ... | CallExpr | expressions.swift:7:18:7:18 | call to appendInterpolation(_:) | DotSyntaxCallExpr | +| expressions.swift:7:18:7:20 | call to appendInterpolation(_:) | CallExpr | expressions.swift:7:18:7:18 | .appendInterpolation(_:) | MethodRefExpr | | expressions.swift:7:21:7:21 | &... | InOutExpr | expressions.swift:7:21:7:21 | $interpolation | DeclRefExpr | -| expressions.swift:7:21:7:21 | call to ... | CallExpr | expressions.swift:7:21:7:21 | call to appendLiteral(_:) | DotSyntaxCallExpr | -| expressions.swift:7:21:7:21 | call to appendLiteral(_:) | DotSyntaxCallExpr | file://:0:0:0:0 | appendLiteral(_:) | DeclRefExpr | +| expressions.swift:7:21:7:21 | call to appendLiteral(_:) | CallExpr | expressions.swift:7:21:7:21 | .appendLiteral(_:) | MethodRefExpr | | expressions.swift:8:1:8:15 | var ... = ... | PatternBindingDecl | expressions.swift:8:5:8:11 | ... as ... | TypedPattern | | expressions.swift:8:1:8:15 | var ... = ... | PatternBindingDecl | expressions.swift:8:15:8:15 | nil | NilLiteralExpr | | expressions.swift:8:1:8:15 | { ... } | BraceStmt | expressions.swift:8:1:8:15 | var ... = ... | PatternBindingDecl | @@ -389,14 +383,12 @@ | expressions.swift:14:31:18:1 | { ... } | BraceStmt | expressions.swift:15:3:17:3 | guard ... else { ... } | GuardStmt | | expressions.swift:15:3:17:3 | guard ... else { ... } | GuardStmt | expressions.swift:15:9:15:14 | StmtCondition | StmtCondition | | expressions.swift:15:3:17:3 | guard ... else { ... } | GuardStmt | expressions.swift:15:21:17:3 | { ... } | BraceStmt | -| expressions.swift:15:9:15:14 | ... call to !=(_:_:) ... | BinaryExpr | expressions.swift:15:11:15:11 | call to !=(_:_:) | DotSyntaxCallExpr | +| expressions.swift:15:9:15:14 | ... .!=(_:_:) ... | BinaryExpr | expressions.swift:15:11:15:11 | .!=(_:_:) | MethodRefExpr | | expressions.swift:15:11:15:11 | Int.Type | TypeExpr | expressions.swift:15:11:15:11 | Int | TypeRepr | -| expressions.swift:15:11:15:11 | call to !=(_:_:) | DotSyntaxCallExpr | expressions.swift:15:11:15:11 | !=(_:_:) | DeclRefExpr | | expressions.swift:15:21:17:3 | { ... } | BraceStmt | expressions.swift:16:5:16:19 | throw ... | ThrowStmt | | expressions.swift:16:5:16:19 | throw ... | ThrowStmt | expressions.swift:16:11:16:19 | (Error) ... | ErasureExpr | | expressions.swift:16:11:16:11 | AnError.Type | TypeExpr | expressions.swift:16:11:16:11 | AnError | TypeRepr | -| expressions.swift:16:11:16:19 | (Error) ... | ErasureExpr | expressions.swift:16:11:16:19 | call to ... | DotSyntaxCallExpr | -| expressions.swift:16:11:16:19 | call to ... | DotSyntaxCallExpr | expressions.swift:16:19:16:19 | failed | DeclRefExpr | +| expressions.swift:16:11:16:19 | (Error) ... | ErasureExpr | expressions.swift:16:11:16:19 | .failed | MethodRefExpr | | expressions.swift:20:1:20:16 | try! ... | ForceTryExpr | expressions.swift:20:6:20:16 | call to failure(_:) | CallExpr | | expressions.swift:20:1:20:16 | { ... } | BraceStmt | expressions.swift:20:1:20:16 | try! ... | ForceTryExpr | | expressions.swift:20:1:20:16 | { ... } | TopLevelCodeDecl | expressions.swift:20:1:20:16 | { ... } | BraceStmt | @@ -410,12 +402,12 @@ | expressions.swift:24:3:24:11 | init | ConstructorDecl | expressions.swift:24:10:24:11 | { ... } | BraceStmt | | expressions.swift:24:10:24:11 | { ... } | BraceStmt | expressions.swift:24:11:24:11 | return | ReturnStmt | | expressions.swift:27:1:27:19 | var ... = ... | PatternBindingDecl | expressions.swift:27:5:27:5 | klass | NamedPattern | -| expressions.swift:27:1:27:19 | var ... = ... | PatternBindingDecl | expressions.swift:27:13:27:19 | call to ... | CallExpr | +| expressions.swift:27:1:27:19 | var ... = ... | PatternBindingDecl | expressions.swift:27:13:27:19 | call to init | CallExpr | | expressions.swift:27:1:27:19 | { ... } | BraceStmt | expressions.swift:27:1:27:19 | var ... = ... | PatternBindingDecl | | expressions.swift:27:1:27:19 | { ... } | TopLevelCodeDecl | expressions.swift:27:1:27:19 | { ... } | BraceStmt | | expressions.swift:27:13:27:13 | Klass.Type | TypeExpr | expressions.swift:27:13:27:13 | Klass | TypeRepr | | expressions.swift:27:13:27:13 | call to init | ConstructorRefCallExpr | expressions.swift:27:13:27:13 | init | DeclRefExpr | -| expressions.swift:27:13:27:19 | call to ... | CallExpr | expressions.swift:27:13:27:13 | call to init | ConstructorRefCallExpr | +| expressions.swift:27:13:27:19 | call to init | CallExpr | expressions.swift:27:13:27:13 | call to init | ConstructorRefCallExpr | | expressions.swift:29:1:29:19 | var ... = ... | PatternBindingDecl | expressions.swift:29:5:29:5 | d | NamedPattern | | expressions.swift:29:1:29:19 | var ... = ... | PatternBindingDecl | expressions.swift:29:9:29:19 | [...] | DictionaryExpr | | expressions.swift:29:1:29:19 | { ... } | BraceStmt | expressions.swift:29:1:29:19 | var ... = ... | PatternBindingDecl | @@ -465,10 +457,9 @@ | expressions.swift:41:10:43:1 | { ... } | ClosureExpr | expressions.swift:41:10:43:1 | { ... } | BraceStmt | | expressions.swift:41:10:43:1 | { ... } | ClosureExpr | expressions.swift:41:13:41:16 | x | ParamDecl | | expressions.swift:41:10:43:1 | { ... } | ClosureExpr | expressions.swift:41:21:41:24 | y | ParamDecl | -| expressions.swift:42:5:42:16 | return ... | ReturnStmt | expressions.swift:42:12:42:16 | ... call to +(_:_:) ... | BinaryExpr | -| expressions.swift:42:12:42:16 | ... call to +(_:_:) ... | BinaryExpr | expressions.swift:42:14:42:14 | call to +(_:_:) | DotSyntaxCallExpr | +| expressions.swift:42:5:42:16 | return ... | ReturnStmt | expressions.swift:42:12:42:16 | ... .+(_:_:) ... | BinaryExpr | +| expressions.swift:42:12:42:16 | ... .+(_:_:) ... | BinaryExpr | expressions.swift:42:14:42:14 | .+(_:_:) | MethodRefExpr | | expressions.swift:42:14:42:14 | Int.Type | TypeExpr | expressions.swift:42:14:42:14 | Int | TypeRepr | -| expressions.swift:42:14:42:14 | call to +(_:_:) | DotSyntaxCallExpr | expressions.swift:42:14:42:14 | +(_:_:) | DeclRefExpr | | expressions.swift:44:1:46:1 | call to closured(closure:) | CallExpr | expressions.swift:44:1:44:1 | closured(closure:) | DeclRefExpr | | expressions.swift:44:1:46:1 | { ... } | BraceStmt | expressions.swift:44:1:46:1 | call to closured(closure:) | CallExpr | | expressions.swift:44:1:46:1 | { ... } | TopLevelCodeDecl | expressions.swift:44:1:46:1 | { ... } | BraceStmt | @@ -476,10 +467,9 @@ | expressions.swift:44:10:46:1 | { ... } | ClosureExpr | expressions.swift:44:10:46:1 | { ... } | BraceStmt | | expressions.swift:44:10:46:1 | { ... } | ClosureExpr | expressions.swift:44:12:44:12 | x | ParamDecl | | expressions.swift:44:10:46:1 | { ... } | ClosureExpr | expressions.swift:44:15:44:15 | y | ParamDecl | -| expressions.swift:45:5:45:16 | return ... | ReturnStmt | expressions.swift:45:12:45:16 | ... call to +(_:_:) ... | BinaryExpr | -| expressions.swift:45:12:45:16 | ... call to +(_:_:) ... | BinaryExpr | expressions.swift:45:14:45:14 | call to +(_:_:) | DotSyntaxCallExpr | +| expressions.swift:45:5:45:16 | return ... | ReturnStmt | expressions.swift:45:12:45:16 | ... .+(_:_:) ... | BinaryExpr | +| expressions.swift:45:12:45:16 | ... .+(_:_:) ... | BinaryExpr | expressions.swift:45:14:45:14 | .+(_:_:) | MethodRefExpr | | expressions.swift:45:14:45:14 | Int.Type | TypeExpr | expressions.swift:45:14:45:14 | Int | TypeRepr | -| expressions.swift:45:14:45:14 | call to +(_:_:) | DotSyntaxCallExpr | expressions.swift:45:14:45:14 | +(_:_:) | DeclRefExpr | | expressions.swift:47:1:47:27 | call to closured(closure:) | CallExpr | expressions.swift:47:1:47:1 | closured(closure:) | DeclRefExpr | | expressions.swift:47:1:47:27 | { ... } | BraceStmt | expressions.swift:47:1:47:27 | call to closured(closure:) | CallExpr | | expressions.swift:47:1:47:27 | { ... } | TopLevelCodeDecl | expressions.swift:47:1:47:27 | { ... } | BraceStmt | @@ -487,10 +477,9 @@ | expressions.swift:47:10:47:27 | { ... } | ClosureExpr | expressions.swift:47:10:47:10 | $0 | ParamDecl | | expressions.swift:47:10:47:27 | { ... } | ClosureExpr | expressions.swift:47:10:47:10 | $1 | ParamDecl | | expressions.swift:47:10:47:27 | { ... } | ClosureExpr | expressions.swift:47:10:47:27 | { ... } | BraceStmt | -| expressions.swift:47:12:47:24 | return ... | ReturnStmt | expressions.swift:47:19:47:24 | ... call to +(_:_:) ... | BinaryExpr | -| expressions.swift:47:19:47:24 | ... call to +(_:_:) ... | BinaryExpr | expressions.swift:47:22:47:22 | call to +(_:_:) | DotSyntaxCallExpr | +| expressions.swift:47:12:47:24 | return ... | ReturnStmt | expressions.swift:47:19:47:24 | ... .+(_:_:) ... | BinaryExpr | +| expressions.swift:47:19:47:24 | ... .+(_:_:) ... | BinaryExpr | expressions.swift:47:22:47:22 | .+(_:_:) | MethodRefExpr | | expressions.swift:47:22:47:22 | Int.Type | TypeExpr | expressions.swift:47:22:47:22 | Int | TypeRepr | -| expressions.swift:47:22:47:22 | call to +(_:_:) | DotSyntaxCallExpr | expressions.swift:47:22:47:22 | +(_:_:) | DeclRefExpr | | expressions.swift:48:1:48:20 | call to closured(closure:) | CallExpr | expressions.swift:48:1:48:1 | closured(closure:) | DeclRefExpr | | expressions.swift:48:1:48:20 | { ... } | BraceStmt | expressions.swift:48:1:48:20 | call to closured(closure:) | CallExpr | | expressions.swift:48:1:48:20 | { ... } | TopLevelCodeDecl | expressions.swift:48:1:48:20 | { ... } | BraceStmt | @@ -498,10 +487,9 @@ | expressions.swift:48:10:48:20 | { ... } | ClosureExpr | expressions.swift:48:10:48:10 | $0 | ParamDecl | | expressions.swift:48:10:48:20 | { ... } | ClosureExpr | expressions.swift:48:10:48:10 | $1 | ParamDecl | | expressions.swift:48:10:48:20 | { ... } | ClosureExpr | expressions.swift:48:10:48:20 | { ... } | BraceStmt | -| expressions.swift:48:12:48:17 | ... call to +(_:_:) ... | BinaryExpr | expressions.swift:48:15:48:15 | call to +(_:_:) | DotSyntaxCallExpr | -| expressions.swift:48:12:48:17 | return ... | ReturnStmt | expressions.swift:48:12:48:17 | ... call to +(_:_:) ... | BinaryExpr | +| expressions.swift:48:12:48:17 | ... .+(_:_:) ... | BinaryExpr | expressions.swift:48:15:48:15 | .+(_:_:) | MethodRefExpr | +| expressions.swift:48:12:48:17 | return ... | ReturnStmt | expressions.swift:48:12:48:17 | ... .+(_:_:) ... | BinaryExpr | | expressions.swift:48:15:48:15 | Int.Type | TypeExpr | expressions.swift:48:15:48:15 | Int | TypeRepr | -| expressions.swift:48:15:48:15 | call to +(_:_:) | DotSyntaxCallExpr | expressions.swift:48:15:48:15 | +(_:_:) | DeclRefExpr | | expressions.swift:50:8:50:8 | init | ConstructorDecl | expressions.swift:50:8:50:8 | x | ParamDecl | | expressions.swift:51:3:51:10 | var ... = ... | PatternBindingDecl | expressions.swift:51:7:51:10 | ... as ... | TypedPattern | | expressions.swift:51:7:51:7 | get | AccessorDecl | expressions.swift:51:7:51:7 | { ... } | BraceStmt | @@ -542,9 +530,8 @@ | expressions.swift:63:17:67:3 | { ... } | BraceStmt | expressions.swift:67:3:67:3 | return | ReturnStmt | | expressions.swift:64:5:66:5 | if ... then { ... } | IfStmt | expressions.swift:64:8:64:12 | StmtCondition | StmtCondition | | expressions.swift:64:5:66:5 | if ... then { ... } | IfStmt | expressions.swift:64:14:66:5 | { ... } | BraceStmt | -| expressions.swift:64:8:64:12 | ... call to <(_:_:) ... | BinaryExpr | expressions.swift:64:10:64:10 | call to <(_:_:) | DotSyntaxCallExpr | +| expressions.swift:64:8:64:12 | ... .<(_:_:) ... | BinaryExpr | expressions.swift:64:10:64:10 | .<(_:_:) | MethodRefExpr | | expressions.swift:64:10:64:10 | Int.Type | TypeExpr | expressions.swift:64:10:64:10 | Int | TypeRepr | -| expressions.swift:64:10:64:10 | call to <(_:_:) | DotSyntaxCallExpr | expressions.swift:64:10:64:10 | <(_:_:) | DeclRefExpr | | expressions.swift:64:14:66:5 | { ... } | BraceStmt | expressions.swift:65:7:65:14 | fail | FailStmt | | expressions.swift:70:7:70:7 | deinit | DestructorDecl | expressions.swift:70:7:70:7 | { ... } | BraceStmt | | expressions.swift:71:3:71:11 | var ... = ... | PatternBindingDecl | expressions.swift:71:7:71:11 | ... as ... | TypedPattern | @@ -572,12 +559,12 @@ | expressions.swift:79:5:79:21 | self = ... | RebindSelfInConstructorExpr | expressions.swift:78:3:78:3 | self | ParamDecl | | expressions.swift:79:5:79:21 | self = ... | RebindSelfInConstructorExpr | expressions.swift:79:5:79:21 | call to ... | CallExpr | | expressions.swift:83:1:83:23 | var ... = ... | PatternBindingDecl | expressions.swift:83:5:83:5 | derived | NamedPattern | -| expressions.swift:83:1:83:23 | var ... = ... | PatternBindingDecl | expressions.swift:83:15:83:23 | call to ... | CallExpr | +| expressions.swift:83:1:83:23 | var ... = ... | PatternBindingDecl | expressions.swift:83:15:83:23 | call to init | CallExpr | | expressions.swift:83:1:83:23 | { ... } | BraceStmt | expressions.swift:83:1:83:23 | var ... = ... | PatternBindingDecl | | expressions.swift:83:1:83:23 | { ... } | TopLevelCodeDecl | expressions.swift:83:1:83:23 | { ... } | BraceStmt | | expressions.swift:83:15:83:15 | Derived.Type | TypeExpr | expressions.swift:83:15:83:15 | Derived | TypeRepr | | expressions.swift:83:15:83:15 | call to init | ConstructorRefCallExpr | expressions.swift:83:15:83:15 | init | DeclRefExpr | -| expressions.swift:83:15:83:23 | call to ... | CallExpr | expressions.swift:83:15:83:15 | call to init | ConstructorRefCallExpr | +| expressions.swift:83:15:83:23 | call to init | CallExpr | expressions.swift:83:15:83:15 | call to init | ConstructorRefCallExpr | | expressions.swift:84:1:84:13 | ... = ... | AssignExpr | expressions.swift:84:1:84:1 | _ | DiscardAssignmentExpr | | expressions.swift:84:1:84:13 | ... = ... | AssignExpr | expressions.swift:84:5:84:13 | .xx | MemberRefExpr | | expressions.swift:84:1:84:13 | { ... } | BraceStmt | expressions.swift:84:1:84:13 | ... = ... | AssignExpr | @@ -601,21 +588,18 @@ | expressions.swift:90:7:90:7 | init | ConstructorDecl | expressions.swift:90:7:90:7 | { ... } | BraceStmt | | expressions.swift:90:7:90:7 | { ... } | BraceStmt | expressions.swift:90:7:90:7 | return | ReturnStmt | | expressions.swift:92:1:92:55 | var ... = ... | PatternBindingDecl | expressions.swift:92:5:92:5 | opaque | NamedPattern | -| expressions.swift:92:1:92:55 | var ... = ... | PatternBindingDecl | expressions.swift:92:14:92:55 | call to ... | CallExpr | +| expressions.swift:92:1:92:55 | var ... = ... | PatternBindingDecl | expressions.swift:92:14:92:55 | call to toOpaque() | CallExpr | | expressions.swift:92:1:92:55 | { ... } | BraceStmt | expressions.swift:92:1:92:55 | var ... = ... | PatternBindingDecl | | expressions.swift:92:1:92:55 | { ... } | TopLevelCodeDecl | expressions.swift:92:1:92:55 | { ... } | BraceStmt | | expressions.swift:92:14:92:14 | Unmanaged.Type | TypeExpr | expressions.swift:92:14:92:14 | Unmanaged | TypeRepr | -| expressions.swift:92:14:92:24 | call to passRetained(_:) | DotSyntaxCallExpr | expressions.swift:92:24:92:24 | passRetained(_:) | DeclRefExpr | -| expressions.swift:92:14:92:44 | call to ... | CallExpr | expressions.swift:92:14:92:24 | call to passRetained(_:) | DotSyntaxCallExpr | -| expressions.swift:92:14:92:46 | call to toOpaque() | DotSyntaxCallExpr | expressions.swift:92:46:92:46 | toOpaque() | DeclRefExpr | -| expressions.swift:92:14:92:55 | call to ... | CallExpr | expressions.swift:92:14:92:46 | call to toOpaque() | DotSyntaxCallExpr | +| expressions.swift:92:14:92:44 | call to passRetained(_:) | CallExpr | expressions.swift:92:14:92:24 | .passRetained(_:) | MethodRefExpr | +| expressions.swift:92:14:92:55 | call to toOpaque() | CallExpr | expressions.swift:92:14:92:46 | .toOpaque() | MethodRefExpr | | expressions.swift:92:37:92:37 | ToPtr.Type | TypeExpr | expressions.swift:92:37:92:37 | ToPtr | TypeRepr | | expressions.swift:92:37:92:37 | call to init | ConstructorRefCallExpr | expressions.swift:92:37:92:37 | init | DeclRefExpr | -| expressions.swift:92:37:92:43 | call to ... | CallExpr | expressions.swift:92:37:92:37 | call to init | ConstructorRefCallExpr | +| expressions.swift:92:37:92:43 | call to init | CallExpr | expressions.swift:92:37:92:37 | call to init | ConstructorRefCallExpr | | expressions.swift:93:1:93:16 | Unmanaged.Type | TypeExpr | expressions.swift:93:1:93:16 | Unmanaged | TypeRepr | -| expressions.swift:93:1:93:18 | call to fromOpaque(_:) | DotSyntaxCallExpr | expressions.swift:93:18:93:18 | fromOpaque(_:) | DeclRefExpr | -| expressions.swift:93:1:93:35 | call to ... | CallExpr | expressions.swift:93:1:93:18 | call to fromOpaque(_:) | DotSyntaxCallExpr | -| expressions.swift:93:1:93:35 | { ... } | BraceStmt | expressions.swift:93:1:93:35 | call to ... | CallExpr | +| expressions.swift:93:1:93:35 | call to fromOpaque(_:) | CallExpr | expressions.swift:93:1:93:18 | .fromOpaque(_:) | MethodRefExpr | +| expressions.swift:93:1:93:35 | { ... } | BraceStmt | expressions.swift:93:1:93:35 | call to fromOpaque(_:) | CallExpr | | expressions.swift:93:1:93:35 | { ... } | TopLevelCodeDecl | expressions.swift:93:1:93:35 | { ... } | BraceStmt | | expressions.swift:93:29:93:29 | (UnsafeRawPointer) ... | PointerToPointerExpr | expressions.swift:93:29:93:29 | opaque | DeclRefExpr | | expressions.swift:95:8:95:8 | init | ConstructorDecl | expressions.swift:95:8:95:8 | normalField | ParamDecl | @@ -894,11 +878,10 @@ | patterns.swift:21:19:21:34 | baz | EnumElementDecl | patterns.swift:21:23:21:23 | _ | ParamDecl | | patterns.swift:21:19:21:34 | baz | EnumElementDecl | patterns.swift:21:28:21:28 | _ | ParamDecl | | patterns.swift:24:5:24:19 | var ... = ... | PatternBindingDecl | patterns.swift:24:9:24:12 | ... as ... | TypedPattern | -| patterns.swift:24:5:24:19 | var ... = ... | PatternBindingDecl | patterns.swift:24:18:24:19 | call to ... | DotSyntaxCallExpr | +| patterns.swift:24:5:24:19 | var ... = ... | PatternBindingDecl | patterns.swift:24:18:24:19 | .bar | MethodRefExpr | | patterns.swift:24:9:24:12 | ... as ... | TypedPattern | patterns.swift:24:9:24:9 | v | NamedPattern | | patterns.swift:24:9:24:12 | ... as ... | TypedPattern | patterns.swift:24:12:24:12 | Foo | TypeRepr | | patterns.swift:24:18:24:18 | Foo.Type | TypeExpr | patterns.swift:24:18:24:18 | Foo | TypeRepr | -| patterns.swift:24:18:24:19 | call to ... | DotSyntaxCallExpr | patterns.swift:24:19:24:19 | bar | DeclRefExpr | | patterns.swift:26:5:29:5 | switch v { ... } | SwitchStmt | patterns.swift:26:12:26:12 | v | DeclRefExpr | | patterns.swift:26:5:29:5 | switch v { ... } | SwitchStmt | patterns.swift:27:5:27:16 | case ... | CaseStmt | | patterns.swift:26:5:29:5 | switch v { ... } | SwitchStmt | patterns.swift:28:5:28:26 | case ... | CaseStmt | @@ -979,52 +962,46 @@ | statements.swift:1:13:32:1 | { ... } | BraceStmt | statements.swift:19:3:23:3 | do { ... } catch { ... } | DoCatchStmt | | statements.swift:1:13:32:1 | { ... } | BraceStmt | statements.swift:25:3:31:3 | do { ... } catch { ... } | DoCatchStmt | | statements.swift:2:3:8:3 | for ... in ... { ... } | ForEachStmt | statements.swift:2:15:2:15 | i | NamedPattern | -| statements.swift:2:3:8:3 | for ... in ... { ... } | ForEachStmt | statements.swift:2:20:2:24 | ... call to ...(_:_:) ... | BinaryExpr | +| statements.swift:2:3:8:3 | for ... in ... { ... } | ForEachStmt | statements.swift:2:20:2:24 | ... ....(_:_:) ... | BinaryExpr | | statements.swift:2:3:8:3 | for ... in ... { ... } | ForEachStmt | statements.swift:2:26:8:3 | { ... } | BraceStmt | -| statements.swift:2:20:2:24 | ... call to ...(_:_:) ... | BinaryExpr | statements.swift:2:21:2:21 | call to ...(_:_:) | DotSyntaxCallExpr | +| statements.swift:2:20:2:24 | ... ....(_:_:) ... | BinaryExpr | statements.swift:2:21:2:21 | ....(_:_:) | MethodRefExpr | | statements.swift:2:21:2:21 | Int.Type | TypeExpr | statements.swift:2:21:2:21 | Int | TypeRepr | -| statements.swift:2:21:2:21 | call to ...(_:_:) | DotSyntaxCallExpr | statements.swift:2:21:2:21 | ...(_:_:) | DeclRefExpr | | statements.swift:2:26:8:3 | { ... } | BraceStmt | statements.swift:3:5:7:5 | if ... then { ... } else { ... } | IfStmt | | statements.swift:3:5:7:5 | if ... then { ... } else { ... } | IfStmt | statements.swift:3:8:3:13 | StmtCondition | StmtCondition | | statements.swift:3:5:7:5 | if ... then { ... } else { ... } | IfStmt | statements.swift:3:15:5:5 | { ... } | BraceStmt | | statements.swift:3:5:7:5 | if ... then { ... } else { ... } | IfStmt | statements.swift:5:12:7:5 | { ... } | BraceStmt | -| statements.swift:3:8:3:13 | ... call to ==(_:_:) ... | BinaryExpr | statements.swift:3:10:3:10 | call to ==(_:_:) | DotSyntaxCallExpr | +| statements.swift:3:8:3:13 | ... .==(_:_:) ... | BinaryExpr | statements.swift:3:10:3:10 | .==(_:_:) | MethodRefExpr | | statements.swift:3:10:3:10 | Int.Type | TypeExpr | statements.swift:3:10:3:10 | Int | TypeRepr | -| statements.swift:3:10:3:10 | call to ==(_:_:) | DotSyntaxCallExpr | statements.swift:3:10:3:10 | ==(_:_:) | DeclRefExpr | | statements.swift:3:15:5:5 | { ... } | BraceStmt | statements.swift:4:9:4:9 | break | BreakStmt | | statements.swift:5:12:7:5 | { ... } | BraceStmt | statements.swift:6:9:6:9 | continue | ContinueStmt | | statements.swift:9:3:9:11 | var ... = ... | PatternBindingDecl | statements.swift:9:7:9:7 | i | NamedPattern | | statements.swift:9:3:9:11 | var ... = ... | PatternBindingDecl | statements.swift:9:11:9:11 | 0 | IntegerLiteralExpr | | statements.swift:10:3:12:3 | while ... { ... } | WhileStmt | statements.swift:10:17:10:24 | StmtCondition | StmtCondition | | statements.swift:10:3:12:3 | while ... { ... } | WhileStmt | statements.swift:10:26:12:3 | { ... } | BraceStmt | -| statements.swift:10:17:10:24 | (...) | ParenExpr | statements.swift:10:18:10:22 | ... call to <(_:_:) ... | BinaryExpr | +| statements.swift:10:17:10:24 | (...) | ParenExpr | statements.swift:10:18:10:22 | ... .<(_:_:) ... | BinaryExpr | | statements.swift:10:18:10:18 | (Int) ... | LoadExpr | statements.swift:10:18:10:18 | i | DeclRefExpr | -| statements.swift:10:18:10:22 | ... call to <(_:_:) ... | BinaryExpr | statements.swift:10:20:10:20 | call to <(_:_:) | DotSyntaxCallExpr | +| statements.swift:10:18:10:22 | ... .<(_:_:) ... | BinaryExpr | statements.swift:10:20:10:20 | .<(_:_:) | MethodRefExpr | | statements.swift:10:20:10:20 | Int.Type | TypeExpr | statements.swift:10:20:10:20 | Int | TypeRepr | -| statements.swift:10:20:10:20 | call to <(_:_:) | DotSyntaxCallExpr | statements.swift:10:20:10:20 | <(_:_:) | DeclRefExpr | | statements.swift:10:26:12:3 | { ... } | BraceStmt | statements.swift:11:5:11:13 | ... = ... | AssignExpr | | statements.swift:11:5:11:13 | ... = ... | AssignExpr | statements.swift:11:5:11:5 | i | DeclRefExpr | -| statements.swift:11:5:11:13 | ... = ... | AssignExpr | statements.swift:11:9:11:13 | ... call to +(_:_:) ... | BinaryExpr | +| statements.swift:11:5:11:13 | ... = ... | AssignExpr | statements.swift:11:9:11:13 | ... .+(_:_:) ... | BinaryExpr | | statements.swift:11:9:11:9 | (Int) ... | LoadExpr | statements.swift:11:9:11:9 | i | DeclRefExpr | -| statements.swift:11:9:11:13 | ... call to +(_:_:) ... | BinaryExpr | statements.swift:11:11:11:11 | call to +(_:_:) | DotSyntaxCallExpr | +| statements.swift:11:9:11:13 | ... .+(_:_:) ... | BinaryExpr | statements.swift:11:11:11:11 | .+(_:_:) | MethodRefExpr | | statements.swift:11:11:11:11 | Int.Type | TypeExpr | statements.swift:11:11:11:11 | Int | TypeRepr | -| statements.swift:11:11:11:11 | call to +(_:_:) | DotSyntaxCallExpr | statements.swift:11:11:11:11 | +(_:_:) | DeclRefExpr | | statements.swift:14:3:14:7 | ... = ... | AssignExpr | statements.swift:14:3:14:3 | i | DeclRefExpr | | statements.swift:14:3:14:7 | ... = ... | AssignExpr | statements.swift:14:7:14:7 | 0 | IntegerLiteralExpr | | statements.swift:15:3:17:18 | repeat { ... } while ... | RepeatWhileStmt | statements.swift:15:18:17:3 | { ... } | BraceStmt | | statements.swift:15:3:17:18 | repeat { ... } while ... | RepeatWhileStmt | statements.swift:17:11:17:18 | (...) | ParenExpr | | statements.swift:15:18:17:3 | { ... } | BraceStmt | statements.swift:16:5:16:13 | ... = ... | AssignExpr | | statements.swift:16:5:16:13 | ... = ... | AssignExpr | statements.swift:16:5:16:5 | i | DeclRefExpr | -| statements.swift:16:5:16:13 | ... = ... | AssignExpr | statements.swift:16:9:16:13 | ... call to +(_:_:) ... | BinaryExpr | +| statements.swift:16:5:16:13 | ... = ... | AssignExpr | statements.swift:16:9:16:13 | ... .+(_:_:) ... | BinaryExpr | | statements.swift:16:9:16:9 | (Int) ... | LoadExpr | statements.swift:16:9:16:9 | i | DeclRefExpr | -| statements.swift:16:9:16:13 | ... call to +(_:_:) ... | BinaryExpr | statements.swift:16:11:16:11 | call to +(_:_:) | DotSyntaxCallExpr | +| statements.swift:16:9:16:13 | ... .+(_:_:) ... | BinaryExpr | statements.swift:16:11:16:11 | .+(_:_:) | MethodRefExpr | | statements.swift:16:11:16:11 | Int.Type | TypeExpr | statements.swift:16:11:16:11 | Int | TypeRepr | -| statements.swift:16:11:16:11 | call to +(_:_:) | DotSyntaxCallExpr | statements.swift:16:11:16:11 | +(_:_:) | DeclRefExpr | -| statements.swift:17:11:17:18 | (...) | ParenExpr | statements.swift:17:12:17:16 | ... call to <(_:_:) ... | BinaryExpr | +| statements.swift:17:11:17:18 | (...) | ParenExpr | statements.swift:17:12:17:16 | ... .<(_:_:) ... | BinaryExpr | | statements.swift:17:12:17:12 | (Int) ... | LoadExpr | statements.swift:17:12:17:12 | i | DeclRefExpr | -| statements.swift:17:12:17:16 | ... call to <(_:_:) ... | BinaryExpr | statements.swift:17:14:17:14 | call to <(_:_:) | DotSyntaxCallExpr | +| statements.swift:17:12:17:16 | ... .<(_:_:) ... | BinaryExpr | statements.swift:17:14:17:14 | .<(_:_:) | MethodRefExpr | | statements.swift:17:14:17:14 | Int.Type | TypeExpr | statements.swift:17:14:17:14 | Int | TypeRepr | -| statements.swift:17:14:17:14 | call to <(_:_:) | DotSyntaxCallExpr | statements.swift:17:14:17:14 | <(_:_:) | DeclRefExpr | | statements.swift:19:3:23:3 | do { ... } catch { ... } | DoCatchStmt | statements.swift:19:6:21:3 | { ... } | BraceStmt | | statements.swift:19:3:23:3 | do { ... } catch { ... } | DoCatchStmt | statements.swift:21:5:23:3 | case ... | CaseStmt | | statements.swift:19:6:21:3 | { ... } | BraceStmt | statements.swift:20:5:20:19 | try ... | TryExpr | @@ -1069,14 +1046,12 @@ | statements.swift:38:31:42:1 | { ... } | BraceStmt | statements.swift:39:3:41:3 | guard ... else { ... } | GuardStmt | | statements.swift:39:3:41:3 | guard ... else { ... } | GuardStmt | statements.swift:39:9:39:14 | StmtCondition | StmtCondition | | statements.swift:39:3:41:3 | guard ... else { ... } | GuardStmt | statements.swift:39:21:41:3 | { ... } | BraceStmt | -| statements.swift:39:9:39:14 | ... call to !=(_:_:) ... | BinaryExpr | statements.swift:39:11:39:11 | call to !=(_:_:) | DotSyntaxCallExpr | +| statements.swift:39:9:39:14 | ... .!=(_:_:) ... | BinaryExpr | statements.swift:39:11:39:11 | .!=(_:_:) | MethodRefExpr | | statements.swift:39:11:39:11 | Int.Type | TypeExpr | statements.swift:39:11:39:11 | Int | TypeRepr | -| statements.swift:39:11:39:11 | call to !=(_:_:) | DotSyntaxCallExpr | statements.swift:39:11:39:11 | !=(_:_:) | DeclRefExpr | | statements.swift:39:21:41:3 | { ... } | BraceStmt | statements.swift:40:5:40:19 | throw ... | ThrowStmt | | statements.swift:40:5:40:19 | throw ... | ThrowStmt | statements.swift:40:11:40:19 | (Error) ... | ErasureExpr | | statements.swift:40:11:40:11 | AnError.Type | TypeExpr | statements.swift:40:11:40:11 | AnError | TypeRepr | -| statements.swift:40:11:40:19 | (Error) ... | ErasureExpr | statements.swift:40:11:40:19 | call to ... | DotSyntaxCallExpr | -| statements.swift:40:11:40:19 | call to ... | DotSyntaxCallExpr | statements.swift:40:19:40:19 | failed | DeclRefExpr | +| statements.swift:40:11:40:19 | (Error) ... | ErasureExpr | statements.swift:40:11:40:19 | .failed | MethodRefExpr | | statements.swift:44:1:46:1 | defer { ... } | DeferStmt | statements.swift:44:7:46:1 | { ... } | BraceStmt | | statements.swift:44:1:46:1 | { ... } | BraceStmt | statements.swift:44:1:46:1 | defer { ... } | DeferStmt | | statements.swift:44:1:46:1 | { ... } | TopLevelCodeDecl | statements.swift:44:1:46:1 | { ... } | BraceStmt | @@ -1162,16 +1137,14 @@ | statements.swift:70:15:70:23 | [...] | ArrayExpr | statements.swift:70:22:70:22 | 3 | IntegerLiteralExpr | | statements.swift:71:1:72:1 | for ... in ... where ... { ... } | ForEachStmt | statements.swift:71:5:71:5 | number | NamedPattern | | statements.swift:71:1:72:1 | for ... in ... where ... { ... } | ForEachStmt | statements.swift:71:15:71:15 | numbers | DeclRefExpr | -| statements.swift:71:1:72:1 | for ... in ... where ... { ... } | ForEachStmt | statements.swift:71:29:71:43 | ... call to ==(_:_:) ... | BinaryExpr | +| statements.swift:71:1:72:1 | for ... in ... where ... { ... } | ForEachStmt | statements.swift:71:29:71:43 | ... .==(_:_:) ... | BinaryExpr | | statements.swift:71:1:72:1 | for ... in ... where ... { ... } | ForEachStmt | statements.swift:71:45:72:1 | { ... } | BraceStmt | | statements.swift:71:1:72:1 | { ... } | BraceStmt | statements.swift:71:1:72:1 | for ... in ... where ... { ... } | ForEachStmt | | statements.swift:71:1:72:1 | { ... } | TopLevelCodeDecl | statements.swift:71:1:72:1 | { ... } | BraceStmt | -| statements.swift:71:29:71:38 | ... call to %(_:_:) ... | BinaryExpr | statements.swift:71:36:71:36 | call to %(_:_:) | DotSyntaxCallExpr | -| statements.swift:71:29:71:43 | ... call to ==(_:_:) ... | BinaryExpr | statements.swift:71:40:71:40 | call to ==(_:_:) | DotSyntaxCallExpr | +| statements.swift:71:29:71:38 | ... .%(_:_:) ... | BinaryExpr | statements.swift:71:36:71:36 | .%(_:_:) | MethodRefExpr | +| statements.swift:71:29:71:43 | ... .==(_:_:) ... | BinaryExpr | statements.swift:71:40:71:40 | .==(_:_:) | MethodRefExpr | | statements.swift:71:36:71:36 | Int.Type | TypeExpr | statements.swift:71:36:71:36 | Int | TypeRepr | -| statements.swift:71:36:71:36 | call to %(_:_:) | DotSyntaxCallExpr | statements.swift:71:36:71:36 | %(_:_:) | DeclRefExpr | | statements.swift:71:40:71:40 | Int.Type | TypeExpr | statements.swift:71:40:71:40 | Int | TypeRepr | -| statements.swift:71:40:71:40 | call to ==(_:_:) | DotSyntaxCallExpr | statements.swift:71:40:71:40 | ==(_:_:) | DeclRefExpr | | statements.swift:74:8:74:8 | init | ConstructorDecl | statements.swift:74:8:74:8 | x | ParamDecl | | statements.swift:75:3:75:11 | var ... = ... | PatternBindingDecl | statements.swift:75:7:75:11 | ... as ... | TypedPattern | | statements.swift:75:7:75:7 | (unnamed function decl) | AccessorDecl | statements.swift:75:7:75:7 | { ... } | BraceStmt | diff --git a/swift/ql/test/query-tests/Security/CWE-079/UnsafeWebViewFetch.expected b/swift/ql/test/query-tests/Security/CWE-079/UnsafeWebViewFetch.expected index f11e0bbe6f2..cd0f9af67e7 100644 --- a/swift/ql/test/query-tests/Security/CWE-079/UnsafeWebViewFetch.expected +++ b/swift/ql/test/query-tests/Security/CWE-079/UnsafeWebViewFetch.expected @@ -4,12 +4,12 @@ edges | UnsafeWebViewFetch.swift:94:10:94:37 | try ... : | UnsafeWebViewFetch.swift:164:21:164:35 | call to getRemoteData() : | | UnsafeWebViewFetch.swift:94:10:94:37 | try ... : | UnsafeWebViewFetch.swift:167:25:167:39 | call to getRemoteData() | | UnsafeWebViewFetch.swift:94:10:94:37 | try ... : | UnsafeWebViewFetch.swift:206:17:206:31 | call to getRemoteData() : | -| UnsafeWebViewFetch.swift:94:14:94:37 | call to ... : | UnsafeWebViewFetch.swift:94:10:94:37 | try ... : | -| UnsafeWebViewFetch.swift:103:30:103:84 | call to ... : | UnsafeWebViewFetch.swift:103:25:103:84 | try! ... | -| UnsafeWebViewFetch.swift:105:18:105:72 | call to ... : | UnsafeWebViewFetch.swift:106:25:106:25 | data | -| UnsafeWebViewFetch.swift:109:30:109:53 | call to ... : | UnsafeWebViewFetch.swift:109:25:109:53 | try! ... | +| UnsafeWebViewFetch.swift:94:14:94:37 | call to init : | UnsafeWebViewFetch.swift:94:10:94:37 | try ... : | +| UnsafeWebViewFetch.swift:103:30:103:84 | call to init : | UnsafeWebViewFetch.swift:103:25:103:84 | try! ... | +| UnsafeWebViewFetch.swift:105:18:105:72 | call to init : | UnsafeWebViewFetch.swift:106:25:106:25 | data | +| UnsafeWebViewFetch.swift:109:30:109:53 | call to init : | UnsafeWebViewFetch.swift:109:25:109:53 | try! ... | | UnsafeWebViewFetch.swift:117:21:117:35 | call to getRemoteData() : | UnsafeWebViewFetch.swift:121:25:121:25 | remoteString | -| UnsafeWebViewFetch.swift:117:21:117:35 | call to getRemoteData() : | UnsafeWebViewFetch.swift:124:25:124:51 | ... call to +(_:_:) ... | +| UnsafeWebViewFetch.swift:117:21:117:35 | call to getRemoteData() : | UnsafeWebViewFetch.swift:124:25:124:51 | ... .+(_:_:) ... | | UnsafeWebViewFetch.swift:117:21:117:35 | call to getRemoteData() : | UnsafeWebViewFetch.swift:127:25:127:25 | "..." | | UnsafeWebViewFetch.swift:117:21:117:35 | call to getRemoteData() : | UnsafeWebViewFetch.swift:135:25:135:25 | remoteString | | UnsafeWebViewFetch.swift:117:21:117:35 | call to getRemoteData() : | UnsafeWebViewFetch.swift:137:25:137:25 | remoteString | @@ -22,7 +22,7 @@ edges | UnsafeWebViewFetch.swift:117:21:117:35 | call to getRemoteData() : | UnsafeWebViewFetch.swift:153:85:153:94 | ...! | | UnsafeWebViewFetch.swift:117:21:117:35 | call to getRemoteData() : | UnsafeWebViewFetch.swift:154:86:154:95 | ...! | | UnsafeWebViewFetch.swift:164:21:164:35 | call to getRemoteData() : | UnsafeWebViewFetch.swift:168:25:168:25 | remoteString | -| UnsafeWebViewFetch.swift:164:21:164:35 | call to getRemoteData() : | UnsafeWebViewFetch.swift:171:25:171:51 | ... call to +(_:_:) ... | +| UnsafeWebViewFetch.swift:164:21:164:35 | call to getRemoteData() : | UnsafeWebViewFetch.swift:171:25:171:51 | ... .+(_:_:) ... | | UnsafeWebViewFetch.swift:164:21:164:35 | call to getRemoteData() : | UnsafeWebViewFetch.swift:174:25:174:25 | "..." | | UnsafeWebViewFetch.swift:164:21:164:35 | call to getRemoteData() : | UnsafeWebViewFetch.swift:182:25:182:25 | remoteString | | UnsafeWebViewFetch.swift:164:21:164:35 | call to getRemoteData() : | UnsafeWebViewFetch.swift:184:25:184:25 | remoteString | @@ -38,17 +38,17 @@ edges | UnsafeWebViewFetch.swift:206:17:206:31 | call to getRemoteData() : | UnsafeWebViewFetch.swift:211:25:211:25 | htmlData | nodes | UnsafeWebViewFetch.swift:94:10:94:37 | try ... : | semmle.label | try ... : | -| UnsafeWebViewFetch.swift:94:14:94:37 | call to ... : | semmle.label | call to ... : | +| UnsafeWebViewFetch.swift:94:14:94:37 | call to init : | semmle.label | call to init : | | UnsafeWebViewFetch.swift:103:25:103:84 | try! ... | semmle.label | try! ... | -| UnsafeWebViewFetch.swift:103:30:103:84 | call to ... : | semmle.label | call to ... : | -| UnsafeWebViewFetch.swift:105:18:105:72 | call to ... : | semmle.label | call to ... : | +| UnsafeWebViewFetch.swift:103:30:103:84 | call to init : | semmle.label | call to init : | +| UnsafeWebViewFetch.swift:105:18:105:72 | call to init : | semmle.label | call to init : | | UnsafeWebViewFetch.swift:106:25:106:25 | data | semmle.label | data | | UnsafeWebViewFetch.swift:109:25:109:53 | try! ... | semmle.label | try! ... | -| UnsafeWebViewFetch.swift:109:30:109:53 | call to ... : | semmle.label | call to ... : | +| UnsafeWebViewFetch.swift:109:30:109:53 | call to init : | semmle.label | call to init : | | UnsafeWebViewFetch.swift:117:21:117:35 | call to getRemoteData() : | semmle.label | call to getRemoteData() : | | UnsafeWebViewFetch.swift:120:25:120:39 | call to getRemoteData() | semmle.label | call to getRemoteData() | | UnsafeWebViewFetch.swift:121:25:121:25 | remoteString | semmle.label | remoteString | -| UnsafeWebViewFetch.swift:124:25:124:51 | ... call to +(_:_:) ... | semmle.label | ... call to +(_:_:) ... | +| UnsafeWebViewFetch.swift:124:25:124:51 | ... .+(_:_:) ... | semmle.label | ... .+(_:_:) ... | | UnsafeWebViewFetch.swift:127:25:127:25 | "..." | semmle.label | "..." | | UnsafeWebViewFetch.swift:135:25:135:25 | remoteString | semmle.label | remoteString | | UnsafeWebViewFetch.swift:137:25:137:25 | remoteString | semmle.label | remoteString | @@ -63,7 +63,7 @@ nodes | UnsafeWebViewFetch.swift:164:21:164:35 | call to getRemoteData() : | semmle.label | call to getRemoteData() : | | UnsafeWebViewFetch.swift:167:25:167:39 | call to getRemoteData() | semmle.label | call to getRemoteData() | | UnsafeWebViewFetch.swift:168:25:168:25 | remoteString | semmle.label | remoteString | -| UnsafeWebViewFetch.swift:171:25:171:51 | ... call to +(_:_:) ... | semmle.label | ... call to +(_:_:) ... | +| UnsafeWebViewFetch.swift:171:25:171:51 | ... .+(_:_:) ... | semmle.label | ... .+(_:_:) ... | | UnsafeWebViewFetch.swift:174:25:174:25 | "..." | semmle.label | "..." | | UnsafeWebViewFetch.swift:182:25:182:25 | remoteString | semmle.label | remoteString | | UnsafeWebViewFetch.swift:184:25:184:25 | remoteString | semmle.label | remoteString | @@ -80,19 +80,19 @@ nodes | UnsafeWebViewFetch.swift:211:25:211:25 | htmlData | semmle.label | htmlData | subpaths #select -| UnsafeWebViewFetch.swift:103:25:103:84 | try! ... | UnsafeWebViewFetch.swift:103:30:103:84 | call to ... : | UnsafeWebViewFetch.swift:103:25:103:84 | try! ... | Tainted data is used in a WebView fetch without restricting the base URL. | -| UnsafeWebViewFetch.swift:106:25:106:25 | data | UnsafeWebViewFetch.swift:105:18:105:72 | call to ... : | UnsafeWebViewFetch.swift:106:25:106:25 | data | Tainted data is used in a WebView fetch without restricting the base URL. | -| UnsafeWebViewFetch.swift:109:25:109:53 | try! ... | UnsafeWebViewFetch.swift:109:30:109:53 | call to ... : | UnsafeWebViewFetch.swift:109:25:109:53 | try! ... | Tainted data is used in a WebView fetch without restricting the base URL. | -| UnsafeWebViewFetch.swift:120:25:120:39 | call to getRemoteData() | UnsafeWebViewFetch.swift:94:14:94:37 | call to ... : | UnsafeWebViewFetch.swift:120:25:120:39 | call to getRemoteData() | Tainted data is used in a WebView fetch without restricting the base URL. | -| UnsafeWebViewFetch.swift:121:25:121:25 | remoteString | UnsafeWebViewFetch.swift:94:14:94:37 | call to ... : | UnsafeWebViewFetch.swift:121:25:121:25 | remoteString | Tainted data is used in a WebView fetch without restricting the base URL. | -| UnsafeWebViewFetch.swift:124:25:124:51 | ... call to +(_:_:) ... | UnsafeWebViewFetch.swift:94:14:94:37 | call to ... : | UnsafeWebViewFetch.swift:124:25:124:51 | ... call to +(_:_:) ... | Tainted data is used in a WebView fetch without restricting the base URL. | -| UnsafeWebViewFetch.swift:127:25:127:25 | "..." | UnsafeWebViewFetch.swift:94:14:94:37 | call to ... : | UnsafeWebViewFetch.swift:127:25:127:25 | "..." | Tainted data is used in a WebView fetch without restricting the base URL. | -| UnsafeWebViewFetch.swift:139:25:139:25 | remoteString | UnsafeWebViewFetch.swift:94:14:94:37 | call to ... : | UnsafeWebViewFetch.swift:139:25:139:25 | remoteString | Tainted data is used in a WebView fetch with a tainted base URL. | -| UnsafeWebViewFetch.swift:141:25:141:25 | remoteString | UnsafeWebViewFetch.swift:94:14:94:37 | call to ... : | UnsafeWebViewFetch.swift:141:25:141:25 | remoteString | Tainted data is used in a WebView fetch with a tainted base URL. | -| UnsafeWebViewFetch.swift:167:25:167:39 | call to getRemoteData() | UnsafeWebViewFetch.swift:94:14:94:37 | call to ... : | UnsafeWebViewFetch.swift:167:25:167:39 | call to getRemoteData() | Tainted data is used in a WebView fetch without restricting the base URL. | -| UnsafeWebViewFetch.swift:168:25:168:25 | remoteString | UnsafeWebViewFetch.swift:94:14:94:37 | call to ... : | UnsafeWebViewFetch.swift:168:25:168:25 | remoteString | Tainted data is used in a WebView fetch without restricting the base URL. | -| UnsafeWebViewFetch.swift:171:25:171:51 | ... call to +(_:_:) ... | UnsafeWebViewFetch.swift:94:14:94:37 | call to ... : | UnsafeWebViewFetch.swift:171:25:171:51 | ... call to +(_:_:) ... | Tainted data is used in a WebView fetch without restricting the base URL. | -| UnsafeWebViewFetch.swift:174:25:174:25 | "..." | UnsafeWebViewFetch.swift:94:14:94:37 | call to ... : | UnsafeWebViewFetch.swift:174:25:174:25 | "..." | Tainted data is used in a WebView fetch without restricting the base URL. | -| UnsafeWebViewFetch.swift:186:25:186:25 | remoteString | UnsafeWebViewFetch.swift:94:14:94:37 | call to ... : | UnsafeWebViewFetch.swift:186:25:186:25 | remoteString | Tainted data is used in a WebView fetch with a tainted base URL. | -| UnsafeWebViewFetch.swift:188:25:188:25 | remoteString | UnsafeWebViewFetch.swift:94:14:94:37 | call to ... : | UnsafeWebViewFetch.swift:188:25:188:25 | remoteString | Tainted data is used in a WebView fetch with a tainted base URL. | -| UnsafeWebViewFetch.swift:210:25:210:25 | htmlData | UnsafeWebViewFetch.swift:94:14:94:37 | call to ... : | UnsafeWebViewFetch.swift:210:25:210:25 | htmlData | Tainted data is used in a WebView fetch without restricting the base URL. | +| UnsafeWebViewFetch.swift:103:25:103:84 | try! ... | UnsafeWebViewFetch.swift:103:30:103:84 | call to init : | UnsafeWebViewFetch.swift:103:25:103:84 | try! ... | Tainted data is used in a WebView fetch without restricting the base URL. | +| UnsafeWebViewFetch.swift:106:25:106:25 | data | UnsafeWebViewFetch.swift:105:18:105:72 | call to init : | UnsafeWebViewFetch.swift:106:25:106:25 | data | Tainted data is used in a WebView fetch without restricting the base URL. | +| UnsafeWebViewFetch.swift:109:25:109:53 | try! ... | UnsafeWebViewFetch.swift:109:30:109:53 | call to init : | UnsafeWebViewFetch.swift:109:25:109:53 | try! ... | Tainted data is used in a WebView fetch without restricting the base URL. | +| UnsafeWebViewFetch.swift:120:25:120:39 | call to getRemoteData() | UnsafeWebViewFetch.swift:94:14:94:37 | call to init : | UnsafeWebViewFetch.swift:120:25:120:39 | call to getRemoteData() | Tainted data is used in a WebView fetch without restricting the base URL. | +| UnsafeWebViewFetch.swift:121:25:121:25 | remoteString | UnsafeWebViewFetch.swift:94:14:94:37 | call to init : | UnsafeWebViewFetch.swift:121:25:121:25 | remoteString | Tainted data is used in a WebView fetch without restricting the base URL. | +| UnsafeWebViewFetch.swift:124:25:124:51 | ... .+(_:_:) ... | UnsafeWebViewFetch.swift:94:14:94:37 | call to init : | UnsafeWebViewFetch.swift:124:25:124:51 | ... .+(_:_:) ... | Tainted data is used in a WebView fetch without restricting the base URL. | +| UnsafeWebViewFetch.swift:127:25:127:25 | "..." | UnsafeWebViewFetch.swift:94:14:94:37 | call to init : | UnsafeWebViewFetch.swift:127:25:127:25 | "..." | Tainted data is used in a WebView fetch without restricting the base URL. | +| UnsafeWebViewFetch.swift:139:25:139:25 | remoteString | UnsafeWebViewFetch.swift:94:14:94:37 | call to init : | UnsafeWebViewFetch.swift:139:25:139:25 | remoteString | Tainted data is used in a WebView fetch with a tainted base URL. | +| UnsafeWebViewFetch.swift:141:25:141:25 | remoteString | UnsafeWebViewFetch.swift:94:14:94:37 | call to init : | UnsafeWebViewFetch.swift:141:25:141:25 | remoteString | Tainted data is used in a WebView fetch with a tainted base URL. | +| UnsafeWebViewFetch.swift:167:25:167:39 | call to getRemoteData() | UnsafeWebViewFetch.swift:94:14:94:37 | call to init : | UnsafeWebViewFetch.swift:167:25:167:39 | call to getRemoteData() | Tainted data is used in a WebView fetch without restricting the base URL. | +| UnsafeWebViewFetch.swift:168:25:168:25 | remoteString | UnsafeWebViewFetch.swift:94:14:94:37 | call to init : | UnsafeWebViewFetch.swift:168:25:168:25 | remoteString | Tainted data is used in a WebView fetch without restricting the base URL. | +| UnsafeWebViewFetch.swift:171:25:171:51 | ... .+(_:_:) ... | UnsafeWebViewFetch.swift:94:14:94:37 | call to init : | UnsafeWebViewFetch.swift:171:25:171:51 | ... .+(_:_:) ... | Tainted data is used in a WebView fetch without restricting the base URL. | +| UnsafeWebViewFetch.swift:174:25:174:25 | "..." | UnsafeWebViewFetch.swift:94:14:94:37 | call to init : | UnsafeWebViewFetch.swift:174:25:174:25 | "..." | Tainted data is used in a WebView fetch without restricting the base URL. | +| UnsafeWebViewFetch.swift:186:25:186:25 | remoteString | UnsafeWebViewFetch.swift:94:14:94:37 | call to init : | UnsafeWebViewFetch.swift:186:25:186:25 | remoteString | Tainted data is used in a WebView fetch with a tainted base URL. | +| UnsafeWebViewFetch.swift:188:25:188:25 | remoteString | UnsafeWebViewFetch.swift:94:14:94:37 | call to init : | UnsafeWebViewFetch.swift:188:25:188:25 | remoteString | Tainted data is used in a WebView fetch with a tainted base URL. | +| UnsafeWebViewFetch.swift:210:25:210:25 | htmlData | UnsafeWebViewFetch.swift:94:14:94:37 | call to init : | UnsafeWebViewFetch.swift:210:25:210:25 | htmlData | Tainted data is used in a WebView fetch without restricting the base URL. | diff --git a/swift/ql/test/query-tests/Security/CWE-135/StringLengthConflation.expected b/swift/ql/test/query-tests/Security/CWE-135/StringLengthConflation.expected index 90fa818d56a..325fbb1ea2b 100644 --- a/swift/ql/test/query-tests/Security/CWE-135/StringLengthConflation.expected +++ b/swift/ql/test/query-tests/Security/CWE-135/StringLengthConflation.expected @@ -1,84 +1,84 @@ edges -| StringLengthConflation2.swift:37:34:37:36 | .count : | StringLengthConflation2.swift:37:34:37:44 | ... call to -(_:_:) ... | -| StringLengthConflation.swift:60:47:60:50 | .length : | StringLengthConflation.swift:60:47:60:59 | ... call to /(_:_:) ... | -| StringLengthConflation.swift:66:33:66:36 | .length : | StringLengthConflation.swift:66:33:66:45 | ... call to /(_:_:) ... | -| StringLengthConflation.swift:96:28:96:31 | .length : | StringLengthConflation.swift:96:28:96:40 | ... call to -(_:_:) ... | -| StringLengthConflation.swift:100:27:100:30 | .length : | StringLengthConflation.swift:100:27:100:39 | ... call to -(_:_:) ... | -| StringLengthConflation.swift:104:25:104:28 | .length : | StringLengthConflation.swift:104:25:104:37 | ... call to -(_:_:) ... | -| StringLengthConflation.swift:108:25:108:28 | .length : | StringLengthConflation.swift:108:25:108:37 | ... call to -(_:_:) ... | -| StringLengthConflation.swift:114:23:114:26 | .length : | StringLengthConflation.swift:114:23:114:35 | ... call to -(_:_:) ... | -| StringLengthConflation.swift:120:22:120:25 | .length : | StringLengthConflation.swift:120:22:120:34 | ... call to -(_:_:) ... | -| StringLengthConflation.swift:125:34:125:36 | .count : | StringLengthConflation.swift:125:34:125:44 | ... call to -(_:_:) ... | -| StringLengthConflation.swift:126:36:126:38 | .count : | StringLengthConflation.swift:126:36:126:46 | ... call to -(_:_:) ... | -| StringLengthConflation.swift:131:36:131:38 | .count : | StringLengthConflation.swift:131:36:131:46 | ... call to -(_:_:) ... | -| StringLengthConflation.swift:132:38:132:40 | .count : | StringLengthConflation.swift:132:38:132:48 | ... call to -(_:_:) ... | -| StringLengthConflation.swift:137:34:137:36 | .count : | StringLengthConflation.swift:137:34:137:44 | ... call to -(_:_:) ... | -| StringLengthConflation.swift:138:36:138:38 | .count : | StringLengthConflation.swift:138:36:138:46 | ... call to -(_:_:) ... | -| StringLengthConflation.swift:144:28:144:30 | .count : | StringLengthConflation.swift:144:28:144:38 | ... call to -(_:_:) ... | +| StringLengthConflation2.swift:37:34:37:36 | .count : | StringLengthConflation2.swift:37:34:37:44 | ... .-(_:_:) ... | +| StringLengthConflation.swift:60:47:60:50 | .length : | StringLengthConflation.swift:60:47:60:59 | ... ./(_:_:) ... | +| StringLengthConflation.swift:66:33:66:36 | .length : | StringLengthConflation.swift:66:33:66:45 | ... ./(_:_:) ... | +| StringLengthConflation.swift:96:28:96:31 | .length : | StringLengthConflation.swift:96:28:96:40 | ... .-(_:_:) ... | +| StringLengthConflation.swift:100:27:100:30 | .length : | StringLengthConflation.swift:100:27:100:39 | ... .-(_:_:) ... | +| StringLengthConflation.swift:104:25:104:28 | .length : | StringLengthConflation.swift:104:25:104:37 | ... .-(_:_:) ... | +| StringLengthConflation.swift:108:25:108:28 | .length : | StringLengthConflation.swift:108:25:108:37 | ... .-(_:_:) ... | +| StringLengthConflation.swift:114:23:114:26 | .length : | StringLengthConflation.swift:114:23:114:35 | ... .-(_:_:) ... | +| StringLengthConflation.swift:120:22:120:25 | .length : | StringLengthConflation.swift:120:22:120:34 | ... .-(_:_:) ... | +| StringLengthConflation.swift:125:34:125:36 | .count : | StringLengthConflation.swift:125:34:125:44 | ... .-(_:_:) ... | +| StringLengthConflation.swift:126:36:126:38 | .count : | StringLengthConflation.swift:126:36:126:46 | ... .-(_:_:) ... | +| StringLengthConflation.swift:131:36:131:38 | .count : | StringLengthConflation.swift:131:36:131:46 | ... .-(_:_:) ... | +| StringLengthConflation.swift:132:38:132:40 | .count : | StringLengthConflation.swift:132:38:132:48 | ... .-(_:_:) ... | +| StringLengthConflation.swift:137:34:137:36 | .count : | StringLengthConflation.swift:137:34:137:44 | ... .-(_:_:) ... | +| StringLengthConflation.swift:138:36:138:38 | .count : | StringLengthConflation.swift:138:36:138:46 | ... .-(_:_:) ... | +| StringLengthConflation.swift:144:28:144:30 | .count : | StringLengthConflation.swift:144:28:144:38 | ... .-(_:_:) ... | nodes | StringLengthConflation2.swift:37:34:37:36 | .count : | semmle.label | .count : | -| StringLengthConflation2.swift:37:34:37:44 | ... call to -(_:_:) ... | semmle.label | ... call to -(_:_:) ... | +| StringLengthConflation2.swift:37:34:37:44 | ... .-(_:_:) ... | semmle.label | ... .-(_:_:) ... | | StringLengthConflation.swift:53:43:53:46 | .length | semmle.label | .length | | StringLengthConflation.swift:54:43:54:50 | .count | semmle.label | .count | | StringLengthConflation.swift:55:43:55:51 | .count | semmle.label | .count | | StringLengthConflation.swift:56:43:56:60 | .count | semmle.label | .count | | StringLengthConflation.swift:60:47:60:50 | .length : | semmle.label | .length : | -| StringLengthConflation.swift:60:47:60:59 | ... call to /(_:_:) ... | semmle.label | ... call to /(_:_:) ... | +| StringLengthConflation.swift:60:47:60:59 | ... ./(_:_:) ... | semmle.label | ... ./(_:_:) ... | | StringLengthConflation.swift:66:33:66:36 | .length : | semmle.label | .length : | -| StringLengthConflation.swift:66:33:66:45 | ... call to /(_:_:) ... | semmle.label | ... call to /(_:_:) ... | +| StringLengthConflation.swift:66:33:66:45 | ... ./(_:_:) ... | semmle.label | ... ./(_:_:) ... | | StringLengthConflation.swift:72:33:72:35 | .count | semmle.label | .count | | StringLengthConflation.swift:78:47:78:49 | .count | semmle.label | .count | | StringLengthConflation.swift:79:47:79:54 | .count | semmle.label | .count | | StringLengthConflation.swift:81:47:81:64 | .count | semmle.label | .count | | StringLengthConflation.swift:96:28:96:31 | .length : | semmle.label | .length : | -| StringLengthConflation.swift:96:28:96:40 | ... call to -(_:_:) ... | semmle.label | ... call to -(_:_:) ... | +| StringLengthConflation.swift:96:28:96:40 | ... .-(_:_:) ... | semmle.label | ... .-(_:_:) ... | | StringLengthConflation.swift:100:27:100:30 | .length : | semmle.label | .length : | -| StringLengthConflation.swift:100:27:100:39 | ... call to -(_:_:) ... | semmle.label | ... call to -(_:_:) ... | +| StringLengthConflation.swift:100:27:100:39 | ... .-(_:_:) ... | semmle.label | ... .-(_:_:) ... | | StringLengthConflation.swift:104:25:104:28 | .length : | semmle.label | .length : | -| StringLengthConflation.swift:104:25:104:37 | ... call to -(_:_:) ... | semmle.label | ... call to -(_:_:) ... | +| StringLengthConflation.swift:104:25:104:37 | ... .-(_:_:) ... | semmle.label | ... .-(_:_:) ... | | StringLengthConflation.swift:108:25:108:28 | .length : | semmle.label | .length : | -| StringLengthConflation.swift:108:25:108:37 | ... call to -(_:_:) ... | semmle.label | ... call to -(_:_:) ... | +| StringLengthConflation.swift:108:25:108:37 | ... .-(_:_:) ... | semmle.label | ... .-(_:_:) ... | | StringLengthConflation.swift:114:23:114:26 | .length : | semmle.label | .length : | -| StringLengthConflation.swift:114:23:114:35 | ... call to -(_:_:) ... | semmle.label | ... call to -(_:_:) ... | +| StringLengthConflation.swift:114:23:114:35 | ... .-(_:_:) ... | semmle.label | ... .-(_:_:) ... | | StringLengthConflation.swift:120:22:120:25 | .length : | semmle.label | .length : | -| StringLengthConflation.swift:120:22:120:34 | ... call to -(_:_:) ... | semmle.label | ... call to -(_:_:) ... | +| StringLengthConflation.swift:120:22:120:34 | ... .-(_:_:) ... | semmle.label | ... .-(_:_:) ... | | StringLengthConflation.swift:125:34:125:36 | .count : | semmle.label | .count : | -| StringLengthConflation.swift:125:34:125:44 | ... call to -(_:_:) ... | semmle.label | ... call to -(_:_:) ... | +| StringLengthConflation.swift:125:34:125:44 | ... .-(_:_:) ... | semmle.label | ... .-(_:_:) ... | | StringLengthConflation.swift:126:36:126:38 | .count : | semmle.label | .count : | -| StringLengthConflation.swift:126:36:126:46 | ... call to -(_:_:) ... | semmle.label | ... call to -(_:_:) ... | +| StringLengthConflation.swift:126:36:126:46 | ... .-(_:_:) ... | semmle.label | ... .-(_:_:) ... | | StringLengthConflation.swift:131:36:131:38 | .count : | semmle.label | .count : | -| StringLengthConflation.swift:131:36:131:46 | ... call to -(_:_:) ... | semmle.label | ... call to -(_:_:) ... | +| StringLengthConflation.swift:131:36:131:46 | ... .-(_:_:) ... | semmle.label | ... .-(_:_:) ... | | StringLengthConflation.swift:132:38:132:40 | .count : | semmle.label | .count : | -| StringLengthConflation.swift:132:38:132:48 | ... call to -(_:_:) ... | semmle.label | ... call to -(_:_:) ... | +| StringLengthConflation.swift:132:38:132:48 | ... .-(_:_:) ... | semmle.label | ... .-(_:_:) ... | | StringLengthConflation.swift:137:34:137:36 | .count : | semmle.label | .count : | -| StringLengthConflation.swift:137:34:137:44 | ... call to -(_:_:) ... | semmle.label | ... call to -(_:_:) ... | +| StringLengthConflation.swift:137:34:137:44 | ... .-(_:_:) ... | semmle.label | ... .-(_:_:) ... | | StringLengthConflation.swift:138:36:138:38 | .count : | semmle.label | .count : | -| StringLengthConflation.swift:138:36:138:46 | ... call to -(_:_:) ... | semmle.label | ... call to -(_:_:) ... | +| StringLengthConflation.swift:138:36:138:46 | ... .-(_:_:) ... | semmle.label | ... .-(_:_:) ... | | StringLengthConflation.swift:144:28:144:30 | .count : | semmle.label | .count : | -| StringLengthConflation.swift:144:28:144:38 | ... call to -(_:_:) ... | semmle.label | ... call to -(_:_:) ... | +| StringLengthConflation.swift:144:28:144:38 | ... .-(_:_:) ... | semmle.label | ... .-(_:_:) ... | subpaths #select -| StringLengthConflation2.swift:37:34:37:44 | ... call to -(_:_:) ... | StringLengthConflation2.swift:37:34:37:36 | .count : | StringLengthConflation2.swift:37:34:37:44 | ... call to -(_:_:) ... | This String length is used in an NSString, but it may not be equivalent. | +| StringLengthConflation2.swift:37:34:37:44 | ... .-(_:_:) ... | StringLengthConflation2.swift:37:34:37:36 | .count : | StringLengthConflation2.swift:37:34:37:44 | ... .-(_:_:) ... | This String length is used in an NSString, but it may not be equivalent. | | StringLengthConflation.swift:53:43:53:46 | .length | StringLengthConflation.swift:53:43:53:46 | .length | StringLengthConflation.swift:53:43:53:46 | .length | This NSString length is used in a String, but it may not be equivalent. | | StringLengthConflation.swift:54:43:54:50 | .count | StringLengthConflation.swift:54:43:54:50 | .count | StringLengthConflation.swift:54:43:54:50 | .count | This String.utf8 length is used in a String, but it may not be equivalent. | | StringLengthConflation.swift:55:43:55:51 | .count | StringLengthConflation.swift:55:43:55:51 | .count | StringLengthConflation.swift:55:43:55:51 | .count | This String.utf16 length is used in a String, but it may not be equivalent. | | StringLengthConflation.swift:56:43:56:60 | .count | StringLengthConflation.swift:56:43:56:60 | .count | StringLengthConflation.swift:56:43:56:60 | .count | This String.unicodeScalars length is used in a String, but it may not be equivalent. | -| StringLengthConflation.swift:60:47:60:59 | ... call to /(_:_:) ... | StringLengthConflation.swift:60:47:60:50 | .length : | StringLengthConflation.swift:60:47:60:59 | ... call to /(_:_:) ... | This NSString length is used in a String, but it may not be equivalent. | -| StringLengthConflation.swift:66:33:66:45 | ... call to /(_:_:) ... | StringLengthConflation.swift:66:33:66:36 | .length : | StringLengthConflation.swift:66:33:66:45 | ... call to /(_:_:) ... | This NSString length is used in a String, but it may not be equivalent. | +| StringLengthConflation.swift:60:47:60:59 | ... ./(_:_:) ... | StringLengthConflation.swift:60:47:60:50 | .length : | StringLengthConflation.swift:60:47:60:59 | ... ./(_:_:) ... | This NSString length is used in a String, but it may not be equivalent. | +| StringLengthConflation.swift:66:33:66:45 | ... ./(_:_:) ... | StringLengthConflation.swift:66:33:66:36 | .length : | StringLengthConflation.swift:66:33:66:45 | ... ./(_:_:) ... | This NSString length is used in a String, but it may not be equivalent. | | StringLengthConflation.swift:72:33:72:35 | .count | StringLengthConflation.swift:72:33:72:35 | .count | StringLengthConflation.swift:72:33:72:35 | .count | This String length is used in an NSString, but it may not be equivalent. | | StringLengthConflation.swift:78:47:78:49 | .count | StringLengthConflation.swift:78:47:78:49 | .count | StringLengthConflation.swift:78:47:78:49 | .count | This String length is used in an NSString, but it may not be equivalent. | | StringLengthConflation.swift:79:47:79:54 | .count | StringLengthConflation.swift:79:47:79:54 | .count | StringLengthConflation.swift:79:47:79:54 | .count | This String.utf8 length is used in an NSString, but it may not be equivalent. | | StringLengthConflation.swift:81:47:81:64 | .count | StringLengthConflation.swift:81:47:81:64 | .count | StringLengthConflation.swift:81:47:81:64 | .count | This String.unicodeScalars length is used in an NSString, but it may not be equivalent. | -| StringLengthConflation.swift:96:28:96:40 | ... call to -(_:_:) ... | StringLengthConflation.swift:96:28:96:31 | .length : | StringLengthConflation.swift:96:28:96:40 | ... call to -(_:_:) ... | This NSString length is used in a String, but it may not be equivalent. | -| StringLengthConflation.swift:100:27:100:39 | ... call to -(_:_:) ... | StringLengthConflation.swift:100:27:100:30 | .length : | StringLengthConflation.swift:100:27:100:39 | ... call to -(_:_:) ... | This NSString length is used in a String, but it may not be equivalent. | -| StringLengthConflation.swift:104:25:104:37 | ... call to -(_:_:) ... | StringLengthConflation.swift:104:25:104:28 | .length : | StringLengthConflation.swift:104:25:104:37 | ... call to -(_:_:) ... | This NSString length is used in a String, but it may not be equivalent. | -| StringLengthConflation.swift:108:25:108:37 | ... call to -(_:_:) ... | StringLengthConflation.swift:108:25:108:28 | .length : | StringLengthConflation.swift:108:25:108:37 | ... call to -(_:_:) ... | This NSString length is used in a String, but it may not be equivalent. | -| StringLengthConflation.swift:114:23:114:35 | ... call to -(_:_:) ... | StringLengthConflation.swift:114:23:114:26 | .length : | StringLengthConflation.swift:114:23:114:35 | ... call to -(_:_:) ... | This NSString length is used in a String, but it may not be equivalent. | -| StringLengthConflation.swift:120:22:120:34 | ... call to -(_:_:) ... | StringLengthConflation.swift:120:22:120:25 | .length : | StringLengthConflation.swift:120:22:120:34 | ... call to -(_:_:) ... | This NSString length is used in a String, but it may not be equivalent. | -| StringLengthConflation.swift:125:34:125:44 | ... call to -(_:_:) ... | StringLengthConflation.swift:125:34:125:36 | .count : | StringLengthConflation.swift:125:34:125:44 | ... call to -(_:_:) ... | This String length is used in an NSString, but it may not be equivalent. | -| StringLengthConflation.swift:126:36:126:46 | ... call to -(_:_:) ... | StringLengthConflation.swift:126:36:126:38 | .count : | StringLengthConflation.swift:126:36:126:46 | ... call to -(_:_:) ... | This String length is used in an NSString, but it may not be equivalent. | -| StringLengthConflation.swift:131:36:131:46 | ... call to -(_:_:) ... | StringLengthConflation.swift:131:36:131:38 | .count : | StringLengthConflation.swift:131:36:131:46 | ... call to -(_:_:) ... | This String length is used in an NSString, but it may not be equivalent. | -| StringLengthConflation.swift:132:38:132:48 | ... call to -(_:_:) ... | StringLengthConflation.swift:132:38:132:40 | .count : | StringLengthConflation.swift:132:38:132:48 | ... call to -(_:_:) ... | This String length is used in an NSString, but it may not be equivalent. | -| StringLengthConflation.swift:137:34:137:44 | ... call to -(_:_:) ... | StringLengthConflation.swift:137:34:137:36 | .count : | StringLengthConflation.swift:137:34:137:44 | ... call to -(_:_:) ... | This String length is used in an NSString, but it may not be equivalent. | -| StringLengthConflation.swift:138:36:138:46 | ... call to -(_:_:) ... | StringLengthConflation.swift:138:36:138:38 | .count : | StringLengthConflation.swift:138:36:138:46 | ... call to -(_:_:) ... | This String length is used in an NSString, but it may not be equivalent. | -| StringLengthConflation.swift:144:28:144:38 | ... call to -(_:_:) ... | StringLengthConflation.swift:144:28:144:30 | .count : | StringLengthConflation.swift:144:28:144:38 | ... call to -(_:_:) ... | This String length is used in an NSString, but it may not be equivalent. | +| StringLengthConflation.swift:96:28:96:40 | ... .-(_:_:) ... | StringLengthConflation.swift:96:28:96:31 | .length : | StringLengthConflation.swift:96:28:96:40 | ... .-(_:_:) ... | This NSString length is used in a String, but it may not be equivalent. | +| StringLengthConflation.swift:100:27:100:39 | ... .-(_:_:) ... | StringLengthConflation.swift:100:27:100:30 | .length : | StringLengthConflation.swift:100:27:100:39 | ... .-(_:_:) ... | This NSString length is used in a String, but it may not be equivalent. | +| StringLengthConflation.swift:104:25:104:37 | ... .-(_:_:) ... | StringLengthConflation.swift:104:25:104:28 | .length : | StringLengthConflation.swift:104:25:104:37 | ... .-(_:_:) ... | This NSString length is used in a String, but it may not be equivalent. | +| StringLengthConflation.swift:108:25:108:37 | ... .-(_:_:) ... | StringLengthConflation.swift:108:25:108:28 | .length : | StringLengthConflation.swift:108:25:108:37 | ... .-(_:_:) ... | This NSString length is used in a String, but it may not be equivalent. | +| StringLengthConflation.swift:114:23:114:35 | ... .-(_:_:) ... | StringLengthConflation.swift:114:23:114:26 | .length : | StringLengthConflation.swift:114:23:114:35 | ... .-(_:_:) ... | This NSString length is used in a String, but it may not be equivalent. | +| StringLengthConflation.swift:120:22:120:34 | ... .-(_:_:) ... | StringLengthConflation.swift:120:22:120:25 | .length : | StringLengthConflation.swift:120:22:120:34 | ... .-(_:_:) ... | This NSString length is used in a String, but it may not be equivalent. | +| StringLengthConflation.swift:125:34:125:44 | ... .-(_:_:) ... | StringLengthConflation.swift:125:34:125:36 | .count : | StringLengthConflation.swift:125:34:125:44 | ... .-(_:_:) ... | This String length is used in an NSString, but it may not be equivalent. | +| StringLengthConflation.swift:126:36:126:46 | ... .-(_:_:) ... | StringLengthConflation.swift:126:36:126:38 | .count : | StringLengthConflation.swift:126:36:126:46 | ... .-(_:_:) ... | This String length is used in an NSString, but it may not be equivalent. | +| StringLengthConflation.swift:131:36:131:46 | ... .-(_:_:) ... | StringLengthConflation.swift:131:36:131:38 | .count : | StringLengthConflation.swift:131:36:131:46 | ... .-(_:_:) ... | This String length is used in an NSString, but it may not be equivalent. | +| StringLengthConflation.swift:132:38:132:48 | ... .-(_:_:) ... | StringLengthConflation.swift:132:38:132:40 | .count : | StringLengthConflation.swift:132:38:132:48 | ... .-(_:_:) ... | This String length is used in an NSString, but it may not be equivalent. | +| StringLengthConflation.swift:137:34:137:44 | ... .-(_:_:) ... | StringLengthConflation.swift:137:34:137:36 | .count : | StringLengthConflation.swift:137:34:137:44 | ... .-(_:_:) ... | This String length is used in an NSString, but it may not be equivalent. | +| StringLengthConflation.swift:138:36:138:46 | ... .-(_:_:) ... | StringLengthConflation.swift:138:36:138:38 | .count : | StringLengthConflation.swift:138:36:138:46 | ... .-(_:_:) ... | This String length is used in an NSString, but it may not be equivalent. | +| StringLengthConflation.swift:144:28:144:38 | ... .-(_:_:) ... | StringLengthConflation.swift:144:28:144:30 | .count : | StringLengthConflation.swift:144:28:144:38 | ... .-(_:_:) ... | This String length is used in an NSString, but it may not be equivalent. | From e3f86a9eb08a9f4c70cc63527ca7a58ca9ea405e Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Fri, 19 Aug 2022 15:03:18 +0200 Subject: [PATCH 26/30] Swift: fix QL warning --- swift/ql/lib/codeql/swift/elements/expr/MethodRefExpr.qll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swift/ql/lib/codeql/swift/elements/expr/MethodRefExpr.qll b/swift/ql/lib/codeql/swift/elements/expr/MethodRefExpr.qll index c2c54b7b041..4b44e05b415 100644 --- a/swift/ql/lib/codeql/swift/elements/expr/MethodRefExpr.qll +++ b/swift/ql/lib/codeql/swift/elements/expr/MethodRefExpr.qll @@ -17,7 +17,7 @@ class MethodRefExpr extends MethodRefExprBase { Synth::convertDeclFromRaw(this.getUnderlying().getFunction().(Raw::DeclRefExpr).getDecl()) } - AbstractFunctionDecl getMethod() { result = getMember() } + AbstractFunctionDecl getMethod() { result = this.getMember() } cached private Raw::DotSyntaxCallExpr getUnderlying() { this = Synth::TMethodRefExpr(result) } From 6706ba6ded037fe3226b71f80b0640e67779b29b Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Fri, 19 Aug 2022 15:22:02 +0200 Subject: [PATCH 27/30] Swift: accept `toString` changes in tests --- swift/ql/test/extractor-tests/expressions/all.expected | 6 +++--- .../generated/expr/EnumIsCaseExpr/EnumIsCaseExpr.expected | 2 +- swift/ql/test/extractor-tests/types/Types.expected | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/swift/ql/test/extractor-tests/expressions/all.expected b/swift/ql/test/extractor-tests/expressions/all.expected index 15d95241c4f..5f368ebb6e9 100644 --- a/swift/ql/test/extractor-tests/expressions/all.expected +++ b/swift/ql/test/extractor-tests/expressions/all.expected @@ -46,7 +46,7 @@ | expressions.swift:27:13:27:13 | Klass.Type | TypeExpr | | expressions.swift:27:13:27:13 | call to init | ConstructorRefCallExpr | | expressions.swift:27:13:27:13 | init | DeclRefExpr | -| expressions.swift:27:13:27:19 | call to ... | CallExpr | +| expressions.swift:27:13:27:19 | call to init | CallExpr | | expressions.swift:29:9:29:19 | [...] | DictionaryExpr | | expressions.swift:29:10:29:10 | 1 | StringLiteralExpr | | expressions.swift:29:10:29:16 | (...) | TupleExpr | @@ -164,7 +164,7 @@ | expressions.swift:83:15:83:15 | Derived.Type | TypeExpr | | expressions.swift:83:15:83:15 | call to init | ConstructorRefCallExpr | | expressions.swift:83:15:83:15 | init | DeclRefExpr | -| expressions.swift:83:15:83:23 | call to ... | CallExpr | +| expressions.swift:83:15:83:23 | call to init | CallExpr | | expressions.swift:84:1:84:1 | _ | DiscardAssignmentExpr | | expressions.swift:84:1:84:13 | ... = ... | AssignExpr | | expressions.swift:84:5:84:5 | (Base) ... | DerivedToBaseExpr | @@ -185,7 +185,7 @@ | expressions.swift:92:37:92:37 | ToPtr.Type | TypeExpr | | expressions.swift:92:37:92:37 | call to init | ConstructorRefCallExpr | | expressions.swift:92:37:92:37 | init | DeclRefExpr | -| expressions.swift:92:37:92:43 | call to ... | CallExpr | +| expressions.swift:92:37:92:43 | call to init | CallExpr | | expressions.swift:92:46:92:46 | toOpaque() | DeclRefExpr | | expressions.swift:93:1:93:16 | Unmanaged.Type | TypeExpr | | expressions.swift:93:1:93:18 | .fromOpaque(_:) | MethodRefExpr | diff --git a/swift/ql/test/extractor-tests/generated/expr/EnumIsCaseExpr/EnumIsCaseExpr.expected b/swift/ql/test/extractor-tests/generated/expr/EnumIsCaseExpr/EnumIsCaseExpr.expected index 6076a256058..e11faecf54b 100644 --- a/swift/ql/test/extractor-tests/generated/expr/EnumIsCaseExpr/EnumIsCaseExpr.expected +++ b/swift/ql/test/extractor-tests/generated/expr/EnumIsCaseExpr/EnumIsCaseExpr.expected @@ -7,4 +7,4 @@ | enum_is_case.swift:21:1:21:5 | ... is some | getSubExpr: | enum_is_case.swift:21:1:21:5 | [...] | getElement: | file://:0:0:0:0 | some | | enum_is_case.swift:22:1:22:10 | ... is some | getSubExpr: | enum_is_case.swift:22:1:22:10 | [...] | getElement: | file://:0:0:0:0 | some | | enum_is_case.swift:23:1:23:10 | ... is some | getSubExpr: | enum_is_case.swift:23:1:23:10 | [...] | getElement: | file://:0:0:0:0 | some | -| enum_is_case.swift:24:1:24:8 | ... is some | getSubExpr: | enum_is_case.swift:24:1:24:8 | call to ... | getElement: | file://:0:0:0:0 | some | +| enum_is_case.swift:24:1:24:8 | ... is some | getSubExpr: | enum_is_case.swift:24:1:24:8 | call to init | getElement: | file://:0:0:0:0 | some | diff --git a/swift/ql/test/extractor-tests/types/Types.expected b/swift/ql/test/extractor-tests/types/Types.expected index 5fabd2589a5..b4685b5ddc2 100644 --- a/swift/ql/test/extractor-tests/types/Types.expected +++ b/swift/ql/test/extractor-tests/types/Types.expected @@ -15,14 +15,14 @@ | types.swift:7:16:7:16 | X.Type | X.Type | | types.swift:7:16:7:16 | call to init | () -> X | | types.swift:7:16:7:16 | init | (X.Type) -> () -> X | -| types.swift:7:16:7:18 | call to ... | X | +| types.swift:7:16:7:18 | call to init | X | | types.swift:13:17:13:17 | C.Type | C.Type | | types.swift:13:17:13:17 | call to init | () -> C | | types.swift:13:17:13:17 | init | (C.Type) -> () -> C | -| types.swift:13:17:13:19 | call to ... | C | +| types.swift:13:17:13:19 | call to init | C | | types.swift:14:22:14:24 | C.Nested.Type | C.Nested.Type | | types.swift:14:22:14:24 | call to init | () -> C.Nested | -| types.swift:14:22:14:31 | call to ... | C.Nested | +| types.swift:14:22:14:31 | call to init | C.Nested | | types.swift:14:24:14:24 | init | (C.Nested.Type) -> () -> C.Nested | | types.swift:17:10:17:10 | x | Int | | types.swift:17:10:17:14 | ... .+(_:_:) ... | Int | From 66459b81da93e76d20f5eadbebcea75e6047756b Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Fri, 19 Aug 2022 15:31:00 +0200 Subject: [PATCH 28/30] Swift: use field in `MethodApplyExpr` Also rename `getMethod` to `getMethodDeclaration` to clear up possible confusion with `getFunction`. --- swift/ql/lib/codeql/swift/elements/expr/ApplyExpr.qll | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/swift/ql/lib/codeql/swift/elements/expr/ApplyExpr.qll b/swift/ql/lib/codeql/swift/elements/expr/ApplyExpr.qll index 09efb4098fe..85b84b4b9c5 100644 --- a/swift/ql/lib/codeql/swift/elements/expr/ApplyExpr.qll +++ b/swift/ql/lib/codeql/swift/elements/expr/ApplyExpr.qll @@ -30,9 +30,11 @@ class ApplyExpr extends ApplyExprBase { } class MethodApplyExpr extends ApplyExpr { - MethodApplyExpr() { this.getFunction() instanceof MethodRefExpr } + private MethodRefExpr method; - AbstractFunctionDecl getMethod() { result = this.getFunction().(MethodRefExpr).getMethod() } + MethodApplyExpr() { method = this.getFunction() } - override Expr getQualifier() { result = this.getFunction().(MethodRefExpr).getBase() } + AbstractFunctionDecl getMethodDeclaration() { result = method.getMethod() } + + override Expr getQualifier() { result = method.getBase() } } From f0ec43b04c6be5f328edf13ec400142aa1055149 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Fri, 19 Aug 2022 15:37:49 +0200 Subject: [PATCH 29/30] Swift: remove `getMethodDeclaration` `getStaticTarget` gives the same result. --- swift/ql/lib/codeql/swift/elements/expr/ApplyExpr.qll | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/swift/ql/lib/codeql/swift/elements/expr/ApplyExpr.qll b/swift/ql/lib/codeql/swift/elements/expr/ApplyExpr.qll index 85b84b4b9c5..63053cec32f 100644 --- a/swift/ql/lib/codeql/swift/elements/expr/ApplyExpr.qll +++ b/swift/ql/lib/codeql/swift/elements/expr/ApplyExpr.qll @@ -11,8 +11,6 @@ class ApplyExpr extends ApplyExprBase { ( result = f.(DeclRefExpr).getDecl() or - result = f.(MethodRefExpr).getMethod() - or result = f.(ConstructorRefCallExpr).getFunction().(DeclRefExpr).getDecl() ) ) @@ -34,7 +32,7 @@ class MethodApplyExpr extends ApplyExpr { MethodApplyExpr() { method = this.getFunction() } - AbstractFunctionDecl getMethodDeclaration() { result = method.getMethod() } + override AbstractFunctionDecl getStaticTarget() { result = method.getMethod() } override Expr getQualifier() { result = method.getBase() } } From 631d234026ff578709c30a0b782a6575c00963cf Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Fri, 19 Aug 2022 16:15:17 +0200 Subject: [PATCH 30/30] Swift: expand tests --- .../DotSyntaxCallExpr/DotSyntaxCallExpr.expected | 4 +++- .../DotSyntaxCallExpr_getArgument.expected | 4 +++- .../DotSyntaxCallExpr_getType.expected | 4 +++- .../expr/DotSyntaxCallExpr/dot_syntax_call.swift | 7 +++++++ .../expr/MethodRefExpr/MethodRefExpr.expected | 10 ++++++---- .../MethodRefExpr_getMember.expected | 10 ++++++---- .../MethodRefExpr/MethodRefExpr_getType.expected | 10 ++++++---- .../expr/MethodRefExpr/method_refs.swift | 15 +++++++++------ 8 files changed, 43 insertions(+), 21 deletions(-) diff --git a/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr.expected b/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr.expected index d2996aae3dc..6d9c6f210c6 100644 --- a/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr.expected +++ b/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr.expected @@ -1 +1,3 @@ -| dot_syntax_call.swift:9:9:9:11 | call to ... | getFunction: | dot_syntax_call.swift:9:11:9:11 | { ... } | getBase: | dot_syntax_call.swift:9:9:9:9 | X.Type | +| dot_syntax_call.swift:7:13:7:13 | call to ... | getFunction: | dot_syntax_call.swift:7:13:7:13 | { ... } | getBase: | dot_syntax_call.swift:7:13:7:13 | self | +| dot_syntax_call.swift:15:9:15:11 | call to ... | getFunction: | dot_syntax_call.swift:15:11:15:11 | { ... } | getBase: | dot_syntax_call.swift:15:9:15:9 | X.Type | +| dot_syntax_call.swift:16:9:16:13 | call to ... | getFunction: | dot_syntax_call.swift:16:13:16:13 | { ... } | getBase: | dot_syntax_call.swift:16:9:16:11 | call to init | diff --git a/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr_getArgument.expected b/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr_getArgument.expected index ba594961b2b..a9b9f68dae3 100644 --- a/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr_getArgument.expected +++ b/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr_getArgument.expected @@ -1 +1,3 @@ -| dot_syntax_call.swift:9:9:9:11 | call to ... | 0 | dot_syntax_call.swift:9:9:9:9 | : X.Type | +| dot_syntax_call.swift:7:13:7:13 | call to ... | 0 | dot_syntax_call.swift:7:13:7:13 | : self | +| dot_syntax_call.swift:15:9:15:11 | call to ... | 0 | dot_syntax_call.swift:15:9:15:9 | : X.Type | +| dot_syntax_call.swift:16:9:16:13 | call to ... | 0 | dot_syntax_call.swift:16:9:16:11 | : call to init | diff --git a/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr_getType.expected b/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr_getType.expected index b818fe3a8a1..6e3388a4a60 100644 --- a/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr_getType.expected +++ b/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/DotSyntaxCallExpr_getType.expected @@ -1 +1,3 @@ -| dot_syntax_call.swift:9:9:9:11 | call to ... | () -> () | +| dot_syntax_call.swift:7:13:7:13 | call to ... | (Int) -> () | +| dot_syntax_call.swift:15:9:15:11 | call to ... | () -> () | +| dot_syntax_call.swift:16:9:16:13 | call to ... | (Int) -> () | diff --git a/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/dot_syntax_call.swift b/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/dot_syntax_call.swift index 825a1079fd6..18e978f3dca 100644 --- a/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/dot_syntax_call.swift +++ b/swift/ql/test/extractor-tests/generated/expr/DotSyntaxCallExpr/dot_syntax_call.swift @@ -1,9 +1,16 @@ class X { static func foo(_: Int, _:Int) {} class func bar() {} + func baz(_: Int) {} + + init() { + let f = baz + } } X.foo(1, 2) X.bar() +X().baz(42) let f = X.bar +let g = X().baz diff --git a/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr.expected b/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr.expected index 5569b8a47de..46343c679be 100644 --- a/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr.expected +++ b/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr.expected @@ -1,4 +1,6 @@ -| method_refs.swift:5:13:5:13 | .bar(_:) | getBase: | file://:0:0:0:0 | self | -| method_refs.swift:6:5:6:5 | .bar(_:) | getBase: | method_refs.swift:6:5:6:5 | self | -| method_refs.swift:11:1:11:3 | .bar(_:) | getBase: | method_refs.swift:11:1:11:1 | x | -| method_refs.swift:13:11:13:11 | .bar(_:) | getBase: | file://:0:0:0:0 | self | +| method_refs.swift:7:13:7:13 | .baz(_:) | getBase: | file://:0:0:0:0 | self | +| method_refs.swift:11:1:11:3 | .foo(_:_:) | getBase: | method_refs.swift:11:1:11:1 | X.Type | +| method_refs.swift:12:1:12:3 | .bar() | getBase: | method_refs.swift:12:1:12:1 | X.Type | +| method_refs.swift:13:1:13:5 | .baz(_:) | getBase: | method_refs.swift:13:1:13:3 | call to init | +| method_refs.swift:15:11:15:11 | .bar() | getBase: | file://:0:0:0:0 | self | +| method_refs.swift:16:13:16:13 | .baz(_:) | getBase: | file://:0:0:0:0 | self | diff --git a/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getMember.expected b/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getMember.expected index dd3f2c4eb42..0e32e70178a 100644 --- a/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getMember.expected +++ b/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getMember.expected @@ -1,4 +1,6 @@ -| method_refs.swift:5:13:5:13 | .bar(_:) | method_refs.swift:2:3:2:21 | bar(_:) | -| method_refs.swift:6:5:6:5 | .bar(_:) | method_refs.swift:2:3:2:21 | bar(_:) | -| method_refs.swift:11:1:11:3 | .bar(_:) | method_refs.swift:2:3:2:21 | bar(_:) | -| method_refs.swift:13:11:13:11 | .bar(_:) | method_refs.swift:2:3:2:21 | bar(_:) | +| method_refs.swift:7:13:7:13 | .baz(_:) | method_refs.swift:4:3:4:21 | baz(_:) | +| method_refs.swift:11:1:11:3 | .foo(_:_:) | method_refs.swift:2:3:2:35 | foo(_:_:) | +| method_refs.swift:12:1:12:3 | .bar() | method_refs.swift:3:3:3:21 | bar() | +| method_refs.swift:13:1:13:5 | .baz(_:) | method_refs.swift:4:3:4:21 | baz(_:) | +| method_refs.swift:15:11:15:11 | .bar() | method_refs.swift:3:3:3:21 | bar() | +| method_refs.swift:16:13:16:13 | .baz(_:) | method_refs.swift:4:3:4:21 | baz(_:) | diff --git a/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getType.expected b/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getType.expected index b9f7f52d9f7..58ee6536be7 100644 --- a/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getType.expected +++ b/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/MethodRefExpr_getType.expected @@ -1,4 +1,6 @@ -| method_refs.swift:5:13:5:13 | .bar(_:) | (Int) -> () | -| method_refs.swift:6:5:6:5 | .bar(_:) | (Int) -> () | -| method_refs.swift:11:1:11:3 | .bar(_:) | (Int) -> () | -| method_refs.swift:13:11:13:11 | .bar(_:) | (Int) -> () | +| method_refs.swift:7:13:7:13 | .baz(_:) | (Int) -> () | +| method_refs.swift:11:1:11:3 | .foo(_:_:) | (Int, Int) -> () | +| method_refs.swift:12:1:12:3 | .bar() | () -> () | +| method_refs.swift:13:1:13:5 | .baz(_:) | (Int) -> () | +| method_refs.swift:15:11:15:11 | .bar() | () -> () | +| method_refs.swift:16:13:16:13 | .baz(_:) | (Int) -> () | diff --git a/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/method_refs.swift b/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/method_refs.swift index 84fda171efe..18e978f3dca 100644 --- a/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/method_refs.swift +++ b/swift/ql/test/extractor-tests/generated/expr/MethodRefExpr/method_refs.swift @@ -1,13 +1,16 @@ class X { - func bar(_: Int) {} + static func foo(_: Int, _:Int) {} + class func bar() {} + func baz(_: Int) {} init() { - let f = bar - bar(0) + let f = baz } } -let x = X() -x.bar(42) +X.foo(1, 2) +X.bar() +X().baz(42) -let f = x.bar +let f = X.bar +let g = X().baz