@@ -351,76 +351,6 @@ void ASTContext::addComment(const RawComment &RC) {
351
351
Comments.addComment(RC, LangOpts.CommentOpts, BumpAlloc);
352
352
}
353
353
354
- /// If we have a 'templated' declaration for a template, adjust 'D' to
355
- /// refer to the actual template.
356
- /// If we have an implicit instantiation, adjust 'D' to refer to template.
357
- static const Decl &adjustDeclToTemplate(const Decl &D) {
358
- if (const auto *FD = dyn_cast<FunctionDecl>(&D)) {
359
- // Is this function declaration part of a function template?
360
- if (const FunctionTemplateDecl *FTD = FD->getDescribedFunctionTemplate())
361
- return *FTD;
362
-
363
- // Nothing to do if function is not an implicit instantiation.
364
- if (FD->getTemplateSpecializationKind() != TSK_ImplicitInstantiation)
365
- return D;
366
-
367
- // Function is an implicit instantiation of a function template?
368
- if (const FunctionTemplateDecl *FTD = FD->getPrimaryTemplate())
369
- return *FTD;
370
-
371
- // Function is instantiated from a member definition of a class template?
372
- if (const FunctionDecl *MemberDecl =
373
- FD->getInstantiatedFromMemberFunction())
374
- return *MemberDecl;
375
-
376
- return D;
377
- }
378
- if (const auto *VD = dyn_cast<VarDecl>(&D)) {
379
- // Static data member is instantiated from a member definition of a class
380
- // template?
381
- if (VD->isStaticDataMember())
382
- if (const VarDecl *MemberDecl = VD->getInstantiatedFromStaticDataMember())
383
- return *MemberDecl;
384
-
385
- return D;
386
- }
387
- if (const auto *CRD = dyn_cast<CXXRecordDecl>(&D)) {
388
- // Is this class declaration part of a class template?
389
- if (const ClassTemplateDecl *CTD = CRD->getDescribedClassTemplate())
390
- return *CTD;
391
-
392
- // Class is an implicit instantiation of a class template or partial
393
- // specialization?
394
- if (const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(CRD)) {
395
- if (CTSD->getSpecializationKind() != TSK_ImplicitInstantiation)
396
- return D;
397
- llvm::PointerUnion<ClassTemplateDecl *,
398
- ClassTemplatePartialSpecializationDecl *>
399
- PU = CTSD->getSpecializedTemplateOrPartial();
400
- return isa<ClassTemplateDecl *>(PU)
401
- ? *static_cast<const Decl *>(cast<ClassTemplateDecl *>(PU))
402
- : *static_cast<const Decl *>(
403
- cast<ClassTemplatePartialSpecializationDecl *>(PU));
404
- }
405
-
406
- // Class is instantiated from a member definition of a class template?
407
- if (const MemberSpecializationInfo *Info =
408
- CRD->getMemberSpecializationInfo())
409
- return *Info->getInstantiatedFrom();
410
-
411
- return D;
412
- }
413
- if (const auto *ED = dyn_cast<EnumDecl>(&D)) {
414
- // Enum is instantiated from a member definition of a class template?
415
- if (const EnumDecl *MemberDecl = ED->getInstantiatedFromMemberEnum())
416
- return *MemberDecl;
417
-
418
- return D;
419
- }
420
- // FIXME: Adjust alias templates?
421
- return D;
422
- }
423
-
424
354
const RawComment *ASTContext::getRawCommentForAnyRedecl(
425
355
const Decl *D,
426
356
const Decl **OriginalDecl) const {
0 commit comments