Skip to content

Commit 1e70c51

Browse files
committed
Merge pull request #2629 from bitjammer/enable-reflection-metadata-default
SwiftRemoteMirror: Turn on reflection metadata by default
2 parents 814a08a + a38a4ce commit 1e70c51

19 files changed

+364
-384
lines changed

CMakeLists.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,6 @@ option(SWIFT_STDLIB_ENABLE_RESILIENCE
234234
"Build the standard libraries and overlays with resilience enabled; see docs/LibraryEvolution.rst"
235235
FALSE)
236236

237-
option(SWIFT_STDLIB_ENABLE_REFLECTION_METADATA
238-
"Build the standard libraries and overlays with remote reflection metadata; see docs/proposals/RemoteMirrors.rst"
239-
TRUE)
240-
241-
option(SWIFT_STDLIB_ENABLE_REFLECTION_NAMES
242-
"Build the standard libraries and overlays with remote reflection names; see docs/proposals/RemoteMirrors.rst"
243-
FALSE)
244-
245237
option(SWIFT_STDLIB_SIL_SERIALIZE_ALL
246238
"Build the standard libraries and overlays serializing all method bodies"
247239
TRUE)

cmake/modules/SwiftSource.cmake

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,6 @@ function(_compile_swift_files dependency_target_out_var_name)
226226
list(APPEND swift_flags "-Xfrontend" "-enable-resilience")
227227
endif()
228228

229-
if(SWIFT_STDLIB_ENABLE_REFLECTION_METADATA AND SWIFTFILE_IS_STDLIB)
230-
list(APPEND swift_flags "-Xfrontend" "-enable-reflection-metadata")
231-
endif()
232-
233-
if(SWIFT_STDLIB_ENABLE_REFLECTION_NAMES AND SWIFTFILE_IS_STDLIB)
234-
list(APPEND swift_flags "-Xfrontend" "-enable-reflection-names")
235-
endif()
236-
237229
if(SWIFT_EMIT_SORTED_SIL_OUTPUT)
238230
list(APPEND swift_flags "-Xfrontend" "-emit-sorted-sil")
239231
endif()

include/swift/AST/IRGenOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class IRGenOptions {
168168
EmitStackPromotionChecks(false), GenerateProfile(false),
169169
PrintInlineTree(false), EmbedMode(IRGenEmbedMode::None),
170170
HasValueNamesSetting(false), ValueNames(false),
171-
EnableReflectionMetadata(false), EnableReflectionNames(false),
171+
EnableReflectionMetadata(true), EnableReflectionNames(true),
172172
UseIncrementalLLVMCodeGen(true), UseSwiftCall(false),
173173
CmdArgs()
174174
{}

include/swift/Option/FrontendOptions.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,11 @@ def disable_llvm_value_names : Flag<["-"], "disable-llvm-value-names">,
193193
def enable_llvm_value_names : Flag<["-"], "enable-llvm-value-names">,
194194
HelpText<"Add names to local values in LLVM IR">;
195195

196-
def enable_reflection_metadata : Flag<["-"], "enable-reflection-metadata">,
197-
HelpText<"Enable emission of reflection metadata for nominal types">;
196+
def disable_reflection_metadata : Flag<["-"], "disable-reflection-metadata">,
197+
HelpText<"Disable emission of reflection metadata for nominal types">;
198198

199-
def enable_reflection_names : Flag<["-"], "enable-reflection-names">,
200-
HelpText<"Enable emission of names of stored properties and enum cases in"
199+
def disable_reflection_names : Flag<["-"], "disable-reflection-names">,
200+
HelpText<"Disable emission of names of stored properties and enum cases in"
201201
"reflection metadata">;
202202

203203
def stack_promotion_checks : Flag<["-"], "emit-stack-promotion-checks">,

lib/Frontend/CompilerInvocation.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,11 +1266,13 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
12661266
Opts.Sanitize = parseSanitizerArgValues(A, Triple, Diags);
12671267
}
12681268

1269-
if (Args.hasArg(OPT_enable_reflection_metadata)) {
1270-
Opts.EnableReflectionMetadata = true;
1271-
if (Args.hasArg(OPT_enable_reflection_names)) {
1272-
Opts.EnableReflectionNames = true;
1273-
}
1269+
if (Args.hasArg(OPT_disable_reflection_metadata)) {
1270+
Opts.EnableReflectionMetadata = false;
1271+
Opts.EnableReflectionNames = false;
1272+
}
1273+
1274+
if (Args.hasArg(OPT_disable_reflection_names)) {
1275+
Opts.EnableReflectionNames = false;
12741276
}
12751277

12761278
return false;

stdlib/private/SwiftReflectionTest/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
set(swift_reflection_test_compile_flags
2-
"-Xfrontend" "-enable-reflection-names")
3-
41
add_swift_library(swiftSwiftReflectionTest SHARED IS_STDLIB
52
SwiftReflectionTest.swift
63
SWIFT_MODULE_DEPENDS Darwin
7-
SWIFT_COMPILE_FLAGS ${swift_reflection_test_compile_flags}
84
INSTALL_IN_COMPONENT stdlib-experimental)
95

106
foreach(SDK ${SWIFT_SDKS})

test/IRGen/closure.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// -- partial_apply context metadata
66

7-
// CHECK: [[METADATA:@.*]] = private constant %swift.full_boxmetadata { void (%swift.refcounted*)* @objectdestroy.1, i8** null, %swift.type { i64 64 }, i32 16, i8* null }
7+
// CHECK: [[METADATA:@.*]] = private constant %swift.full_boxmetadata { void (%swift.refcounted*)* @objectdestroy, i8** null, %swift.type { i64 64 }, i32 16, i8* bitcast (<{ i32, i32, i32, i32 }>* @"\01l__swift3_capture_descriptor" to i8*) }
88

99
func a(i i: Int) -> (Int) -> Int {
1010
return { x in i }

test/IRGen/reflection_metadata.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// RUN: %target-swift-frontend -enable-reflection-metadata -enable-reflection-names -emit-ir %s | FileCheck %s
2-
// RUN: %target-swift-frontend -enable-reflection-metadata -emit-ir %s | FileCheck %s --check-prefix=STRIP_REFLECTION_NAMES
3-
// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s --check-prefix=STRIP_REFLECTION_METADATA
1+
// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
2+
// RUN: %target-swift-frontend -disable-reflection-names -emit-ir %s | FileCheck %s --check-prefix=STRIP_REFLECTION_NAMES
3+
// RUN: %target-swift-frontend -disable-reflection-metadata -emit-ir %s | FileCheck %s --check-prefix=STRIP_REFLECTION_METADATA
44

55
// STRIP_REFLECTION_NAMES_DAG: {{.*}}swift3_reflect
66
// STRIP_REFLECTION_NAMES_DAG: {{.*}}swift3_fieldmd

test/Reflection/capture_descriptors.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: rm -rf %t && mkdir -p %t
2-
// RUN: %target-build-swift %s -emit-module -emit-library -module-name capture_descriptors -Xfrontend -enable-reflection-metadata -Xfrontend -enable-reflection-names -o %t/capture_descriptors.%target-dylib-extension
2+
// RUN: %target-build-swift %s -emit-module -emit-library -module-name capture_descriptors -o %t/capture_descriptors.%target-dylib-extension
33
// RUN: %target-swift-reflection-dump -binary-filename %t/capture_descriptors.%target-dylib-extension | FileCheck %s
44

55
sil_stage canonical

test/Reflection/typeref_decoding.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: rm -rf %t && mkdir -p %t
2-
// RUN: %target-build-swift %S/Inputs/ConcreteTypes.swift %S/Inputs/GenericTypes.swift %S/Inputs/Protocols.swift %S/Inputs/Extensions.swift %S/Inputs/Closures.swift -parse-as-library -emit-module -emit-library -module-name TypesToReflect -Xfrontend -enable-reflection-metadata -Xfrontend -enable-reflection-names -o %t/libTypesToReflect.%target-dylib-extension
2+
// RUN: %target-build-swift %S/Inputs/ConcreteTypes.swift %S/Inputs/GenericTypes.swift %S/Inputs/Protocols.swift %S/Inputs/Extensions.swift %S/Inputs/Closures.swift -parse-as-library -emit-module -emit-library -module-name TypesToReflect -o %t/libTypesToReflect.%target-dylib-extension
33
// RUN: %target-swift-reflection-dump -binary-filename %t/libTypesToReflect.%target-dylib-extension | FileCheck %s
44

55
// CHECK: FIELDS:

0 commit comments

Comments
 (0)