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

Formatting: remove trailing whitespaces #1370

Merged
merged 1 commit into from Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions Sources/CSwiftScan/include/swiftscan_header.h
Expand Up @@ -98,7 +98,7 @@ typedef struct {
(*swiftscan_module_info_get_direct_dependencies)(swiftscan_dependency_info_t);
swiftscan_module_details_t
(*swiftscan_module_info_get_details)(swiftscan_dependency_info_t);

//=== Dependency Module Info Details Functions ----------------------------===//
swiftscan_dependency_info_kind_t
(*swiftscan_module_detail_get_kind)(swiftscan_module_details_t);
Expand Down Expand Up @@ -222,7 +222,7 @@ typedef struct {
swiftscan_string_set_t *
(*swiftscan_compiler_supported_features_query)(void);

//=== Scanner Functions ---------------------------------------------------===//
//=== Scanner Functions ---------------------------------------------------===//
swiftscan_scanner_t (*swiftscan_scanner_create)(void);
void (*swiftscan_scanner_dispose)(swiftscan_scanner_t);
swiftscan_dependency_graph_t
Expand All @@ -233,7 +233,7 @@ typedef struct {
swiftscan_scan_invocation_t);
swiftscan_import_set_t
(*swiftscan_import_set_create)(swiftscan_scanner_t, swiftscan_scan_invocation_t);

//=== Scanner Diagnostics -------------------------------------------------===//
swiftscan_diagnostic_set_t*
(*swiftscan_scanner_diagnostics_query)(swiftscan_scanner_t);
Expand Down
40 changes: 20 additions & 20 deletions Sources/SwiftDriver/Driver/Driver.swift
Expand Up @@ -259,10 +259,10 @@ public struct Driver {
/// Only present when the driver will be writing the record.
/// Only used for reading when compiling incrementally.
@_spi(Testing) public let buildRecordInfo: BuildRecordInfo?

/// Whether to consider incremental compilation.
let shouldAttemptIncrementalCompilation: Bool

/// Code & data for incremental compilation. Nil if not running in incremental mode.
/// Set during planning because needs the jobs to look at outputs.
@_spi(Testing) public private(set) var incrementalCompilationState: IncrementalCompilationState? = nil
Expand Down Expand Up @@ -292,7 +292,7 @@ public struct Driver {

/// Path to the dependencies file.
let dependenciesFilePath: VirtualPath.Handle?

/// Path to the references dependencies file.
let referenceDependenciesPath: VirtualPath.Handle?

Expand Down Expand Up @@ -760,7 +760,7 @@ public struct Driver {
targetInfo: frontendTargetInfo)

Self.validateSanitizerAddressUseOdrIndicatorFlag(&parsedOptions, diagnosticEngine: diagnosticsEngine, addressSanitizerEnabled: enabledSanitizers.contains(.address))

Self.validateSanitizerRecoverArgValues(&parsedOptions, diagnosticEngine: diagnosticsEngine, enabledSanitizers: enabledSanitizers)

Self.validateSanitizerCoverageArgs(&parsedOptions,
Expand Down Expand Up @@ -1595,7 +1595,7 @@ extension Driver {
// Added for the sake of compatibility with the legacy driver.
try? fileSystem.move(
from: absPath, to: absPath.appending(component: absPath.basename + "~"))

guard let contents = buildRecord.encode(diagnosticEngine: diagnosticEngine) else {
diagnosticEngine.emit(.warning_could_not_write_build_record(absPath))
return
Expand Down Expand Up @@ -1952,7 +1952,7 @@ extension Driver {
// FIXME: The object-file default is carried over from the existing
// driver, but seems odd.
let fileType = FileType(rawValue: fileExtension) ?? FileType.object

if fileType == .swift {
let basename = inputFile.basename
if let originalPath = swiftFiles[basename] {
Expand All @@ -1966,28 +1966,28 @@ extension Driver {

return TypedVirtualPath(file: inputHandle, type: fileType)
}

if parsedOptions.hasArgument(.e) {
if let mainPath = swiftFiles["main.swift"] {
diagnosticsEngine.emit(.error_two_files_same_name(basename: "main.swift", firstPath: mainPath, secondPath: "-e"))
diagnosticsEngine.emit(.note_explain_two_files_same_name)
throw ErrorDiagnostics.emitted
}

try withTemporaryDirectory(dir: fileSystem.tempDirectory, removeTreeOnDeinit: false) { absPath in
let filePath = VirtualPath.absolute(absPath.appending(component: "main.swift"))

try fileSystem.writeFileContents(filePath) { file in
file <<< ###"#sourceLocation(file: "-e", line: 1)\###n"###
for option in parsedOptions.arguments(for: .e) {
file <<< option.argument.asSingle <<< "\n"
}
}

paths.append(TypedVirtualPath(file: filePath.intern(), type: .swift))
}
}

return paths
}

Expand Down Expand Up @@ -2112,11 +2112,11 @@ extension Diagnostic.Message {
static var warn_ignore_embed_bitcode_marker: Diagnostic.Message {
.warning("ignoring -embed-bitcode-marker since no object file is being generated")
}

static func error_two_files_same_name(basename: String, firstPath: String, secondPath: String) -> Diagnostic.Message {
.error("filename \"\(basename)\" used twice: '\(firstPath)' and '\(secondPath)'")
}

static var note_explain_two_files_same_name: Diagnostic.Message {
.note("filenames are used to distinguish private declarations with the same name")
}
Expand Down Expand Up @@ -2381,7 +2381,7 @@ extension Diagnostic.Message {
static var verify_debug_info_requires_debug_option: Diagnostic.Message {
.warning("ignoring '-verify-debug-info'; no debug info is being generated")
}

static func warning_option_requires_sanitizer(currentOption: Option, currentOptionValue: String, sanitizerRequired: Sanitizer) -> Diagnostic.Message {
.warning("option '\(currentOption.spelling)\(currentOptionValue)' has no effect when '\(sanitizerRequired)' sanitizer is disabled. Use \(Option.sanitizeEQ.spelling)\(sanitizerRequired) to enable the sanitizer")
}
Expand Down Expand Up @@ -2562,7 +2562,7 @@ extension Driver {
}
return true
}

var used = [""]
for item in aliasArgs {
let arg = item.argument.asSingle
Expand Down Expand Up @@ -2906,7 +2906,7 @@ extension Driver {
}
}
}

private static func validateSanitizerAddressUseOdrIndicatorFlag(
_ parsedOptions: inout ParsedOptions,
diagnosticEngine: DiagnosticsEngine,
Expand All @@ -2917,7 +2917,7 @@ extension Driver {
.warning_option_requires_sanitizer(currentOption: .sanitizeAddressUseOdrIndicator, currentOptionValue: "", sanitizerRequired: .address))
}
}

/// Validates the set of `-sanitize-recover={sanitizer}` arguments
private static func validateSanitizerRecoverArgValues(
_ parsedOptions: inout ParsedOptions,
Expand All @@ -2941,14 +2941,14 @@ extension Driver {
.error_invalid_arg_value(arg: .sanitizeRecoverEQ, value: arg))
continue
}

// only -sanitize-recover=address is supported
if sanitizer != .address {
diagnosticEngine.emit(
.error_unsupported_argument(argument: arg, option: .sanitizeRecoverEQ))
continue
}

if !enabledSanitizers.contains(sanitizer) {
diagnosticEngine.emit(
.warning_option_requires_sanitizer(currentOption: .sanitizeRecoverEQ, currentOptionValue: arg, sanitizerRequired: sanitizer))
Expand Down Expand Up @@ -3251,7 +3251,7 @@ extension Driver {
outputType: type) {
return singleOutputPath
}

// Emit-module discovered dependencies are always specified as a single-output
// file
if type == .emitModuleDependencies,
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftDriver/Execution/ArgsResolver.swift
Expand Up @@ -198,7 +198,7 @@ public final class ArgsResolver {
guard useResponseFiles != .disabled else {
return false
}

let forceResponseFiles = useResponseFiles == .forced
if forceResponseFiles ||
(job.supportsResponseFiles && !commandLineFitsWithinSystemLimits(path: resolvedArguments[0], args: resolvedArguments)) {
Expand Down
6 changes: 3 additions & 3 deletions Sources/SwiftDriver/Execution/DriverExecutor.swift
Expand Up @@ -26,7 +26,7 @@ public protocol DriverExecutor {
func execute(job: Job,
forceResponseFiles: Bool,
recordedInputModificationDates: [TypedVirtualPath: TimePoint]) throws -> ProcessResult

/// Execute multiple jobs, tracking job status using the provided execution delegate.
/// Pass in the `IncrementalCompilationState` to allow for incremental compilation.
func execute(workload: DriverExecutorWorkload,
Expand Down Expand Up @@ -90,7 +90,7 @@ extension DriverExecutor {
let result = try execute(job: job,
forceResponseFiles: forceResponseFiles,
recordedInputModificationDates: recordedInputModificationDates)

if (result.exitStatus != .terminated(code: EXIT_SUCCESS)) {
let returnCode = Self.computeReturnCode(exitStatus: result.exitStatus)
throw JobExecutionError.jobFailedWithNonzeroExitCode(returnCode, try result.utf8stderrOutput())
Expand Down Expand Up @@ -141,7 +141,7 @@ extension DriverExecutor {
public protocol JobExecutionDelegate {
/// Called when a job starts executing.
func jobStarted(job: Job, arguments: [String], pid: Int)

/// Called when a job finished.
func jobFinished(job: Job, result: ProcessResult, pid: Int)

Expand Down
Expand Up @@ -306,7 +306,7 @@ internal extension InterModuleDependencyGraph {

public struct InterModuleDependencyImports: Codable {
public var imports: [String]

public init(imports: [String], moduleAliases: [String: String]? = nil) {
var realImports = [String]()
if let aliases = moduleAliases {
Expand Down
Expand Up @@ -129,14 +129,14 @@ public class InterModuleDependencyOracle {
}
return swiftScan.hasBinarySwiftModuleIsFramework
}

@_spi(Testing) public func supportsScannerDiagnostics() throws -> Bool {
guard let swiftScan = swiftScanLibInstance else {
fatalError("Attempting to reset scanner cache with no scanner instance.")
}
return swiftScan.supportsScannerDiagnostics()
}

@_spi(Testing) public func getScannerDiagnostics() throws -> [ScannerDiagnosticPayload]? {
guard let swiftScan = swiftScanLibInstance else {
fatalError("Attempting to reset scanner cache with no scanner instance.")
Expand Down
Expand Up @@ -210,7 +210,7 @@ public extension Driver {
let scannerJob = try dependencyScanningJob()
let forceResponseFiles = parsedOptions.hasArgument(.driverForceResponseFiles)
let dependencyGraph: InterModuleDependencyGraph

if parsedOptions.contains(.v) {
let arguments: [String] = try executor.resolver.resolveArgumentList(for: scannerJob,
useResponseFiles: .disabled)
Expand Down
Expand Up @@ -59,7 +59,7 @@ extension Bits {
init(buffer: Bits) {
self.buffer = buffer
}

init(buffer: ByteString) {
self.init(buffer: Bits(buffer: buffer))
}
Expand Down
Expand Up @@ -33,7 +33,7 @@
///
/// Next, identify the kinds of records needed in the format and assign them
/// unique, stable identifiers. For example:
///
///
/// ```
/// enum DiagnosticRecordID: UInt8 {
/// case version = 1
Expand Down Expand Up @@ -525,7 +525,7 @@ extension BitstreamWriter {
self.write(0 as UInt8, width: 8)
}
}


/// Writes the blockinfo block and allows emitting abbreviations
/// and records in it.
Expand Down
Expand Up @@ -29,7 +29,7 @@ public struct DependencyGraphDotFileWriter {
let basename = file.file.basename
write(sfdg, basename: basename, internedStringTable: internedStringTable)
}

mutating func write(_ mdg: ModuleDependencyGraph) {
write(mdg, basename: Self.moduleDependencyGraphBasename,
internedStringTable: mdg.internedStringTable)
Expand Down
12 changes: 6 additions & 6 deletions Sources/SwiftDriver/IncrementalCompilation/DependencyKey.swift
Expand Up @@ -27,13 +27,13 @@ import Dispatch
self.fileName = fileName
self.fileNameString = fileName.lookup(in: t)
}

static var dummy: Self {
MockIncrementalCompilationSynchronizer.withInternedStringTable { t in
return Self(fileName: ".".intern(in: t), t)
}
}

public static func ==(lhs: ExternalDependency, rhs: ExternalDependency) -> Bool {
lhs.fileName == rhs.fileName
}
Expand Down Expand Up @@ -381,16 +381,16 @@ public func isInIncreasingOrder(_ lhs: DependencyKey.Designator,
let (.nominal(ln), .nominal(rn)),
let (.potentialMember(ln), .potentialMember(rn)):
return f(ln) < f(rn)

case let (.externalDepend(ld), .externalDepend(rd)):
return ld < rd

case let (.member(lc, ln), .member(rc, rn)):
return lc == rc ? f(ln) < f(rn) : f(lc) < f(rc)

default: break
}

/// Preserves the ordering that obtained before interned strings were introduced.
func kindOrdering(_ d: DependencyKey.Designator) -> Int {
switch d {
Expand Down