Skip to content

Commit 0ad5915

Browse files
committed
Revert "[InterfacePrinting] Print stdlib internal protocols whose names start with no '_'"
This reverts commit ca7c1e5692bdd51cb0800be42c964462a3c84436. Swift SVN r30191
1 parent 6ae3d5d commit 0ad5915

File tree

4 files changed

+1
-34
lines changed

4 files changed

+1
-34
lines changed

include/swift/AST/ASTPrinter.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ class ASTPrinter {
8787
PendingDeclLocCallback = D;
8888
}
8989

90-
static bool isInternalProtocol(const Decl *D);
91-
9290
/// To sanitize a malformatted utf8 string to a well-formatted one.
9391
static std::string sanitizeUtf8(StringRef Text);
9492

include/swift/AST/PrintOptions.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,6 @@ struct PrintOptions {
144144
/// Whether we are printing part of SIL body.
145145
bool PrintInSILBody = false;
146146

147-
/// Wheter we print the internal protocols in stdlib whose names start with no
148-
/// '_'. rdar://21515803
149-
bool PrintInternalStdlibProtocols = false;
150-
151147
enum class ArgAndParamPrintingMode {
152148
ArgumentOnly,
153149
MatchSource,
@@ -202,7 +198,6 @@ struct PrintOptions {
202198
result.PrintFunctionRepresentationAttrs = false;
203199
result.PrintOverrideKeyword = false;
204200
result.AccessibilityFilter = Accessibility::Public;
205-
result.PrintInternalStdlibProtocols = true;
206201
return result;
207202
}
208203

@@ -217,7 +212,6 @@ struct PrintOptions {
217212
result.PrintDocumentationComments = false;
218213
result.PrintRegularClangComments = false;
219214
result.PrintAccessibility = false;
220-
result.PrintInternalStdlibProtocols = true;
221215
return result;
222216
}
223217

lib/AST/ASTPrinter.cpp

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,6 @@
4343

4444
using namespace swift;
4545

46-
bool ASTPrinter::isInternalProtocol(const Decl *D) {
47-
if (auto Pro = dyn_cast<ProtocolDecl>(D)) {
48-
if (!Pro->getNameStr().startswith("_") &&
49-
Pro->getFormalAccess() == Accessibility::Internal) {
50-
return true;
51-
}
52-
}
53-
return false;
54-
}
55-
5646
std::string ASTPrinter::sanitizeUtf8(StringRef Text) {
5747
llvm::SmallString<256> Builder;
5848
Builder.reserve(Text.size());
@@ -627,12 +617,6 @@ void PrintAST::printPatternType(const Pattern *P) {
627617
}
628618

629619
bool PrintAST::shouldPrint(const Decl *D) {
630-
if (D->getModuleContext()->isStdlibModule() &&
631-
ASTPrinter::isInternalProtocol(D) &&
632-
Options.PrintInternalStdlibProtocols) {
633-
return true;
634-
}
635-
636620
if (Options.SkipDeinit && isa<DestructorDecl>(D)) {
637621
return false;
638622
}
@@ -1346,10 +1330,7 @@ void PrintAST::visitProtocolDecl(ProtocolDecl *decl) {
13461330

13471331
printInherited(decl, explicitClass);
13481332
if (Options.TypeDefinitions) {
1349-
if (!Options.PrintInternalStdlibProtocols ||
1350-
!ASTPrinter::isInternalProtocol(decl) ||
1351-
!decl->getModuleContext()->isStdlibModule())
1352-
printMembers(decl->getMembers());
1333+
printMembers(decl->getMembers());
13531334
}
13541335
}
13551336

lib/IDE/ModuleInterfacePrinting.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,6 @@ void swift::ide::printSubmoduleInterface(
141141
const PrintOptions &Options) {
142142
auto AdjustedOptions = Options;
143143
adjustPrintOptions(AdjustedOptions);
144-
auto PrintInternalProtocol = Options.PrintInternalStdlibProtocols &&
145-
M->isStdlibModule();
146144

147145
SmallVector<Decl *, 1> Decls;
148146
M->getDisplayDecls(Decls);
@@ -210,10 +208,6 @@ void swift::ide::printSubmoduleInterface(
210208
if (Options.SkipUnavailable && D->getAttrs().isUnavailable(SwiftContext))
211209
continue;
212210

213-
if (PrintInternalProtocol && ASTPrinter::isInternalProtocol(D)) {
214-
SwiftDecls.push_back(D);
215-
}
216-
217211
// Skip declarations that are not accessible.
218212
if (auto *VD = dyn_cast<ValueDecl>(D)) {
219213
if (Options.AccessibilityFilter > Accessibility::Private &&

0 commit comments

Comments
 (0)