Skip to content

Commit b019fd0

Browse files
authored
Merge pull request #72420 from rintaro/sourcekit-clang-printer-rdar93731287
[SourceKit] Stop printing normal comments in clang generated interface
2 parents 0c2425f + c9785d9 commit b019fd0

30 files changed

+2297
-3179
lines changed

include/swift/AST/PrintOptions.h

-4
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

+1-4
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

-1
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)