Skip to content

Commit 22b901e

Browse files
committed
Add valid args to sanitizer-coverage
Adds valid arguments to sanitizer-coverage pc-table and inline-8bit-counter. Currently you cannot set all default fuzzer options directly using sanitizer coverage. Right now you can choose default fuzzer args, or a limited number coverage options. This PR extends coverage options to allow pc-table and inline-8bit-counter. This algins with default fuzzer options to allow customizing sanitizer-coverage in variations of fuzzer defaults. (i.e. Fuzzer defaults w/o pc-table enabled). In upstream llvm the option -no-sanitize-coverage exists to disable various fuzzing options. Swift current does not have a convention of using excluding args. This aims to limit the need for that by being able to inclusively set desired coverage. rdar://127950283
1 parent 7d5368f commit 22b901e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Sources/SwiftDriver/Driver/Driver.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3145,7 +3145,7 @@ extension Driver {
31453145
for arg in parsedOptions.arguments(for: .sanitizeCoverageEQ).flatMap(\.argument.asMultiple) {
31463146
if ["func", "bb", "edge"].contains(arg) {
31473147
foundRequiredArg = true
3148-
} else if !["indirect-calls", "trace-bb", "trace-cmp", "8bit-counters", "trace-pc", "trace-pc-guard"].contains(arg) {
3148+
} else if !["indirect-calls", "trace-bb", "trace-cmp", "8bit-counters", "trace-pc", "trace-pc-guard","pc-table","inline-8bit-counters",].contains(arg) {
31493149
diagnosticsEngine.emit(.error_unsupported_argument(argument: arg, option: .sanitizeCoverageEQ))
31503150
}
31513151

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2807,7 +2807,7 @@ final class SwiftDriverTests: XCTestCase {
28072807
$1.expect(.error("unsupported argument 'baz' to option '-sanitize-coverage='"))
28082808
}
28092809

2810-
try assertNoDriverDiagnostics(args: "swiftc", "foo.swift", "-sanitize=thread", "-sanitize-coverage=edge,indirect-calls,trace-bb,trace-cmp,8bit-counters")
2810+
try assertNoDriverDiagnostics(args: "swiftc", "foo.swift", "-sanitize=thread", "-sanitize-coverage=edge,indirect-calls,trace-bb,trace-cmp,8bit-counters,pc-table,inline-8bit-counters")
28112811
#endif
28122812
}
28132813

0 commit comments

Comments
 (0)