mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Revert "IRGen: Brazenly nuke -enable-dynamic-value-type-layout flag"
Speculatively reverting because the iOS bots are broken. Swift SVN r29145
This commit is contained in:
@@ -86,6 +86,9 @@ public:
|
|||||||
/// \brief Whether we're generating IR for the JIT.
|
/// \brief Whether we're generating IR for the JIT.
|
||||||
unsigned UseJIT : 1;
|
unsigned UseJIT : 1;
|
||||||
|
|
||||||
|
/// \brief Whether we allow dynamic value type layout.
|
||||||
|
unsigned EnableDynamicValueTypeLayout : 1;
|
||||||
|
|
||||||
/// \brief Whether we should run LLVM optimizations after IRGen.
|
/// \brief Whether we should run LLVM optimizations after IRGen.
|
||||||
unsigned DisableLLVMOptzns : 1;
|
unsigned DisableLLVMOptzns : 1;
|
||||||
|
|
||||||
@@ -119,8 +122,9 @@ public:
|
|||||||
|
|
||||||
IRGenOptions() : OutputKind(IRGenOutputKind::LLVMAssembly), Verify(true),
|
IRGenOptions() : OutputKind(IRGenOutputKind::LLVMAssembly), Verify(true),
|
||||||
Optimize(false), DebugInfoKind(IRGenDebugInfoKind::None),
|
Optimize(false), DebugInfoKind(IRGenDebugInfoKind::None),
|
||||||
UseJIT(false), DisableLLVMOptzns(false),
|
UseJIT(false), EnableDynamicValueTypeLayout(false),
|
||||||
DisableLLVMARCOpts(false), DisableLLVMSLPVectorizer(false),
|
DisableLLVMOptzns(false), DisableLLVMARCOpts(false),
|
||||||
|
DisableLLVMSLPVectorizer(false),
|
||||||
DisableFPElim(true), HasUnderlyingModule(false),
|
DisableFPElim(true), HasUnderlyingModule(false),
|
||||||
Playground(false), GenerateProfile(false),
|
Playground(false), GenerateProfile(false),
|
||||||
EmbedMode(IRGenEmbedMode::None) {}
|
EmbedMode(IRGenEmbedMode::None) {}
|
||||||
|
|||||||
@@ -174,6 +174,10 @@ def dump_clang_diagnostics : Flag<["-"], "dump-clang-diagnostics">,
|
|||||||
def emit_verbose_sil : Flag<["-"], "emit-verbose-sil">,
|
def emit_verbose_sil : Flag<["-"], "emit-verbose-sil">,
|
||||||
HelpText<"Emit locations during SIL emission">;
|
HelpText<"Emit locations during SIL emission">;
|
||||||
|
|
||||||
|
def enable_dynamic_value_type_layout :
|
||||||
|
Flag<["-"], "enable-dynamic-value-type-layout">,
|
||||||
|
HelpText<"Enable experimental dynamic generic struct/enum/class type layout">;
|
||||||
|
|
||||||
def enable_experimental_patterns : Flag<["-"], "enable-experimental-patterns">,
|
def enable_experimental_patterns : Flag<["-"], "enable-experimental-patterns">,
|
||||||
HelpText<"Enable experimental 'switch' pattern matching features">;
|
HelpText<"Enable experimental 'switch' pattern matching features">;
|
||||||
|
|
||||||
|
|||||||
@@ -1028,6 +1028,8 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
|
|||||||
if (Args.hasArg(OPT_disable_llvm_verify))
|
if (Args.hasArg(OPT_disable_llvm_verify))
|
||||||
Opts.Verify = false;
|
Opts.Verify = false;
|
||||||
|
|
||||||
|
Opts.EnableDynamicValueTypeLayout |=
|
||||||
|
Args.hasArg(OPT_enable_dynamic_value_type_layout);
|
||||||
Opts.HasUnderlyingModule |= Args.hasArg(OPT_import_underlying_module);
|
Opts.HasUnderlyingModule |= Args.hasArg(OPT_import_underlying_module);
|
||||||
|
|
||||||
if (Args.hasArg(OPT_autolink_force_load))
|
if (Args.hasArg(OPT_autolink_force_load))
|
||||||
|
|||||||
@@ -367,9 +367,23 @@ namespace {
|
|||||||
|
|
||||||
void addDirectFieldsFromClass(ClassDecl *theClass,
|
void addDirectFieldsFromClass(ClassDecl *theClass,
|
||||||
SILType classType) {
|
SILType classType) {
|
||||||
|
bool complainedAboutUnimplementedLayout = false;
|
||||||
for (VarDecl *var : theClass->getStoredProperties()) {
|
for (VarDecl *var : theClass->getStoredProperties()) {
|
||||||
SILType type = classType.getFieldType(var, *IGM.SILMod);
|
SILType type = classType.getFieldType(var, *IGM.SILMod);
|
||||||
auto &eltType = IGM.getTypeInfo(type);
|
auto &eltType = IGM.getTypeInfo(type);
|
||||||
|
|
||||||
|
// FIXME: Type-parameter-dependent field layout isn't fully
|
||||||
|
// implemented yet for ObjC-derived classes.
|
||||||
|
if (theClass->isObjC()
|
||||||
|
&& !eltType.isFixedSize()
|
||||||
|
&& !IGM.Opts.EnableDynamicValueTypeLayout) {
|
||||||
|
if (!complainedAboutUnimplementedLayout) {
|
||||||
|
IGM.unimplemented(var->getLoc(),
|
||||||
|
"non-fixed class layout in ObjC-derived classes");
|
||||||
|
complainedAboutUnimplementedLayout = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Elements.push_back(ElementLayout::getIncomplete(eltType));
|
Elements.push_back(ElementLayout::getIncomplete(eltType));
|
||||||
AllStoredProperties.push_back(var);
|
AllStoredProperties.push_back(var);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// RUN: rm -rf %t && mkdir %t
|
// RUN: rm -rf %t && mkdir %t
|
||||||
// RUN: %build-irgen-test-overlays
|
// RUN: %build-irgen-test-overlays
|
||||||
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | FileCheck %s
|
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -enable-dynamic-value-type-layout %s -emit-ir | FileCheck %s
|
||||||
|
|
||||||
// REQUIRES: CPU=i386_or_x86_64
|
// REQUIRES: CPU=i386_or_x86_64
|
||||||
// REQUIRES: objc_interop
|
// REQUIRES: objc_interop
|
||||||
|
|||||||
11
test/IRGen/unimplemented_objc_generic_class.swift
Normal file
11
test/IRGen/unimplemented_objc_generic_class.swift
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// RUN: %target-swift-frontend %s -emit-ir -verify -disable-objc-attr-requires-foundation-module
|
||||||
|
|
||||||
|
// REQUIRES: objc_interop
|
||||||
|
|
||||||
|
@objc class ObjCBox<T> {
|
||||||
|
var x: T // expected-error{{unimplemented}}
|
||||||
|
|
||||||
|
init(x: T) {
|
||||||
|
self.x = x
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
// RUN: mkdir -p %t
|
// RUN: mkdir -p %t
|
||||||
//
|
//
|
||||||
// RUN: %target-clang -fobjc-arc %S/Inputs/ObjCClasses/ObjCClasses.m -c -o %t/ObjCClasses.o
|
// RUN: %target-clang -fobjc-arc %S/Inputs/ObjCClasses/ObjCClasses.m -c -o %t/ObjCClasses.o
|
||||||
// RUN: %target-build-swift -I %S/Inputs/ObjCClasses/ -Xlinker %t/ObjCClasses.o %s -o %t/a.out
|
// RUN: %target-build-swift -Xfrontend -enable-dynamic-value-type-layout -I %S/Inputs/ObjCClasses/ -Xlinker %t/ObjCClasses.o %s -o %t/a.out
|
||||||
// RUN: %target-run %t/a.out | FileCheck %s
|
// RUN: %target-run %t/a.out | FileCheck %s
|
||||||
|
|
||||||
// XFAIL: linux
|
// XFAIL: linux
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// RUN: %target-swift-frontend %s -emit-ir
|
// RUN: not --crash %target-swift-frontend %s -emit-ir
|
||||||
|
|
||||||
// REQUIRES: objc_interop
|
// REQUIRES: objc_interop
|
||||||
|
|
||||||
Reference in New Issue
Block a user