Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift: make extractor compilable with Swift 6 #17699

Merged
merged 58 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
524686c
Swift: make extractor compilable with Swift 6
Oct 8, 2024
d3fb254
Swift: try out new builds
Oct 30, 2024
91f683d
Merge branch 'main' into redsun82/swift-6
Oct 30, 2024
d325b8e
Swift: update `load.bzl` and resources
Oct 30, 2024
df8184e
Swift: fix `check-no-override` job
Oct 30, 2024
5e6228c
Swift: fix
Oct 30, 2024
0141702
Swift: use `ubuntu-latest`
Oct 30, 2024
3877eb8
Swift: tentatively fix type mangling
Oct 30, 2024
66e43c4
Swift: use ubuntu 22.04
Oct 30, 2024
7f3745c
Swift: fix `@isolated(any)` DB inconsistencies
redsun82 Oct 31, 2024
34b8b43
Swift: use `-typecheck` in QL tests
Oct 31, 2024
3aa7123
Swift: restrict `UnresolvedAstNodes` to known locations
redsun82 Oct 31, 2024
ce4273d
Revert "Swift: use `-typecheck` in QL tests"
redsun82 Oct 31, 2024
5a045be
Swift: turn off SIL verifications
redsun82 Oct 31, 2024
1f35607
Swift: temporarily accept test changes
Oct 31, 2024
6f0f739
Swift: Update dropFirst / dropLast / reversed models for Swift 6.
geoffw0 Nov 1, 2024
be12649
Swift: Update joined models for Swift 6.
geoffw0 Nov 1, 2024
954fbc4
Swift: Update prefix / suffix models for Swift 6.
geoffw0 Nov 1, 2024
f3ea75d
Swift: Further modelling updates / gap filling that doesn't seem to a…
geoffw0 Nov 1, 2024
24c4e87
Swift: Fix stray [].
geoffw0 Nov 1, 2024
87a08fe
Merge pull request #17891 from geoffw0/swift6models
redsun82 Nov 5, 2024
c875667
Swift: update to 6.0.2
Nov 6, 2024
afd4585
Merge branch 'main' into redsun82/swift-6
Nov 6, 2024
9e1e56f
Swift: remove obsolete bazel definitions
Nov 6, 2024
02a0021
Swift: tweak mangling of extensions
Nov 6, 2024
51f7129
Swift: accept integration test change
Nov 6, 2024
f0dc4f5
Swift: Convert the dataflow-taint-core-conversions test to labelled s…
geoffw0 Nov 14, 2024
570393f
Swift: Additional test cases.
geoffw0 Nov 14, 2024
c2c23c8
Swift: Address some modelling issues for Swift 6.
geoffw0 Nov 14, 2024
6aa43e0
Swift: Effect on other tests.
geoffw0 Nov 14, 2024
e589b1f
Swift: Fix query barriers.
geoffw0 Nov 14, 2024
8245e6c
Swift: Fix unwanted flows.
geoffw0 Nov 14, 2024
fa43207
Swift: Autoformat.
geoffw0 Nov 18, 2024
8bcc5f4
Merge pull request #17989 from geoffw0/swift6models2
redsun82 Nov 18, 2024
6130679
Swift: Label the now missing cases for CWE-020 and dataflow.
geoffw0 Nov 26, 2024
4585852
Swift: Add another test case.
geoffw0 Nov 26, 2024
d1915c7
Swift: Add a test revealing the issue in pure dataflow.
geoffw0 Nov 26, 2024
814218c
Swift: extract variables as children of `ForEachStmt`
Nov 28, 2024
1d43abf
Swift: Model Collection.makeIterator().
geoffw0 Nov 28, 2024
23ed48e
Swift: Add a couple more makeIterator() implementations to be safe.
geoffw0 Nov 28, 2024
14b70b8
Merge pull request #18143 from geoffw0/swift6models3
geoffw0 Nov 28, 2024
e08eac0
Swift: Fix for Int.description.
geoffw0 Nov 28, 2024
1fc112e
Swift: Fix for OptionSet.
geoffw0 Nov 28, 2024
e9deec7
Rust: Autoformat.
geoffw0 Nov 29, 2024
eeed2c2
Merge pull request #18154 from geoffw0/swift6models4
geoffw0 Nov 29, 2024
9da7e8a
Merge pull request #18142 from github/redsun82/swift-6-for-each-vars
redsun82 Dec 4, 2024
4ac602c
Merge branch 'main' into redsun82/swift-6
Dec 6, 2024
7ee3bf9
Swift: add update/downgrade scripts
Dec 6, 2024
bed6387
Swift: remove linux QL tests check
Dec 6, 2024
f81f30c
Swift: accept test changes
redsun82 Dec 6, 2024
a4f7981
Swift: accept test changes
redsun82 Dec 6, 2024
a82d37e
Swift: fix gracefully accepting missing `ForEachStmt.iteratorVar`
redsun82 Dec 6, 2024
263bd69
Swift: fix artifact update infrastructure
redsun82 Dec 6, 2024
926d65b
Swift: update LFS artifacts and remove override
redsun82 Dec 6, 2024
198417c
Swift: fix filename case for prebuilt artifacts
Dec 6, 2024
3bc822f
Swift: add change note for Swift 6 upgrade
Dec 9, 2024
5ca89ea
Merge branch 'main' into redsun82/swift-6
Dec 12, 2024
92ec7e8
Merge branch 'main' into redsun82/swift-6
redsun82 Dec 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,5 @@
/misc/ripunzip/ripunzip-* filter=lfs diff=lfs merge=lfs -text

# swift prebuilt resources
/swift/third_party/resource-dir/*.zip filter=lfs diff=lfs merge=lfs -text
/swift/third_party/resources/*.zip filter=lfs diff=lfs merge=lfs -text
/swift/third_party/resources/*.tar.zst filter=lfs diff=lfs merge=lfs -text
11 changes: 9 additions & 2 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ jobs:
- uses: ./swift/actions/build-and-test
build-and-test-linux:
if: github.repository_owner == 'github'
runs-on: ubuntu-latest-xl
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./swift/actions/build-and-test
qltests-linux:
if: github.repository_owner == 'github'
needs: build-and-test-linux
runs-on: ubuntu-latest-xl
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./swift/actions/run-ql-tests
Expand Down Expand Up @@ -109,3 +109,10 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/fetch-codeql
- uses: ./swift/actions/database-upgrade-scripts
check-no-override:
if : github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- shell: bash
run: bazel test //swift/... --test_tag_filters=override --test_output=errors
19 changes: 5 additions & 14 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ bazel_dep(name = "gazelle", version = "0.38.0")
bazel_dep(name = "rules_dotnet", version = "0.16.1")
bazel_dep(name = "googletest", version = "1.14.0.bcr.1")
bazel_dep(name = "rules_rust", version = "0.52.2")
bazel_dep(name = "zstd", version = "1.5.5.bcr.1")

bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)

Expand Down Expand Up @@ -91,10 +92,10 @@ use_repo(
swift_deps,
"binlog",
"picosha2",
"swift_prebuilt_darwin_x86_64",
"swift_prebuilt_linux",
"swift_toolchain_linux",
"swift_toolchain_macos",
"swift-prebuilt-linux",
"swift-prebuilt-macos",
"swift-resource-dir-linux",
"swift-resource-dir-macos",
)

node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node")
Expand Down Expand Up @@ -186,16 +187,6 @@ lfs_files(
executable = True,
)

lfs_files(
name = "swift-resource-dir-linux",
srcs = ["//swift/third_party/resource-dir:resource-dir-linux.zip"],
)

lfs_files(
name = "swift-resource-dir-macos",
srcs = ["//swift/third_party/resource-dir:resource-dir-macos.zip"],
)

register_toolchains(
"@nodejs_toolchains//:all",
)
6 changes: 6 additions & 0 deletions misc/bazel/lfs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ def _download_lfs(repository_ctx):
)
repository_ctx.file("BUILD.bazel", build)

# this is for drop-in compatibility with `http_file`
repository_ctx.file(
"file/BUILD.bazel",
'alias(name = "file", actual = "//:%s", visibility = ["//visibility:public"])\n' % name,
)

lfs_archive = repository_rule(
doc = "Export the contents from an on-demand LFS archive. The corresponding path should be added to be ignored " +
"in `.lfsconfig`.",
Expand Down
2 changes: 1 addition & 1 deletion swift/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ codeql_pack(
zips = select({
"@platforms//os:windows": {},
"//conditions:default": {
"//swift/third_party/resource-dir": "resource-dir/{CODEQL_PLATFORM}",
"//swift/third_party/resources:dir": "resource-dir/{CODEQL_PLATFORM}",
},
}),
)
Expand Down
5 changes: 5 additions & 0 deletions swift/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,8 @@ In particular for breakpoints to work you might need to setup the following remo
### Thread safety

The extractor is single-threaded, and there was no effort to make anything in it thread-safe.

### Updating the swift compiler version

This can only be done with access to the internal repository at the moment. Some (incomplete) instructions are
found [here](third_party/resources/updating.md).
2 changes: 1 addition & 1 deletion swift/actions/build-and-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ runs:
if: ${{ github.event_name == 'pull_request' }}
shell: bash
run: |
bazel test //swift/...
bazel test //swift/... --test_tag_filters=-override --test_output=errors
- name: Evict bazel cache
if: ${{ github.event_name != 'pull_request' }}
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion swift/extractor/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ swift_cc_binary(
"//swift/extractor/invocation",
"//swift/extractor/remapping",
"//swift/extractor/translators",
"//swift/third_party/swift-llvm-support",
"//swift/third_party/resources:prebuilt",
"@absl//absl/strings",
],
)
Expand Down
5 changes: 3 additions & 2 deletions swift/extractor/SwiftExtractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ static std::unordered_set<swift::ModuleDecl*> extractDeclarations(
}

std::vector<swift::Token> comments;
if (primaryFile && primaryFile->getBufferID().hasValue()) {
if (primaryFile && primaryFile->getBufferID()) {
auto& sourceManager = compiler.getSourceMgr();
auto tokens = swift::tokenize(compiler.getInvocation().getLangOptions(), sourceManager,
primaryFile->getBufferID().getValue());
*primaryFile->getBufferID());
for (auto& token : tokens) {
if (token.getKind() == swift::tok::comment) {
comments.push_back(token);
Expand Down Expand Up @@ -188,6 +188,7 @@ static std::unordered_set<std::string> collectInputFilenames(swift::CompilerInst
std::unordered_set<std::string> sourceFiles;
const auto& inOuts = compiler.getInvocation().getFrontendOptions().InputsAndOutputs;
for (auto& input : inOuts.getAllInputs()) {
LOG_INFO("> {}", input.getFileName());
if (input.getType() == swift::file_types::TY_Swift &&
(!inOuts.hasPrimaryInputs() || input.isPrimary())) {
sourceFiles.insert(input.getFileName());
Expand Down
2 changes: 1 addition & 1 deletion swift/extractor/infra/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ swift_cc_library(
"//swift/extractor/infra/file",
"//swift/extractor/trap",
"//swift/logging",
"//swift/third_party/swift-llvm-support",
"//swift/third_party/resources:prebuilt",
"@picosha2",
],
)
6 changes: 5 additions & 1 deletion swift/extractor/infra/SwiftTagTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ MAP(swift::Expr, ExprTag)
MAP(swift::LinearFunctionExtractOriginalExpr, LinearFunctionExtractOriginalExprTag)
MAP(swift::LinearToDifferentiableFunctionExpr, LinearToDifferentiableFunctionExprTag)
MAP(swift::ABISafeConversionExpr, AbiSafeConversionExprTag) // different acronym convention
MAP(swift::ActorIsolationErasureExpr, void) // TODO swift 6.0
MAP(swift::UnreachableExpr, void) // TODO swift 6.0
geoffw0 marked this conversation as resolved.
Show resolved Hide resolved
MAP(swift::ExplicitCastExpr, ExplicitCastExprTag)
MAP(swift::CheckedCastExpr, CheckedCastExprTag)
MAP(swift::ForcedCheckedCastExpr, ForcedCheckedCastExprTag)
Expand All @@ -200,7 +202,8 @@ MAP(swift::Expr, ExprTag)
MAP(swift::ConsumeExpr, ConsumeExprTag)
MAP(swift::MaterializePackExpr, MaterializePackExprTag)
MAP(swift::SingleValueStmtExpr, SingleValueStmtExprTag)

MAP(swift::ExtractFunctionIsolationExpr, void) // TODO swift 6.0
MAP(swift::CurrentContextIsolationExpr, void) // TODO swift 6.0
MAP(swift::Decl, DeclTag)
MAP(swift::ValueDecl, ValueDeclTag)
MAP(swift::TypeDecl, TypeDeclTag)
Expand Down Expand Up @@ -332,6 +335,7 @@ MAP(swift::TypeBase, TypeTag)
MAP(swift::PackExpansionType, PackExpansionTypeTag)
MAP(swift::PackElementType, PackElementTypeTag)
MAP(swift::TypeVariableType, void) // created during type checking and only used for constraint checking
MAP(swift::ErrorUnionType, void) // TODO swift 6.0
MAP(swift::SugarType, SugarTypeTag)
MAP(swift::ParenType, ParenTypeTag)
MAP(swift::TypeAliasType, TypeAliasTypeTag)
Expand Down
9 changes: 9 additions & 0 deletions swift/extractor/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "swift/extractor/trap/TrapDomain.h"
#include "swift/extractor/infra/file/Path.h"
#include "swift/logging/SwiftAssert.h"
#include "swift/Threading/Errors.h"

using namespace std::string_literals;
using namespace codeql::main_logger;
Expand Down Expand Up @@ -75,6 +76,13 @@ static void processFrontendOptions(codeql::SwiftExtractorState& state,
}
}

static void turnOffSilVerifications(swift::SILOptions& options) {
options.VerifyAll = false;
options.VerifyExclusivity = false;
options.VerifyNone = true;
options.VerifySILOwnership = false;
}

codeql::TrapDomain invocationTrapDomain(codeql::SwiftExtractorState& state);

// This is part of the swiftFrontendTool interface, we hook into the
Expand All @@ -89,6 +97,7 @@ class Observer : public swift::FrontendObserver {
options.KeepASTContext = true;
lockOutputSwiftModuleTraps(state, options);
processFrontendOptions(state, options);
turnOffSilVerifications(invocation.getSILOptions());
}

void configuredCompiler(swift::CompilerInstance& instance) override {
Expand Down
2 changes: 1 addition & 1 deletion swift/extractor/mangler/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ swift_cc_library(
deps = [
"//swift/extractor/infra",
"//swift/extractor/trap",
"//swift/third_party/swift-llvm-support",
"//swift/third_party/resources:prebuilt",
],
)
33 changes: 25 additions & 8 deletions swift/extractor/mangler/SwiftMangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,19 +197,30 @@ SwiftMangledName SwiftMangler::visitAnyFunctionType(const swift::AnyFunctionType
auto ret = initMangled(type);
for (const auto& param : type->getParams()) {
ret << fetch(param.getPlainType());
if (param.isInOut()) {
ret << "_inout";
auto flags = param.getParameterFlags();
ret << "_" << getNameForParamSpecifier(flags.getOwnershipSpecifier());
if (flags.isIsolated()) {
ret << "_isolated";
}
if (param.isOwned()) {
ret << "_owned";
if (flags.isAutoClosure()) {
ret << "_autoclosure";
}
if (param.isShared()) {
ret << "_shared";
if (flags.isNonEphemeral()) {
ret << "_nonephermeral";
}
if (param.isIsolated()) {
if (flags.isIsolated()) {
ret << "_isolated";
}
if (param.isVariadic()) {
if (flags.isSending()) {
ret << "_sending";
}
if (flags.isCompileTimeConst()) {
ret << "_compiletimeconst";
}
if (flags.isNoDerivative()) {
ret << "_noderivative";
}
if (flags.isVariadic()) {
ret << "...";
}
}
Expand All @@ -219,6 +230,9 @@ SwiftMangledName SwiftMangler::visitAnyFunctionType(const swift::AnyFunctionType
}
if (type->isThrowing()) {
ret << "_throws";
if (type->hasThrownError()) {
ret << "(" << fetch(type->getThrownError()) << ")";
}
}
if (type->isSendable()) {
ret << "_sendable";
Expand All @@ -229,6 +243,9 @@ SwiftMangledName SwiftMangler::visitAnyFunctionType(const swift::AnyFunctionType
if (type->hasGlobalActor()) {
ret << "_actor" << fetch(type->getGlobalActor());
}
if (type->getIsolation().isErased()) {
ret << "_isolated";
}
// TODO: see if this needs to be used in identifying types, if not it needs to be removed from
// type printing in the Swift compiler code
assert(type->hasExtInfo() && "type must have ext info");
Expand Down
2 changes: 1 addition & 1 deletion swift/extractor/remapping/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ swift_cc_library(
deps = [
"//swift/extractor/config",
"//swift/extractor/infra/file",
"//swift/third_party/swift-llvm-support",
"//swift/third_party/resources:prebuilt",
"@picosha2",
],
)
2 changes: 1 addition & 1 deletion swift/extractor/translators/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ swift_cc_library(
deps = [
"//swift/extractor/infra",
"//swift/extractor/mangler",
"//swift/third_party/swift-llvm-support",
"//swift/third_party/resources:prebuilt",
],
)
2 changes: 1 addition & 1 deletion swift/extractor/translators/ExprTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ codeql::KeyPathExpr ExprTranslator::translateKeyPathExpr(const swift::KeyPathExp
for (const auto& component : expr.getComponents()) {
entry.components.push_back(emitKeyPathComponent(component));
}
if (auto rootTypeRepr = expr.getRootType()) {
if (auto rootTypeRepr = expr.getExplicitRootType()) {
auto keyPathType = expr.getType()->getAs<swift::BoundGenericClassType>();
CODEQL_EXPECT_OR(return entry, keyPathType, "KeyPathExpr must have BoundGenericClassType");
auto keyPathTypeArgs = keyPathType->getGenericArgs();
Expand Down
9 changes: 6 additions & 3 deletions swift/ql/consistency-queries/UnresolvedAstNodes.ql
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import swift

from AstNode n
where n.getAPrimaryQlClass().matches("Unresolved%")
select n
from AstNode n, string cls
where
cls = n.getAPrimaryQlClass() and
cls.matches("Unresolved%") and
not n.getLocation() instanceof UnknownLocation
select n, cls
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,35 @@
row =
[
";Collection;true;prefix(_:);;;Argument[-1];ReturnValue;taint",
";Collection;true;prefix(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
";Collection;true;prefix(through:);;;Argument[-1];ReturnValue;taint",
";Collection;true;prefix(through:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
";Collection;true;prefix(upTo:);;;Argument[-1];ReturnValue;taint",
";Collection;true;prefix(upTo:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
";Collection;true;prefix(while:);;;Argument[-1];ReturnValue;taint",
";Collection;true;prefix(while:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
";Collection;true;suffix(_:);;;Argument[-1];ReturnValue;taint",
";Collection;true;suffix(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
";Collection;true;suffix(from:);;;Argument[-1];ReturnValue;taint",
";Collection;true;suffix(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",

Check warning

Code scanning / CodeQL

Redundant assignment. Warning

The variable row
has previously been assigned
the same value
.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wouldn't do any harm to fix these.

";Collection;true;dropFirst(_:);;;Argument[-1];ReturnValue;taint",
";Collection;true;dropFirst(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
";Collection;true;dropLast(_:);;;Argument[-1];ReturnValue;taint",
";Collection;true;dropLast(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
";Collection;true;flatMap(_:);;;Argument[-1];ReturnValue;taint",
";Collection;true;flatMap(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
";Collection;true;map(_:);;;Argument[-1];ReturnValue;taint",
";Collection;true;map(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
";Collection;true;split(maxSplits:omittingEmptySubsequences:whereSeparator:);;;Argument[-1];ReturnValue;taint",
";Collection;true;split(separator:maxSplits:omittingEmptySubsequences:);;;Argument[-1];ReturnValue;taint",
";Collection;true;removeFirst();;;Argument[-1];ReturnValue;taint",
";Collection;true;popFirst();;;Argument[-1];ReturnValue;taint",
";Collection;true;randomElement();;;Argument[-1].CollectionElement;ReturnValue.OptionalSome;value",
";Collection;true;randomElement(using:);;;Argument[-1].CollectionElement;ReturnValue.OptionalSome;value",
";Collection;true;trimmingPrefix(_:);;;Argument[-1];ReturnValue;taint",
";Collection;true;trimmingPrefix(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
";Collection;true;trimmingPrefix(while:);;;Argument[-1];ReturnValue;taint",
";Collection;true;trimmingPrefix(while:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
";RangeReplaceableCollection;true;init(_:);;;Argument[0];ReturnValue.CollectionElement;taint",
";RangeReplaceableCollection;true;init(_:);;;Argument[0].CollectionElement;ReturnValue.CollectionElement;value",
";RangeReplaceableCollection;true;init(repeating:count:);;;Argument[0];ReturnValue.CollectionElement;value",
Expand All @@ -38,9 +55,19 @@
";RangeReplaceableCollection;true;insert(_:at:);;;Argument[0];Argument[-1];taint",
";RangeReplaceableCollection;true;replaceSubrange(_:with:);;;Argument[1];Argument[-1];taint",
";RangeReplaceableCollection;true;replaceSubrange(_:with:);;;Argument[1].CollectionElement;Argument[-1].CollectionElement;value",
";BidirectionalCollection;true;dropLast(_:);;;Argument[-1];ReturnValue;taint",
";BidirectionalCollection;true;dropLast(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
";BidirectionalCollection;true;joined(separator:);;;Argument[-1..0];ReturnValue;taint",
";BidirectionalCollection;true;joined(separator:);;;Argument[-1].CollectionElement;ReturnValue;taint",
";BidirectionalCollection;true;joined(separator:);;;Argument[-1].CollectionElement.CollectionElement;ReturnValue.CollectionElement;value",
";BidirectionalCollection;true;last(where:);;;Argument[-1];ReturnValue;taint",
";BidirectionalCollection;true;popLast();;;Argument[-1];ReturnValue;taint",
";BidirectionalCollection;true;reversed();;;Argument[-1];ReturnValue;taint",
";BidirectionalCollection;true;reversed();;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
";BidirectionalCollection;true;suffix(_:);;;Argument[-1];ReturnValue;taint",
";BidirectionalCollection;true;suffix(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
";BidirectionalCollection;true;suffix(from:);;;Argument[-1];ReturnValue;taint",
";BidirectionalCollection;true;suffix(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",

Check warning

Code scanning / CodeQL

Redundant assignment. Warning

The variable row
has previously been assigned
the same value
.
";MutableCollection;true;withContiguousMutableStorageIfAvailable(_:);;;Argument[-1];Argument[0].Parameter[0].CollectionElement;taint",
";MutableCollection;true;withContiguousMutableStorageIfAvailable(_:);;;Argument[-1].CollectionElement;Argument[0].Parameter[0].CollectionElement;value",
";MutableCollection;true;withContiguousMutableStorageIfAvailable(_:);;;Argument[0].Parameter[0].CollectionElement;Argument[-1].CollectionElement;value",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ private class SequenceSummaries extends SummaryModelCsv {
";Sequence;true;joined();;;Argument[-1].CollectionElement.CollectionElement;ReturnValue.CollectionElement;value",
";Sequence;true;joined(separator:);;;Argument[0..-1];ReturnValue;taint",
";Sequence;true;joined(separator:);;;Argument[-1].CollectionElement;ReturnValue;taint",
";Sequence;true;joined(separator:);;;Argument[-1].CollectionElement.CollectionElement;ReturnValue.CollectionElement;value",
";Sequence;true;first(where:);;;Argument[-1].CollectionElement;ReturnValue;value",
";Sequence;true;withContiguousStorageIfAvailable(_:);;;Argument[-1];Argument[0].Parameter[0].CollectionElement;taint",
";Sequence;true;withContiguousStorageIfAvailable(_:);;;Argument[-1].CollectionElement;Argument[0].Parameter[0].CollectionElement;value",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ private class StringFieldsInheritTaint extends TaintInheritingContent,
namedTypeDecl.getFullName() = "CustomDebugStringConvertible" and
fieldDecl.getName() = "debugDescription"
or
namedTypeDecl.getFullName() = "CustomTestStringConvertible" and
fieldDecl.getName() = "testDescription"
or
namedTypeDecl.getFullName() = "CustomURLRepresentationParameterConvertible" and
fieldDecl.getName() = "urlRepresentationParameter"
or
namedTypeDecl.getFullName() = "Substring" and
fieldDecl.getName() = "base"
) and
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
| file://:0:0:0:0 | ... .combine(_:) |
| unresolved.swift:5:1:5:14 | UnresolvedSpecializeExpr |
| unresolved.swift:5:1:5:14 | UnresolvedSpecializeExpr | UnresolvedSpecializeExpr |
Loading
Loading