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