Skip to content

Commit 575f033

Browse files
committed
[IRGen] update isNoncopyable query
resolves rdar://117594962
1 parent a9194a5 commit 575f033

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/IRGen/GenReflection.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ getTypeRefImpl(IRGenModule &IGM,
382382
useFlatUnique = true;
383383
break;
384384

385-
case MangledTypeRefRole::FieldMetadata:
385+
case MangledTypeRefRole::FieldMetadata: {
386386
// We want to keep fields of noncopyable type from being exposed to
387387
// in-process runtime reflection libraries in older Swift runtimes, since
388388
// they more than likely assume they can copy field values, and the language
@@ -391,11 +391,16 @@ getTypeRefImpl(IRGenModule &IGM,
391391
// noncopyable, use a function to emit the type ref which will look for a
392392
// signal from future runtimes whether they support noncopyable types before
393393
// exposing their metadata to them.
394-
if (type->isNoncopyable()) {
394+
Type contextualTy = type;
395+
if (sig)
396+
contextualTy = sig.getGenericEnvironment()->mapTypeIntoContext(type);
397+
398+
if (contextualTy->isNoncopyable()) {
395399
IGM.IRGen.noteUseOfTypeMetadata(type);
396400
return getTypeRefByFunction(IGM, sig, type);
397401
}
398-
LLVM_FALLTHROUGH;
402+
}
403+
LLVM_FALLTHROUGH;
399404

400405
case MangledTypeRefRole::DefaultAssociatedTypeWitness:
401406
case MangledTypeRefRole::Metadata:

0 commit comments

Comments
 (0)