Skip to content

Commit c4c14ba

Browse files
committed
[SILGen] Cleanup isForeignToNativeThunk slightly
Bail early for the foreign case.
1 parent da65826 commit c4c14ba

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/SIL/IR/SILDeclRef.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,19 +611,23 @@ EffectsKind SILDeclRef::getEffectsAttribute() const {
611611
}
612612

613613
bool SILDeclRef::isForeignToNativeThunk() const {
614+
// If this isn't a native entry-point, it's not a foreign-to-native thunk.
615+
if (isForeign)
616+
return false;
617+
614618
// Non-decl entry points are never natively foreign, so they would never
615619
// have a foreign-to-native thunk.
616620
if (!hasDecl())
617621
return false;
618622
if (requiresForeignToNativeThunk(getDecl()))
619-
return !isForeign;
623+
return true;
620624
// ObjC initializing constructors and factories are foreign.
621625
// We emit a special native allocating constructor though.
622626
if (isa<ConstructorDecl>(getDecl())
623627
&& (kind == Kind::Initializer
624628
|| cast<ConstructorDecl>(getDecl())->isFactoryInit())
625629
&& getDecl()->hasClangNode())
626-
return !isForeign;
630+
return true;
627631
return false;
628632
}
629633

0 commit comments

Comments
 (0)