From 585f0dbf96c5f758bc794d9606259a94dbb53e3c Mon Sep 17 00:00:00 2001 From: Max Obermeier Date: Wed, 19 Oct 2022 18:51:53 +0200 Subject: [PATCH] Add support for -emit-extension-block-symbols and -omit-extension-block-symbols flags --- Sources/SwiftDriver/Jobs/CompileJob.swift | 1 + Sources/SwiftDriver/Jobs/EmitModuleJob.swift | 1 + Sources/SwiftDriver/Jobs/MergeModuleJob.swift | 1 + Sources/SwiftOptions/Options.swift | 12 ++++++++++-- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Sources/SwiftDriver/Jobs/CompileJob.swift b/Sources/SwiftDriver/Jobs/CompileJob.swift index b443d986f..c45bcdd56 100644 --- a/Sources/SwiftDriver/Jobs/CompileJob.swift +++ b/Sources/SwiftDriver/Jobs/CompileJob.swift @@ -375,6 +375,7 @@ extension Driver { try commandLine.appendLast(.emitSymbolGraphDir, from: &parsedOptions) } try commandLine.appendLast(.includeSpiSymbols, from: &parsedOptions) + try commandLine.appendLast(.emitExtensionBlockSymbols, .omitExtensionBlockSymbols, from: &parsedOptions) try commandLine.appendLast(.symbolGraphMinimumAccessLevel, from: &parsedOptions) addJobOutputs(outputs) diff --git a/Sources/SwiftDriver/Jobs/EmitModuleJob.swift b/Sources/SwiftDriver/Jobs/EmitModuleJob.swift index 39e1afbdb..3682bcb1a 100644 --- a/Sources/SwiftDriver/Jobs/EmitModuleJob.swift +++ b/Sources/SwiftDriver/Jobs/EmitModuleJob.swift @@ -102,6 +102,7 @@ extension Driver { try commandLine.appendLast(.emitSymbolGraph, from: &parsedOptions) try commandLine.appendLast(.emitSymbolGraphDir, from: &parsedOptions) try commandLine.appendLast(.includeSpiSymbols, from: &parsedOptions) + try commandLine.appendLast(.emitExtensionBlockSymbols, .omitExtensionBlockSymbols, from: &parsedOptions) try commandLine.appendLast(.symbolGraphMinimumAccessLevel, from: &parsedOptions) try commandLine.appendLast(.checkApiAvailabilityOnly, from: &parsedOptions) diff --git a/Sources/SwiftDriver/Jobs/MergeModuleJob.swift b/Sources/SwiftDriver/Jobs/MergeModuleJob.swift index b1a100d90..c242f9462 100644 --- a/Sources/SwiftDriver/Jobs/MergeModuleJob.swift +++ b/Sources/SwiftDriver/Jobs/MergeModuleJob.swift @@ -62,6 +62,7 @@ extension Driver { try commandLine.appendLast(.emitSymbolGraph, from: &parsedOptions) try commandLine.appendLast(.emitSymbolGraphDir, from: &parsedOptions) try commandLine.appendLast(.includeSpiSymbols, from: &parsedOptions) + try commandLine.appendLast(.emitExtensionBlockSymbols, .omitExtensionBlockSymbols, from: &parsedOptions) try commandLine.appendLast(.symbolGraphMinimumAccessLevel, from: &parsedOptions) // Propagate the disable flag for cross-module incremental builds diff --git a/Sources/SwiftOptions/Options.swift b/Sources/SwiftOptions/Options.swift index a37b4be51..c0fa521c3 100644 --- a/Sources/SwiftOptions/Options.swift +++ b/Sources/SwiftOptions/Options.swift @@ -50,7 +50,7 @@ extension Option { public static let candidateModuleFile: Option = Option("-candidate-module-file", .separate, attributes: [.helpHidden, .frontend, .noDriver], metaVar: "", helpText: "Specify Swift module may be ready to use for an interface") public static let checkApiAvailabilityOnly: Option = Option("-check-api-availability-only", .flag, attributes: [.helpHidden, .frontend, .noInteractive], helpText: "Only check the availability of the APIs, ignore function bodies") public static let checkOnoneCompleteness: Option = Option("-check-onone-completeness", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Print errors if the compile OnoneSupport module is missing symbols") - public static let clangHeaderExposePublicDecls: Option = Option("-clang-header-expose-public-decls", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Expose all public declarations in the generated clang header") + public static let clangHeaderExposeDecls: Option = Option("-clang-header-expose-decls=", .joined, attributes: [.helpHidden, .frontend, .noDriver], metaVar: "all-public|has-expose-attr", helpText: "Which declarations should be exposed in the generated clang header.") public static let clangTarget: Option = Option("-clang-target", .separate, attributes: [.frontend], helpText: "Separately set the target we should use for internal Clang instance") public static let codeCompleteCallPatternHeuristics: Option = Option("-code-complete-call-pattern-heuristics", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Use heuristics to guess whether we want call pattern completions") public static let codeCompleteInitsInPostfixExpr: Option = Option("-code-complete-inits-in-postfix-expr", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Include initializers when completing a postfix expression") @@ -107,6 +107,7 @@ extension Option { public static let diagnosticsEditorMode: Option = Option("-diagnostics-editor-mode", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Diagnostics will be used in editor") public static let digesterBreakageAllowlistPath: Option = Option("-digester-breakage-allowlist-path", .separate, attributes: [.noInteractive, .argumentIsPath], metaVar: "", helpText: "The path to a list of permitted breaking changes the API digester should ignore") public static let digesterMode: Option = Option("-digester-mode", .separate, attributes: [.noInteractive], metaVar: "", helpText: "Whether the API digester should run in API or ABI mode (defaults to API checking)") + public static let directClangCc1ModuleBuild: Option = Option("-direct-clang-cc1-module-build", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Use the specified -Xcc options to build a PCM by using Clang frontend directly, bypassing the Clang driver") public static let disableAccessControl: Option = Option("-disable-access-control", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Don't respect access control restrictions") public static let disableActorDataRaceChecks: Option = Option("-disable-actor-data-race-checks", .flag, attributes: [.frontend, .doesNotAffectIncrementalBuild], helpText: "Disable runtime checks for actor data races") public static let disableArcOpts: Option = Option("-disable-arc-opts", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Don't run SIL ARC optimization passes.") @@ -322,12 +323,14 @@ extension Option { public static let enableExperimentalAsyncTopLevel: Option = Option("-enable-experimental-async-top-level", .flag, attributes: [.helpHidden, .frontend, .noDriver, .moduleInterface], helpText: "Enable experimental concurrency in top-level code") public static let enableExperimentalConcisePoundFile: Option = Option("-enable-experimental-concise-pound-file", .flag, attributes: [.frontend, .moduleInterface], helpText: "Enable experimental concise '#file' identifier") public static let enableExperimentalConcurrency: Option = Option("-enable-experimental-concurrency", .flag, attributes: [.helpHidden, .frontend, .noDriver, .moduleInterface], helpText: "Enable experimental concurrency model") + public static let enableExperimentalCxxInteropInClangHeader: Option = Option("-enable-experimental-cxx-interop-in-clang-header", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Enable experimental Swift to C++ interop code generation in generated Clang header") public static let enableExperimentalCxxInterop: Option = Option("-enable-experimental-cxx-interop", .flag, attributes: [.helpHidden, .frontend, .moduleInterface], helpText: "Enable experimental C++ interop code generation and config directives") public static let enableExperimentalDistributed: Option = Option("-enable-experimental-distributed", .flag, attributes: [.helpHidden, .frontend, .noDriver, .moduleInterface], helpText: "Enable experimental 'distributed' actors and functions") public static let enableExperimentalEagerClangModuleDiagnostics: Option = Option("-enable-experimental-eager-clang-module-diagnostics", .flag, attributes: [.helpHidden, .frontend, .noDriver, .moduleInterface], helpText: "Enable experimental eager diagnostics reporting on the importability of all referenced C, C++, and Objective-C libraries") public static let enableExperimentalFeature: Option = Option("-enable-experimental-feature", .separate, attributes: [.frontend], helpText: "Enable an experimental feature") public static let enableExperimentalFlowSensitiveConcurrentCaptures: Option = Option("-enable-experimental-flow-sensitive-concurrent-captures", .flag, attributes: [.helpHidden, .frontend, .noDriver, .moduleInterface], helpText: "Enable flow-sensitive concurrent captures") public static let enableExperimentalForwardModeDifferentiation: Option = Option("-enable-experimental-forward-mode-differentiation", .flag, attributes: [.frontend], helpText: "Enable experimental forward mode differentiation") + public static let enableExperimentalImplicitSome: Option = Option("-enable-experimental-implicit-some", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Enable experimental implicit some") public static let enableExperimentalMoveOnly: Option = Option("-enable-experimental-move-only", .flag, attributes: [.helpHidden, .frontend, .noDriver, .moduleInterface], helpText: "Enable experimental move only") public static let enableExperimentalNamedOpaqueTypes: Option = Option("-enable-experimental-named-opaque-types", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Enable experimental support for named opaque result types") public static let enableExperimentalOpaqueTypeErasure: Option = Option("-enable-experimental-opaque-type-erasure", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Type-erases opaque types that conform to @_typeEraser protocols") @@ -516,6 +519,7 @@ extension Option { public static let nostartfiles: Option = Option("-nostartfiles", .flag, attributes: [.helpHidden, .frontend, .noInteractive, .doesNotAffectIncrementalBuild], helpText: "Do not link in the Swift language startup routines") public static let nostdimport: Option = Option("-nostdimport", .flag, attributes: [.frontend], helpText: "Don't search the standard library import path for modules") public static let numThreads: Option = Option("-num-threads", .separate, attributes: [.frontend, .doesNotAffectIncrementalBuild], metaVar: "", helpText: "Enable multi-threading and specify number of threads") + public static let omitExtensionBlockSymbols: Option = Option("-omit-extension-block-symbols", .flag, attributes: [.helpHidden, .frontend, .noInteractive, .supplementaryOutput], helpText: "Directly associate members and conformances with the extended nominal when generating symbol graphs instead of emitting 'swift.extension' symbols for extensions to external types") public static let extraClangOptionsOnly: Option = Option("-only-use-extra-clang-opts", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Options passed via -Xcc are sufficient for Clang configuration") public static let Onone: Option = Option("-Onone", .flag, attributes: [.frontend, .moduleInterface], helpText: "Compile without any optimization", group: .O) public static let Oplayground: Option = Option("-Oplayground", .flag, attributes: [.helpHidden, .frontend, .moduleInterface], helpText: "Compile with optimizations appropriate for a playground", group: .O) @@ -769,7 +773,7 @@ extension Option { Option.candidateModuleFile, Option.checkApiAvailabilityOnly, Option.checkOnoneCompleteness, - Option.clangHeaderExposePublicDecls, + Option.clangHeaderExposeDecls, Option.clangTarget, Option.codeCompleteCallPatternHeuristics, Option.codeCompleteInitsInPostfixExpr, @@ -826,6 +830,7 @@ extension Option { Option.diagnosticsEditorMode, Option.digesterBreakageAllowlistPath, Option.digesterMode, + Option.directClangCc1ModuleBuild, Option.disableAccessControl, Option.disableActorDataRaceChecks, Option.disableArcOpts, @@ -1041,12 +1046,14 @@ extension Option { Option.enableExperimentalAsyncTopLevel, Option.enableExperimentalConcisePoundFile, Option.enableExperimentalConcurrency, + Option.enableExperimentalCxxInteropInClangHeader, Option.enableExperimentalCxxInterop, Option.enableExperimentalDistributed, Option.enableExperimentalEagerClangModuleDiagnostics, Option.enableExperimentalFeature, Option.enableExperimentalFlowSensitiveConcurrentCaptures, Option.enableExperimentalForwardModeDifferentiation, + Option.enableExperimentalImplicitSome, Option.enableExperimentalMoveOnly, Option.enableExperimentalNamedOpaqueTypes, Option.enableExperimentalOpaqueTypeErasure, @@ -1235,6 +1242,7 @@ extension Option { Option.nostartfiles, Option.nostdimport, Option.numThreads, + Option.omitExtensionBlockSymbols, Option.extraClangOptionsOnly, Option.Onone, Option.Oplayground,