Skip to content

Commit 3b0a13a

Browse files
committed
[BitwiseCopyable] Don't verify for interfaces.
Modules built without the feature enabled will have swiftinterfaces whose types don't conform to the protocol.
1 parent 79fcb5e commit 3b0a13a

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

lib/SIL/IR/TypeLowering.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3064,6 +3064,7 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
30643064
// unowned(unsafe) var o: AnyObject
30653065
// }
30663066
// (5) being defined in a different module
3067+
// (6) being defined in a module built from interface
30673068
bool hasNoNonconformingNode = visitAggregateLeaves(
30683069
origType, substType, forExpansion,
30693070
/*isLeafAggregate=*/
@@ -3085,8 +3086,15 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
30853086
if (nominal->isResilient())
30863087
return true;
30873088

3089+
auto *module = nominal->getModuleContext();
3090+
3091+
// Types in modules built from interfaces may not conform (case (6)).
3092+
if (module && module->isBuiltFromInterface()) {
3093+
return false;
3094+
}
3095+
30883096
// Trivial types from other modules may not conform (case (5)).
3089-
return nominal->getModuleContext() != &M;
3097+
return module != &M;
30903098
},
30913099
/*visit=*/
30923100
[&](auto ty, auto origTy, auto *field, auto index) -> bool {
@@ -3145,8 +3153,15 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
31453153
if (nominal->isResilient())
31463154
return false;
31473155

3156+
auto *module = nominal->getModuleContext();
3157+
3158+
// Types in modules built from interfaces may not conform (case (6)).
3159+
if (module && module->isBuiltFromInterface()) {
3160+
return false;
3161+
}
3162+
31483163
// Trivial types from other modules may not conform (case (5)).
3149-
return nominal->getModuleContext() == &M;
3164+
return module == &M;
31503165
});
31513166
if (hasNoNonconformingNode) {
31523167
llvm::errs() << "Trivial type without a BitwiseCopyable conformance!?:\n"

0 commit comments

Comments
 (0)