Skip to content

Commit d6c8ca0

Browse files
committed
Constify PrintOptions in ShouldPrintChecker::shouldPrint
No functionality change.
1 parent febc065 commit d6c8ca0

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

include/swift/AST/PrintOptions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ class AnyAttrKind {
112112
};
113113

114114
struct ShouldPrintChecker {
115-
virtual bool shouldPrint(const Decl *D, PrintOptions &Options);
116-
bool shouldPrint(const Pattern *P, PrintOptions &Options);
115+
virtual bool shouldPrint(const Decl *D, const PrintOptions &Options);
116+
bool shouldPrint(const Pattern *P, const PrintOptions &Options);
117117
virtual ~ShouldPrintChecker() = default;
118118
};
119119

lib/AST/ASTPrinter.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ PrintOptions PrintOptions::printTextualInterfaceFile() {
7373
result.SkipImports = true;
7474

7575
class UsableFromInlineOnly : public ShouldPrintChecker {
76-
bool shouldPrint(const Decl *D, PrintOptions &options) override {
76+
bool shouldPrint(const Decl *D, const PrintOptions &options) override {
7777
if (auto *VD = dyn_cast<ValueDecl>(D)) {
7878
AccessScope accessScope =
7979
VD->getFormalAccessScope(/*useDC*/nullptr,
@@ -1303,15 +1303,17 @@ void PrintAST::printPatternType(const Pattern *P) {
13031303
}
13041304
}
13051305

1306-
bool ShouldPrintChecker::shouldPrint(const Pattern *P, PrintOptions &Options) {
1306+
bool ShouldPrintChecker::shouldPrint(const Pattern *P,
1307+
const PrintOptions &Options) {
13071308
bool ShouldPrint = false;
13081309
P->forEachVariable([&](const VarDecl *VD) {
13091310
ShouldPrint |= shouldPrint(VD, Options);
13101311
});
13111312
return ShouldPrint;
13121313
}
13131314

1314-
bool ShouldPrintChecker::shouldPrint(const Decl *D, PrintOptions &Options) {
1315+
bool ShouldPrintChecker::shouldPrint(const Decl *D,
1316+
const PrintOptions &Options) {
13151317
if (auto *ED= dyn_cast<ExtensionDecl>(D)) {
13161318
if (Options.printExtensionContentAsMembers(ED))
13171319
return false;

lib/IDE/IDETypeChecking.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
using namespace swift;
2828

29-
static bool shouldPrintAsFavorable(const Decl *D, PrintOptions &Options) {
29+
static bool shouldPrintAsFavorable(const Decl *D, const PrintOptions &Options) {
3030
if (!Options.TransformContext ||
3131
!D->getDeclContext()->isExtensionContext() ||
3232
!Options.TransformContext->isPrintingSynthesizedExtension())
@@ -42,7 +42,7 @@ static bool shouldPrintAsFavorable(const Decl *D, PrintOptions &Options) {
4242
}
4343

4444
class ModulePrinterPrintableChecker: public ShouldPrintChecker {
45-
bool shouldPrint(const Decl *D, PrintOptions &Options) override {
45+
bool shouldPrint(const Decl *D, const PrintOptions &Options) override {
4646
if (!shouldPrintAsFavorable(D, Options))
4747
return false;
4848
return ShouldPrintChecker::shouldPrint(D, Options);

0 commit comments

Comments
 (0)