Skip to content

Commit c9785d9

Browse files
committed
[SourceKit] Stop printing normal comments in clang generated interface
Generated interfaces for Clang modules used to try printing normal comments between decls extracted from the header text. That was because doc-comment was not common in C/ObjC headers. But mainly because of "import as member feature" Clang decls aren't printed in the order as they appear in the header file, the logic determinig which comment belongs to which decl was not working property. We've decided to remove that feature and only print the proper doc-comments as it has been getting common. rdar://93731287
1 parent 5d6ce70 commit c9785d9

30 files changed

+2297
-3179
lines changed

include/swift/AST/PrintOptions.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -502,9 +502,6 @@ struct PrintOptions {
502502
/// (e.g. the overridden method in the superclass) if such comment is found.
503503
bool PrintDocumentationComments = false;
504504

505-
/// Whether to print regular comments from clang module headers.
506-
bool PrintRegularClangComments = false;
507-
508505
/// When true, printing interface from a source file will print the original
509506
/// source text for applicable declarations, in order to preserve the
510507
/// formatting.
@@ -645,7 +642,6 @@ struct PrintOptions {
645642
result.TypeDefinitions = true;
646643
result.VarInitializers = true;
647644
result.PrintDocumentationComments = true;
648-
result.PrintRegularClangComments = true;
649645
result.PrintLongAttrsOnSeparateLines = true;
650646
result.AlwaysTryPrintParameterLabels = true;
651647
return result;

lib/AST/ASTPrinter.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,9 +1138,7 @@ class PrintAST : public ASTVisitor<PrintAST> {
11381138
// handles this, but we need to insert it for clang doc comments when not
11391139
// printing other clang comments. Do it now so the printDeclPre callback
11401140
// happens after the newline.
1141-
if (Options.PrintDocumentationComments &&
1142-
!Options.PrintRegularClangComments &&
1143-
D->hasClangNode()) {
1141+
if (Options.PrintDocumentationComments && D->hasClangNode()) {
11441142
auto clangNode = D->getClangNode();
11451143
auto clangDecl = clangNode.getAsDecl();
11461144
if (clangDecl &&
@@ -1150,7 +1148,6 @@ class PrintAST : public ASTVisitor<PrintAST> {
11501148
}
11511149
}
11521150

1153-
11541151
Printer.callPrintDeclPre(D, Options.BracketOptions);
11551152

11561153
if (Options.PrintCompatibilityFeatureChecks) {

lib/IDE/IDETypeChecking.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ PrintOptions PrintOptions::printDocInterface() {
118118
result.ArgAndParamPrinting =
119119
PrintOptions::ArgAndParamPrintingMode::BothAlways;
120120
result.PrintDocumentationComments = false;
121-
result.PrintRegularClangComments = false;
122121
result.PrintFunctionRepresentationAttrs =
123122
PrintOptions::FunctionRepresentationMode::None;
124123
return result;

0 commit comments

Comments
 (0)