================
@@ -3488,6 +3460,89 @@ class UnresolvedLookupExpr final
}
};
+/// A template-id naming a variable template or a concept through a template
+/// template parameter.
+class DependentTemplateIdExpr final
+ : public Expr,
+ private llvm::TrailingObjects<DependentTemplateIdExpr,
+ TemplateArgumentLoc> {
+ friend class ASTStmtReader;
+ friend class ASTStmtWriter;
+ friend TrailingObjects;
+
+ DeclarationNameInfo NameInfo;
+ TemplateName Name;
+ ASTTemplateKWAndArgsInfo KWAndArgs;
+
+ DependentTemplateIdExpr(const ASTContext &Context,
+ SourceLocation TemplateKWLoc,
+ const DeclarationNameInfo &NameInfo,
+ TemplateName Name,
+ const TemplateArgumentListInfo &TemplateArgs);
+
+ DependentTemplateIdExpr(EmptyShell Empty, unsigned NumTemplateArgs);
+
+public:
+ static DependentTemplateIdExpr *
+ Create(const ASTContext &Context, SourceLocation TemplateKWLoc,
+ const DeclarationNameInfo &NameInfo, TemplateName Name,
+ const TemplateArgumentListInfo &TemplateArgs);
+
+ static DependentTemplateIdExpr *CreateEmpty(const ASTContext &Context,
+ unsigned NumTemplateArgs);
+
+ const DeclarationNameInfo &getNameInfo() const { return NameInfo; }
+ DeclarationName getName() const { return NameInfo.getName(); }
+ SourceLocation getNameLoc() const { return NameInfo.getLoc(); }
+
+ TemplateName getTemplateName() const { return Name; }
+
+ TemplateTemplateParmDecl *getParameter() const {
+ return cast<TemplateTemplateParmDecl>(Name.getAsTemplateDecl());
+ }
+
+ bool isConceptReference() const {
+ return getParameter()->templateParameterKind() == TNK_Concept_template;
+ }
+
+ SourceLocation getTemplateKeywordLoc() const {
+ return KWAndArgs.TemplateKWLoc;
+ }
+ SourceLocation getLAngleLoc() const { return KWAndArgs.LAngleLoc; }
+ SourceLocation getRAngleLoc() const { return KWAndArgs.RAngleLoc; }
+
+ unsigned getNumTemplateArgs() const { return KWAndArgs.NumTemplateArgs; }
+
+ ArrayRef<TemplateArgumentLoc> template_arguments() const {
+ return getTrailingObjects(getNumTemplateArgs());
+ }
+
+ SourceLocation getBeginLoc() const {
+ if (SourceLocation TemplateKWLoc = getTemplateKeywordLoc();
+ TemplateKWLoc.isValid())
+ return TemplateKWLoc;
+ return getNameLoc();
+ }
+
+ SourceLocation getEndLoc() const {
+ if (SourceLocation RAngleLoc = getRAngleLoc(); RAngleLoc.isValid())
----------------
cor3ntin wrote:
@zyn0217 I did. But it would back us into a corner if we want to add trailing
objects to DependentTemplateIdExpr later.
https://github.com/llvm/llvm-project/pull/216729
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits