-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[Clang] Initial support for P2841 (Variable template and concept template parameters) #150823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
ef82ffb
7948dc0
8fedefe
352b44a
db90ccc
031ca84
01f651f
c8464a0
83d6873
0cb6d19
b8364a1
c24b5f1
695aa56
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -26,6 +26,7 @@ | |||||
#include "clang/Basic/LLVM.h" | ||||||
#include "clang/Basic/SourceLocation.h" | ||||||
#include "clang/Basic/Specifiers.h" | ||||||
#include "clang/Basic/TemplateKinds.h" | ||||||
#include "llvm/ADT/ArrayRef.h" | ||||||
#include "llvm/ADT/FoldingSet.h" | ||||||
#include "llvm/ADT/PointerIntPair.h" | ||||||
|
@@ -1585,6 +1586,9 @@ class TemplateTemplateParmDecl final | |||||
DefaultArgStorage<TemplateTemplateParmDecl, TemplateArgumentLoc *>; | ||||||
DefArgStorage DefaultArgument; | ||||||
|
||||||
LLVM_PREFERRED_TYPE(TemplateNameKind) | ||||||
unsigned ParameterKind : 3; | ||||||
|
||||||
/// Whether this template template parameter was declaration with | ||||||
/// the 'typename' keyword. | ||||||
/// | ||||||
|
@@ -1607,13 +1611,16 @@ class TemplateTemplateParmDecl final | |||||
|
||||||
TemplateTemplateParmDecl(DeclContext *DC, SourceLocation L, unsigned D, | ||||||
unsigned P, bool ParameterPack, IdentifierInfo *Id, | ||||||
bool Typename, TemplateParameterList *Params) | ||||||
TemplateNameKind ParameterKind, bool Typename, | ||||||
TemplateParameterList *Params) | ||||||
: TemplateDecl(TemplateTemplateParm, DC, L, Id, Params), | ||||||
TemplateParmPosition(D, P), Typename(Typename), | ||||||
ParameterPack(ParameterPack), ExpandedParameterPack(false) {} | ||||||
TemplateParmPosition(D, P), ParameterKind(ParameterKind), | ||||||
Typename(Typename), ParameterPack(ParameterPack), | ||||||
ExpandedParameterPack(false) {} | ||||||
|
||||||
TemplateTemplateParmDecl(DeclContext *DC, SourceLocation L, unsigned D, | ||||||
unsigned P, IdentifierInfo *Id, bool Typename, | ||||||
unsigned P, IdentifierInfo *Id, | ||||||
TemplateNameKind ParameterKind, bool Typename, | ||||||
TemplateParameterList *Params, | ||||||
ArrayRef<TemplateParameterList *> Expansions); | ||||||
|
||||||
|
@@ -1624,15 +1631,16 @@ class TemplateTemplateParmDecl final | |||||
friend class ASTDeclWriter; | ||||||
friend TrailingObjects; | ||||||
|
||||||
static TemplateTemplateParmDecl *Create(const ASTContext &C, DeclContext *DC, | ||||||
SourceLocation L, unsigned D, | ||||||
unsigned P, bool ParameterPack, | ||||||
IdentifierInfo *Id, bool Typename, | ||||||
TemplateParameterList *Params); | ||||||
static TemplateTemplateParmDecl * | ||||||
Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, | ||||||
unsigned P, IdentifierInfo *Id, bool Typename, | ||||||
TemplateParameterList *Params, | ||||||
unsigned P, bool ParameterPack, IdentifierInfo *Id, | ||||||
TemplateNameKind ParameterKind, bool Typename, | ||||||
TemplateParameterList *Params); | ||||||
|
||||||
static TemplateTemplateParmDecl * | ||||||
Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, | ||||||
unsigned P, IdentifierInfo *Id, TemplateNameKind ParameterKind, | ||||||
bool Typename, TemplateParameterList *Params, | ||||||
ArrayRef<TemplateParameterList *> Expansions); | ||||||
|
||||||
static TemplateTemplateParmDecl *CreateDeserialized(ASTContext &C, | ||||||
|
@@ -1746,6 +1754,16 @@ class TemplateTemplateParmDecl final | |||||
return SourceRange(getTemplateParameters()->getTemplateLoc(), End); | ||||||
} | ||||||
|
||||||
TemplateNameKind kind() const { | ||||||
|
||||||
return static_cast<TemplateNameKind>(ParameterKind); | ||||||
} | ||||||
|
||||||
bool isTypeConceptTemplateParam() const { | ||||||
return kind() == TemplateNameKind::TNK_Concept_template && | ||||||
getTemplateParameters()->size() > 0 && | ||||||
isa<TemplateTypeParmDecl>(getTemplateParameters()->getParam(0)); | ||||||
} | ||||||
|
||||||
// Implement isa/cast/dyncast/etc. | ||||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); } | ||||||
static bool classofKind(Kind K) { return K == TemplateTemplateParm; } | ||||||
|
@@ -3341,7 +3359,12 @@ inline TemplateDecl *getAsTypeTemplateDecl(Decl *D) { | |||||
return TD && (isa<ClassTemplateDecl>(TD) || | ||||||
isa<ClassTemplatePartialSpecializationDecl>(TD) || | ||||||
isa<TypeAliasTemplateDecl>(TD) || | ||||||
isa<TemplateTemplateParmDecl>(TD)) | ||||||
[&]() { | ||||||
if (TemplateTemplateParmDecl *TTP = | ||||||
|
if (TemplateTemplateParmDecl *TTP = | |
if (const auto *TTP = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems weird for a type named
ConceptReference
to not refer to aConceptDecl
anymore