File tree Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -162,14 +162,18 @@ void Symbol::serializeRange(size_t InitialIndentation,
162
162
}
163
163
164
164
void Symbol::serializeDocComment (llvm::json::OStream &OS) const {
165
+ const auto *DocCommentProvidingDecl =
166
+ dyn_cast_or_null<ValueDecl>(
167
+ getDocCommentProvidingDecl (VD, /* AllowSerialized=*/ true ));
168
+ if (!DocCommentProvidingDecl) {
169
+ DocCommentProvidingDecl = VD;
170
+ }
171
+ auto RC = DocCommentProvidingDecl->getRawComment (/* SerializedOK=*/ true );
172
+ if (RC.isEmpty ()) {
173
+ return ;
174
+ }
175
+
165
176
OS.attributeObject (" docComment" , [&](){
166
- const auto *DocCommentProvidingDecl =
167
- dyn_cast_or_null<ValueDecl>(
168
- getDocCommentProvidingDecl (VD, /* AllowSerialized=*/ true ));
169
- if (!DocCommentProvidingDecl) {
170
- DocCommentProvidingDecl = VD;
171
- }
172
- auto RC = DocCommentProvidingDecl->getRawComment (/* SerializedOK=*/ true );
173
177
auto LL = Graph->Ctx .getLineList (RC);
174
178
size_t InitialIndentation = LL.getLines ().empty ()
175
179
? 0
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: %target-build-swift %s -module-name NoDocComment -emit-module-path %t/NoDocComment.swiftmodule
3
+ // RUN: %target-swift-symbolgraph-extract -module-name NoDocComment -I %t -pretty-print -output-dir %t
4
+ // RUN: %FileCheck %s --input-file %t/NoDocComment.symbols.json
5
+
6
+ public struct S { }
7
+
8
+ // CHECK-NOT: docComment
You can’t perform that action at this time.
0 commit comments