mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Simplify swift::getInheritedForPrinting to take a PrintOptions
This lets us make some more assumptions in the next commit, but I think it's also just a nice cleanup to /not/ allow random predicates here. There were three callers of this API: - PrintAST, which was using PrintOptions::shouldPrint but /also/ incorrectly notifying listeners that a declaration would be skipped. - (IDE) Interface generation, which uses PrintOptions::shouldPrint to count how many "inherits" there will be. - SwiftDocSupport's reportRelated, which does no filtering at all. Creating a PrintOptions here is a little more expensive, but still. No intended functionality change.
This commit is contained in:
@@ -547,7 +547,7 @@ static void reportRelated(ASTContext &Ctx, const Decl *D,
|
||||
passInheritsAndConformancesForValueDecl(TAD, Consumer);
|
||||
} else if (const auto *TD = dyn_cast<TypeDecl>(D)) {
|
||||
llvm::SmallVector<TypeLoc, 4> AllInherits;
|
||||
getInheritedForPrinting(TD, [](const Decl* d) { return true; }, AllInherits);
|
||||
getInheritedForPrinting(TD, PrintOptions(), AllInherits);
|
||||
passInherits(AllInherits, Consumer);
|
||||
passConforms(TD->getSatisfiedProtocolRequirements(/*Sorted=*/true),
|
||||
Consumer);
|
||||
|
||||
Reference in New Issue
Block a user