[PATCH] D124238: [AST] QualifiedTemplateName::getTemplateDecl cleanup.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 22 01:36:33 PDT 2022
hokein created this revision.
hokein added a reviewer: sammccall.
Herald added a subscriber: arphaman.
Herald added a project: All.
hokein requested review of this revision.
Herald added a project: clang.
This is a followup cleanup of 1234b1c6d8113d50beef5801be607ad1d502b2f7 <https://reviews.llvm.org/rG1234b1c6d8113d50beef5801be607ad1d502b2f7>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D124238
Files:
clang/include/clang/AST/TemplateName.h
clang/lib/AST/ItaniumMangle.cpp
clang/lib/AST/TemplateName.cpp
clang/lib/Sema/TreeTransform.h
clang/tools/libclang/CIndex.cpp
Index: clang/tools/libclang/CIndex.cpp
===================================================================
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -1462,8 +1462,10 @@
case TemplateName::QualifiedTemplate:
// FIXME: Visit nested-name-specifier.
- return Visit(MakeCursorTemplateRef(
- Name.getAsQualifiedTemplateName()->getTemplateDecl(), Loc, TU));
+ return Visit(MakeCursorTemplateRef(Name.getAsQualifiedTemplateName()
+ ->getUnderlyingTemplate()
+ .getAsTemplateDecl(),
+ Loc, TU));
case TemplateName::SubstTemplateTemplateParm:
return Visit(MakeCursorTemplateRef(
Index: clang/lib/Sema/TreeTransform.h
===================================================================
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -4280,7 +4280,7 @@
NamedDecl *FirstQualifierInScope,
bool AllowInjectedClassName) {
if (QualifiedTemplateName *QTN = Name.getAsQualifiedTemplateName()) {
- TemplateDecl *Template = QTN->getTemplateDecl();
+ TemplateDecl *Template = QTN->getUnderlyingTemplate().getAsTemplateDecl();
assert(Template && "qualified template name must refer to a template");
TemplateDecl *TransTemplate
Index: clang/lib/AST/TemplateName.cpp
===================================================================
--- clang/lib/AST/TemplateName.cpp
+++ clang/lib/AST/TemplateName.cpp
@@ -115,7 +115,7 @@
}
if (QualifiedTemplateName *QTN = getAsQualifiedTemplateName())
- return QTN->getTemplateDecl();
+ return QTN->getUnderlyingTemplate().getAsTemplateDecl();
if (SubstTemplateTemplateParmStorage *sub = getAsSubstTemplateTemplateParm())
return sub->getReplacement().getAsTemplateDecl();
@@ -273,14 +273,15 @@
if (Qual == Qualified::Fully &&
getDependence() !=
TemplateNameDependenceScope::DependentInstantiation) {
- QTN->getTemplateDecl()->printQualifiedName(OS, Policy);
+ QTN->getUnderlyingTemplate().getAsTemplateDecl()->printQualifiedName(
+ OS, Policy);
return;
}
if (Qual == Qualified::AsWritten)
QTN->getQualifier()->print(OS, Policy);
if (QTN->hasTemplateKeyword())
OS << "template ";
- OS << *QTN->getTemplateDecl();
+ OS << *QTN->getUnderlyingTemplate().getAsTemplateDecl();
} else if (DependentTemplateName *DTN = getAsDependentTemplateName()) {
if (Qual == Qualified::AsWritten && DTN->getQualifier())
DTN->getQualifier()->print(OS, Policy);
Index: clang/lib/AST/ItaniumMangle.cpp
===================================================================
--- clang/lib/AST/ItaniumMangle.cpp
+++ clang/lib/AST/ItaniumMangle.cpp
@@ -2204,7 +2204,9 @@
switch (TN.getKind()) {
case TemplateName::QualifiedTemplate:
- TD = TN.getAsQualifiedTemplateName()->getTemplateDecl();
+ TD = TN.getAsQualifiedTemplateName()
+ ->getUnderlyingTemplate()
+ .getAsTemplateDecl();
goto HaveDecl;
case TemplateName::UsingTemplate:
Index: clang/include/clang/AST/TemplateName.h
===================================================================
--- clang/include/clang/AST/TemplateName.h
+++ clang/include/clang/AST/TemplateName.h
@@ -439,13 +439,6 @@
/// Return the underlying template name.
TemplateName getUnderlyingTemplate() const { return UnderlyingTemplate; }
- /// The template declaration to which this qualified name
- /// refers.
- /// FIXME: remove this and use getUnderlyingTemplate() instead.
- TemplateDecl *getTemplateDecl() const {
- return UnderlyingTemplate.getAsTemplateDecl();
- }
-
void Profile(llvm::FoldingSetNodeID &ID) {
Profile(ID, getQualifier(), hasTemplateKeyword(), UnderlyingTemplate);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124238.424402.patch
Type: text/x-patch
Size: 3935 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220422/e987a1cc/attachment.bin>
More information about the cfe-commits
mailing list