@@ -381,33 +381,31 @@ void DocComment::addInheritanceNote(swift::markup::MarkupContext &MC,
381
381
}
382
382
383
383
DocComment *swift::getSingleDocComment (swift::markup::MarkupContext &MC,
384
- const Decl *D, bool AllowSerialized ) {
384
+ const Decl *D) {
385
385
PrettyStackTraceDecl StackTrace (" parsing comment for" , D);
386
386
387
- auto RC = D->getRawComment (AllowSerialized );
387
+ auto RC = D->getRawComment ();
388
388
if (RC.isEmpty ())
389
389
return nullptr ;
390
390
return DocComment::create (D, MC, RC);
391
391
}
392
392
393
393
namespace {
394
- const ValueDecl *findOverriddenDeclWithDocComment (const ValueDecl *VD,
395
- bool AllowSerialized = true ) {
394
+ const ValueDecl *findOverriddenDeclWithDocComment (const ValueDecl *VD) {
396
395
// Only applies to class member.
397
396
if (!VD->getDeclContext ()->getSelfClassDecl ())
398
397
return nullptr ;
399
398
400
399
while (auto *baseDecl = VD->getOverriddenDecl ()) {
401
- if (!baseDecl->getRawComment (AllowSerialized ).isEmpty ())
400
+ if (!baseDecl->getRawComment ().isEmpty ())
402
401
return baseDecl;
403
402
VD = baseDecl;
404
403
}
405
404
406
405
return nullptr ;
407
406
}
408
407
409
- const ValueDecl *findDefaultProvidedDeclWithDocComment (const ValueDecl *VD,
410
- bool AllowSerialized = false ) {
408
+ const ValueDecl *findDefaultProvidedDeclWithDocComment (const ValueDecl *VD) {
411
409
auto protocol = VD->getDeclContext ()->getExtendedProtocolDecl ();
412
410
// Only applies to protocol extension member.
413
411
if (!protocol)
@@ -423,8 +421,7 @@ const ValueDecl *findDefaultProvidedDeclWithDocComment(const ValueDecl *VD,
423
421
424
422
for (auto *member : members) {
425
423
if (!isa<ProtocolDecl>(member->getDeclContext ()) ||
426
- !member->isProtocolRequirement () ||
427
- member->getRawComment (AllowSerialized).isEmpty ())
424
+ !member->isProtocolRequirement () || member->getRawComment ().isEmpty ())
428
425
continue ;
429
426
if (requirement)
430
427
// Found two or more decls with doc-comment.
@@ -435,12 +432,11 @@ const ValueDecl *findDefaultProvidedDeclWithDocComment(const ValueDecl *VD,
435
432
return requirement;
436
433
}
437
434
438
- const ValueDecl *findRequirementDeclWithDocComment (const ValueDecl *VD,
439
- bool AllowSerialized = false ) {
435
+ const ValueDecl *findRequirementDeclWithDocComment (const ValueDecl *VD) {
440
436
std::queue<const ValueDecl *> requirements;
441
437
while (true ) {
442
438
for (auto *req : VD->getSatisfiedProtocolRequirements ()) {
443
- if (!req->getRawComment (AllowSerialized ).isEmpty ())
439
+ if (!req->getRawComment ().isEmpty ())
444
440
return req;
445
441
else
446
442
requirements.push (req);
@@ -453,38 +449,36 @@ const ValueDecl *findRequirementDeclWithDocComment(const ValueDecl *VD,
453
449
}
454
450
} // namespace
455
451
456
- const Decl *swift::getDocCommentProvidingDecl (const Decl *D,
457
- bool AllowSerialized) {
452
+ const Decl *swift::getDocCommentProvidingDecl (const Decl *D) {
458
453
if (!D->canHaveComment ())
459
454
return nullptr ;
460
455
461
- if (!D->getRawComment (AllowSerialized ).isEmpty ())
456
+ if (!D->getRawComment ().isEmpty ())
462
457
return D;
463
458
464
459
auto *VD = dyn_cast<ValueDecl>(D);
465
460
if (!VD)
466
461
return nullptr ;
467
462
468
- if (auto *overridden = findOverriddenDeclWithDocComment (VD, AllowSerialized ))
463
+ if (auto *overridden = findOverriddenDeclWithDocComment (VD))
469
464
return overridden;
470
465
471
- if (auto *requirement = findDefaultProvidedDeclWithDocComment (VD, AllowSerialized ))
466
+ if (auto *requirement = findDefaultProvidedDeclWithDocComment (VD))
472
467
return requirement;
473
468
474
- if (auto *requirement = findRequirementDeclWithDocComment (VD, AllowSerialized ))
469
+ if (auto *requirement = findRequirementDeclWithDocComment (VD))
475
470
return requirement;
476
471
477
472
return nullptr ;
478
473
}
479
474
480
- DocComment *
481
- swift::getCascadingDocComment (swift::markup::MarkupContext &MC, const Decl *D,
482
- bool AllowSerialized) {
483
- auto *docD = getDocCommentProvidingDecl (D, AllowSerialized);
475
+ DocComment *swift::getCascadingDocComment (swift::markup::MarkupContext &MC,
476
+ const Decl *D) {
477
+ auto *docD = getDocCommentProvidingDecl (D);
484
478
if (!docD)
485
479
return nullptr ;
486
480
487
- auto *doc = getSingleDocComment (MC, docD, AllowSerialized );
481
+ auto *doc = getSingleDocComment (MC, docD);
488
482
assert (doc && " getDocCommentProvidingDecl() returned decl with no comment" );
489
483
490
484
// If the doc-comment is inherited from other decl, add a note about it.
0 commit comments