Skip to content

[NFC][Basic] Import llvm::isa_and_nonnull to 'swift' namespace #39078

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/swift/Basic/LLVM.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ namespace llvm {
namespace swift {
// Casting operators.
using llvm::isa;
using llvm::isa_and_nonnull;
using llvm::cast;
using llvm::dyn_cast;
using llvm::dyn_cast_or_null;
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/ASTWalker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1253,7 +1253,7 @@ class Traversal : public ASTVisitor<Traversal, Expr*, Stmt*,
if (Walker.Parent.getAsDecl() && VD->getParentPatternBinding())
return true;
auto walkerParentAsStmt = Walker.Parent.getAsStmt();
if (walkerParentAsStmt && isa<BraceStmt>(walkerParentAsStmt))
if (isa_and_nonnull<BraceStmt>(walkerParentAsStmt))
return true;
}
return false;
Expand Down
3 changes: 1 addition & 2 deletions lib/ClangImporter/ImportDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1343,8 +1343,7 @@ synthesizeValueConstructorBody(AbstractFunctionDecl *afd, void *context) {
for (unsigned i = 0, e = members.size(); i < e; ++i) {
auto var = members[i];

if (var->hasClangNode() &&
isa<clang::IndirectFieldDecl>(var->getClangDecl()))
if (isa_and_nonnull<clang::IndirectFieldDecl>(var->getClangDecl()))
continue;

if (var->hasStorage() == (pass != 0)) {
Expand Down
6 changes: 3 additions & 3 deletions lib/IDE/CodeCompletion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6366,7 +6366,7 @@ void CodeCompletionCallbacksImpl::addKeywords(CodeCompletionResultSink &Sink,
if (ParsedDecl && ParsedDecl == CurDeclContext->getAsDecl())
DC = ParsedDecl->getDeclContext();
if (!isa<ProtocolDecl>(DC))
if (DC->isTypeContext() || (ParsedDecl && isa<FuncDecl>(ParsedDecl)))
if (DC->isTypeContext() || isa_and_nonnull<FuncDecl>(ParsedDecl))
addOpaqueTypeKeyword(Sink);

LLVM_FALLTHROUGH;
Expand Down Expand Up @@ -7012,7 +7012,7 @@ void CodeCompletionCallbacksImpl::doneParsing() {
}
if (auto *DRE = dyn_cast_or_null<DeclRefExpr>(ParsedExpr)) {
Lookup.setIsSelfRefExpr(DRE->getDecl()->getName() == Context.Id_self);
} else if (ParsedExpr && isa<SuperRefExpr>(ParsedExpr)) {
} else if (isa_and_nonnull<SuperRefExpr>(ParsedExpr)) {
Lookup.setIsSuperRefExpr();
}

Expand Down Expand Up @@ -7205,7 +7205,7 @@ void CodeCompletionCallbacksImpl::doneParsing() {
Lookup.setHaveLParen(true);
for (auto &typeAndDecl : ContextInfo.getPossibleCallees()) {
auto apply = ContextInfo.getAnalyzedExpr();
if (apply && isa<SubscriptExpr>(apply)) {
if (isa_and_nonnull<SubscriptExpr>(apply)) {
Lookup.addSubscriptCallPattern(
typeAndDecl.Type,
dyn_cast_or_null<SubscriptDecl>(typeAndDecl.Decl),
Expand Down
4 changes: 2 additions & 2 deletions lib/IDE/Refactoring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4505,7 +4505,7 @@ struct AsyncHandlerParamDesc : public AsyncHandlerDesc {
}

bool alternativeIsAccessor() const {
return Alternative && isa<AccessorDecl>(Alternative);
return isa_and_nonnull<AccessorDecl>(Alternative);
}
};

Expand Down Expand Up @@ -6828,7 +6828,7 @@ class AsyncConverter : private SourceEntityWalker {
// for the completion handler call, e.g 'return completion(args...)'. In
// that case, be sure not to add another return.
auto *parent = getWalker().Parent.getAsStmt();
if (parent && isa<ReturnStmt>(parent) &&
if (isa_and_nonnull<ReturnStmt>(parent) &&
!cast<ReturnStmt>(parent)->isImplicit()) {
// The statement already has a return keyword. Don't add another one.
AddedReturnOrThrow = false;
Expand Down
8 changes: 3 additions & 5 deletions lib/IRGen/IRGenDebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1690,8 +1690,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
static bool canMangle(TypeBase *Ty) {
// TODO: C++ types are not yet supported (SR-13223).
if (Ty->getStructOrBoundGenericStruct() &&
Ty->getStructOrBoundGenericStruct()->getClangDecl() &&
isa<clang::CXXRecordDecl>(
isa_and_nonnull<clang::CXXRecordDecl>(
Ty->getStructOrBoundGenericStruct()->getClangDecl()))
return false;

Expand Down Expand Up @@ -2445,7 +2444,7 @@ void IRGenDebugInfoImpl::emitVariableDeclaration(
while (isa<llvm::DILexicalBlock>(Scope))
Scope = cast<llvm::DILexicalBlock>(Scope)->getScope();
}
assert(Scope && isa<llvm::DIScope>(Scope) && "variable has no scope");
assert(isa_and_nonnull<llvm::DIScope>(Scope) && "variable has no scope");
llvm::DIFile *Unit = getFile(Scope);
llvm::DIType *DITy = getOrCreateType(DbgTy);
assert(DITy && "could not determine debug type of variable");
Expand Down Expand Up @@ -2636,8 +2635,7 @@ void IRGenDebugInfoImpl::emitGlobalVariableDeclaration(
if (MetatypeType *metaTy = dyn_cast<MetatypeType>(ty))
ty = metaTy->getInstanceType().getPointer();
if (ty->getStructOrBoundGenericStruct() &&
ty->getStructOrBoundGenericStruct()->getClangDecl() &&
isa<clang::CXXRecordDecl>(
isa_and_nonnull<clang::CXXRecordDecl>(
ty->getStructOrBoundGenericStruct()->getClangDecl()))
return;
}
Expand Down
5 changes: 2 additions & 3 deletions lib/IRGen/IRGenSIL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1065,8 +1065,7 @@ class IRGenSILFunction :
if (MetatypeType *metaTy = dyn_cast<MetatypeType>(ty))
ty = metaTy->getRootClass().getPointer();
if (ty->getStructOrBoundGenericStruct() &&
ty->getStructOrBoundGenericStruct()->getClangDecl() &&
isa<clang::CXXRecordDecl>(
isa_and_nonnull<clang::CXXRecordDecl>(
ty->getStructOrBoundGenericStruct()->getClangDecl()))
return;
}
Expand Down Expand Up @@ -1709,7 +1708,7 @@ IRGenSILFunction::IRGenSILFunction(IRGenModule &IGM, SILFunction *f)
CurFn->addFnAttr(llvm::Attribute::SanitizeAddress);
if (IGM.IRGen.Opts.Sanitizers & SanitizerKind::Thread) {
auto declContext = f->getDeclContext();
if (declContext && isa<DestructorDecl>(declContext)) {
if (isa_and_nonnull<DestructorDecl>(declContext)) {
// Do not report races in deinit and anything called from it
// because TSan does not observe synchronization between retain
// count dropping to '0' and the object deinitialization.
Expand Down
4 changes: 2 additions & 2 deletions lib/Parse/ParseDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6906,7 +6906,7 @@ ParserResult<FuncDecl> Parser::parseDeclFunc(SourceLoc StaticLoc,
CurDeclContext);

// Let the source file track the opaque return type mapping, if any.
if (FuncRetTy && isa<OpaqueReturnTypeRepr>(FuncRetTy) &&
if (isa_and_nonnull<OpaqueReturnTypeRepr>(FuncRetTy) &&
!InInactiveClauseEnvironment) {
if (auto sf = CurDeclContext->getParentSourceFile()) {
sf->addUnvalidatedDeclWithOpaqueResultType(FD);
Expand Down Expand Up @@ -7773,7 +7773,7 @@ Parser::parseDeclSubscript(SourceLoc StaticLoc,
Subscript->getAttrs() = Attributes;

// Let the source file track the opaque return type mapping, if any.
if (ElementTy.get() && isa<OpaqueReturnTypeRepr>(ElementTy.get()) &&
if (isa_and_nonnull<OpaqueReturnTypeRepr>(ElementTy.get()) &&
!InInactiveClauseEnvironment) {
if (auto sf = CurDeclContext->getParentSourceFile()) {
sf->addUnvalidatedDeclWithOpaqueResultType(Subscript);
Expand Down
4 changes: 2 additions & 2 deletions lib/SIL/IR/SILFunctionType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4309,8 +4309,8 @@ TypeConverter::getLoweredFormalTypes(SILDeclRef constant,

// If this is a C++ constructor, don't add the metatype "self" parameter
// because we'll never use it and it will cause problems in IRGen.
if (constant.getDecl()->getClangDecl() &&
isa<clang::CXXConstructorDecl>(constant.getDecl()->getClangDecl())) {
if (isa_and_nonnull<clang::CXXConstructorDecl>(
constant.getDecl()->getClangDecl())) {
// But, make sure it is actually a metatype that we're not adding. If
// changes to the self parameter are made in the future, this logic may
// need to be updated.
Expand Down
4 changes: 2 additions & 2 deletions lib/SILGen/SILGenApply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,8 @@ class Callee {
};

// Remove the metatype "self" parameter by making this a static member.
if (constant->getDecl()->getClangDecl() &&
isa<clang::CXXConstructorDecl>(constant->getDecl()->getClangDecl()))
if (isa_and_nonnull<clang::CXXConstructorDecl>(
constant->getDecl()->getClangDecl()))
result.foreign.self.setStatic();

return result;
Expand Down
2 changes: 1 addition & 1 deletion lib/SILGen/SILGenConvert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ class ExistentialInitialization final : public SingleBufferInitialization {
}

bool isInPlaceInitializationOfGlobal() const override {
return existential && isa<GlobalAddrInst>(existential);
return isa_and_nonnull<GlobalAddrInst>(existential);
}

void finishInitialization(SILGenFunction &SGF) override {
Expand Down
3 changes: 1 addition & 2 deletions lib/SILGen/SILGenLValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3138,8 +3138,7 @@ bool isCallToReplacedInDynamicReplacement(SILGenFunction &SGF,
bool &isObjCReplacementSelfCall);

static bool isCallToSelfOfCurrentFunction(SILGenFunction &SGF, LookupExpr *e) {
return SGF.FunctionDC->getAsDecl() &&
isa<AbstractFunctionDecl>(SGF.FunctionDC->getAsDecl()) &&
return isa_and_nonnull<AbstractFunctionDecl>(SGF.FunctionDC->getAsDecl()) &&
e->getBase()->isSelfExprOf(
cast<AbstractFunctionDecl>(SGF.FunctionDC->getAsDecl()), false);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/SILOptimizer/Mandatory/Differentiation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ emitDerivativeFunctionReference(
context.emitNondifferentiabilityError(
original, invoker, diag::autodiff_private_derivative_from_fragile,
fragileKind,
llvm::isa_and_nonnull<AbstractClosureExpr>(
isa_and_nonnull<AbstractClosureExpr>(
originalFRI->getLoc().getAsASTNode<Expr>()));
return None;
}
Expand Down
3 changes: 1 addition & 2 deletions lib/Sema/CSApply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,7 @@ Solution::resolveConcreteDeclRef(ValueDecl *decl,

// If this is a C++ function template, get it's specialization for the given
// substitution map and update the decl accordingly.
if (decl->getClangDecl() &&
isa<clang::FunctionTemplateDecl>(decl->getClangDecl())) {
if (isa_and_nonnull<clang::FunctionTemplateDecl>(decl->getClangDecl())) {
auto *newFn =
decl->getASTContext()
.getClangModuleLoader()
Expand Down
12 changes: 6 additions & 6 deletions lib/Sema/CSDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3162,7 +3162,7 @@ void ContextualFailure::tryComputedPropertyFixIts() const {
auto *initExpr = PBD->getInit(i);
if (!VD->isStatic() &&
!VD->getAttrs().getAttribute<DynamicReplacementAttr>() &&
initExpr && isa<ClosureExpr>(initExpr)) {
isa_and_nonnull<ClosureExpr>(initExpr)) {
auto diag = emitDiagnostic(diag::extension_stored_property_fixit,
VD->getName());
diag.fixItRemove(PBD->getEqualLoc(i));
Expand Down Expand Up @@ -3956,7 +3956,7 @@ bool AllowTypeOrInstanceMemberFailure::diagnoseAsError() {
if (!argExpr)
return false;
auto possibleApplyExpr = findParentExpr(expr);
return possibleApplyExpr && isa<ApplyExpr>(possibleApplyExpr);
return isa_and_nonnull<ApplyExpr>(possibleApplyExpr);
};

auto *initCall = findParentExpr(findParentExpr(ctorRef));
Expand Down Expand Up @@ -6924,14 +6924,14 @@ bool MissingContextualBaseInMemberRefFailure::diagnoseAsError() {
auto *parentExpr = findParentExpr(anchor);

// Look through immediate call of unresolved member (e.g., `.foo(0)`).
if (parentExpr && isa<CallExpr>(parentExpr))
if (isa_and_nonnull<CallExpr>(parentExpr))
parentExpr = findParentExpr(parentExpr);

// FIXME: We should probably look through the entire member chain so that
// something like `let _ = .foo().bar` gets the "no contextual type" error
// rather than the "Cannot infer contextual base" error.
UnresolvedMemberChainResultExpr *resultExpr = nullptr;
if (parentExpr && isa<UnresolvedMemberChainResultExpr>(parentExpr)) {
if (isa_and_nonnull<UnresolvedMemberChainResultExpr>(parentExpr)) {
resultExpr = cast<UnresolvedMemberChainResultExpr>(parentExpr);
parentExpr = findParentExpr(parentExpr);
}
Expand Down Expand Up @@ -7469,12 +7469,12 @@ bool MissingContextualTypeForNil::diagnoseAsError() {
// attempt any types for it.
auto *parentExpr = findParentExpr(expr);

while (parentExpr && isa<IdentityExpr>(parentExpr))
while (isa_and_nonnull<IdentityExpr>(parentExpr))
parentExpr = findParentExpr(parentExpr);

// In cases like `_ = nil?` AST would have `nil`
// wrapped in `BindOptionalExpr`.
if (parentExpr && isa<BindOptionalExpr>(parentExpr))
if (isa_and_nonnull<BindOptionalExpr>(parentExpr))
parentExpr = findParentExpr(parentExpr);

if (parentExpr) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/CSSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2318,7 +2318,7 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,

if (shouldAttemptFixes()) {
auto *anchor = locator.trySimplifyToExpr();
if (anchor && isa<ClosureExpr>(anchor) &&
if (isa_and_nonnull<ClosureExpr>(anchor) &&
isSingleTupleParam(ctx, func2Params) &&
canImplodeParams(func1Params)) {
auto *fix = AllowClosureParamDestructuring::create(
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/ConstraintSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5096,7 +5096,7 @@ ConstraintSystem::isConversionEphemeral(ConversionRestrictionKind conversion,
// For an instance member, the base must be an @lvalue struct type.
if (auto *lvt = simplifyType(getType(base))->getAs<LValueType>()) {
auto *nominal = lvt->getObjectType()->getAnyNominal();
if (nominal && isa<StructDecl>(nominal)) {
if (isa_and_nonnull<StructDecl>(nominal)) {
subExpr = base;
continue;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Sema/MiscDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ static void diagSyntacticUseRestrictions(const Expr *E, const DeclContext *DC,
// Void to _ then warn, because that is redundant.
if (auto DAE = dyn_cast<DiscardAssignmentExpr>(destExpr)) {
if (auto CE = dyn_cast<CallExpr>(AE->getSrc())) {
if (CE->getCalledValue() && isa<FuncDecl>(CE->getCalledValue()) &&
if (isa_and_nonnull<FuncDecl>(CE->getCalledValue()) &&
CE->getType()->isVoid()) {
Ctx.Diags
.diagnose(DAE->getLoc(),
Expand Down Expand Up @@ -1427,7 +1427,7 @@ static void diagRecursivePropertyAccess(const Expr *E, const DeclContext *DC) {

// But silence the warning if the base was explicitly qualified.
auto parentAsExpr = Parent.getAsExpr();
if (parentAsExpr && isa<DotSyntaxBaseIgnoredExpr>(parentAsExpr))
if (isa_and_nonnull<DotSyntaxBaseIgnoredExpr>(parentAsExpr))
shouldDiagnose = false;

if (shouldDiagnose) {
Expand Down Expand Up @@ -4078,7 +4078,7 @@ static void diagnoseUnintendedOptionalBehavior(const Expr *E,

if (auto *apply = dyn_cast<ApplyExpr>(E)) {
auto *decl = apply->getCalledValue();
if (decl && isa<AbstractFunctionDecl>(decl))
if (isa_and_nonnull<AbstractFunctionDecl>(decl))
return decl;
}
return nullptr;
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/TypeCheckAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2973,7 +2973,7 @@ void AttributeChecker::visitCustomAttr(CustomAttr *attr) {
if (isa<ParamDecl>(D)) {
// Check for unsupported declarations.
auto *context = D->getDeclContext()->getAsDecl();
if (context && isa<SubscriptDecl>(context)) {
if (isa_and_nonnull<SubscriptDecl>(context)) {
diagnose(attr->getLocation(),
diag::property_wrapper_param_not_supported,
context->getDescriptiveKind());
Expand Down
3 changes: 1 addition & 2 deletions lib/Sema/TypeCheckAvailability.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1978,8 +1978,7 @@ static void fixItAvailableAttrRename(InFlightDiagnostic &diag,

// Continue on to diagnose any argument label renames.

} else if (parsed.BaseName == "init" &&
call && isa<CallExpr>(call)) {
} else if (parsed.BaseName == "init" && isa_and_nonnull<CallExpr>(call)) {
// For initializers, replace with a "call" of the context type...but only
// if we know we're doing a call (rather than a first-class reference).
if (parsed.isMember()) {
Expand Down
4 changes: 2 additions & 2 deletions lib/Sema/TypeCheckConcurrency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1591,7 +1591,7 @@ namespace {
}
}

} else if (llvm::isa_and_nonnull<SelfApplyExpr>(context) &&
} else if (isa_and_nonnull<SelfApplyExpr>(context) &&
isa<AbstractFunctionDecl>(decl)) {
// actor-isolated non-isolated-self calls are implicitly async
// and thus OK.
Expand Down Expand Up @@ -1649,7 +1649,7 @@ namespace {
ValueDecl *decl = concDeclRef.getDecl();
ThrowsMarkingResult result = ThrowsMarkingResult::NotFound;

if (llvm::isa_and_nonnull<SelfApplyExpr>(context)) {
if (isa_and_nonnull<SelfApplyExpr>(context)) {
if (auto func = dyn_cast<AbstractFunctionDecl>(decl)) {
if (func->isDistributed() && !func->hasThrows()) {
// A distributed function is implicitly throwing if called from
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/TypeCheckDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1935,7 +1935,7 @@ bool swift::isMemberOperator(FuncDecl *decl, Type type) {
auto selfNominal = DC->getSelfNominalTypeDecl();

// Check the parameters for a reference to 'Self'.
bool isProtocol = selfNominal && isa<ProtocolDecl>(selfNominal);
bool isProtocol = isa_and_nonnull<ProtocolDecl>(selfNominal);
for (auto param : *decl->getParameters()) {
// Look through a metatype reference, if there is one.
auto paramType = param->getInterfaceType()->getMetatypeInstanceType();
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/TypeCheckDeclPrimary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2777,7 +2777,7 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
if (FD->getDeclContext()->isTypeContext()) {
if (FD->isOperator() && !isMemberOperator(FD, nullptr)) {
auto selfNominal = FD->getDeclContext()->getSelfNominalTypeDecl();
auto isProtocol = selfNominal && isa<ProtocolDecl>(selfNominal);
auto isProtocol = isa_and_nonnull<ProtocolDecl>(selfNominal);
// We did not find 'Self'. Complain.
FD->diagnose(diag::operator_in_unrelated_type,
FD->getDeclContext()->getDeclaredInterfaceType(), isProtocol,
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/TypeCheckStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1422,7 +1422,7 @@ void TypeChecker::checkIgnoredExpr(Expr *E) {
// Otherwise, complain. Start with more specific diagnostics.

// Diagnose unused constructor calls.
if (callee && isa<ConstructorDecl>(callee) && !call->isImplicit()) {
if (isa_and_nonnull<ConstructorDecl>(callee) && !call->isImplicit()) {
DE.diagnose(fn->getLoc(), diag::expression_unused_init_result,
callee->getDeclContext()->getDeclaredInterfaceType())
.highlight(call->getArg()->getSourceRange());
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/TypeCheckType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3762,7 +3762,7 @@ TypeResolver::resolveCompositionType(CompositionTypeRepr *repr,
if (ty->hasError()) return ty;

auto nominalDecl = ty->getAnyNominal();
if (nominalDecl && isa<ClassDecl>(nominalDecl)) {
if (isa_and_nonnull<ClassDecl>(nominalDecl)) {
if (checkSuperclass(tyR->getStartLoc(), ty))
continue;

Expand Down
3 changes: 1 addition & 2 deletions lib/Serialization/Deserialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6495,8 +6495,7 @@ void ModuleFile::finishNormalConformance(NormalProtocolConformance *conformance,
} else {
fatal(thirdOrError.takeError());
}
if (third &&
isa<TypeAliasDecl>(third) &&
if (isa_and_nonnull<TypeAliasDecl>(third) &&
third->getModuleContext() != getAssociatedModule() &&
!third->getDeclaredInterfaceType()->isEqual(second)) {
// Conservatively drop references to typealiases in other modules
Expand Down