forked from OSchip/llvm-project
parent
47cd7a91f4
commit
165b58181f
|
@ -1651,6 +1651,12 @@ private:
|
|||
FriendLoc(FriendLoc)
|
||||
{}
|
||||
|
||||
FriendTemplateDecl(EmptyShell Empty)
|
||||
: Decl(Decl::FriendTemplate, Empty),
|
||||
NumParams(0),
|
||||
Params(0)
|
||||
{}
|
||||
|
||||
public:
|
||||
static FriendTemplateDecl *Create(ASTContext &Context,
|
||||
DeclContext *DC, SourceLocation Loc,
|
||||
|
@ -1659,6 +1665,8 @@ public:
|
|||
FriendUnion Friend,
|
||||
SourceLocation FriendLoc);
|
||||
|
||||
static FriendTemplateDecl *Create(ASTContext &Context, EmptyShell Empty);
|
||||
|
||||
/// If this friend declaration names a templated type (or
|
||||
/// a dependent member type of a templated type), return that
|
||||
/// type; otherwise return null.
|
||||
|
@ -1691,6 +1699,8 @@ public:
|
|||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classofKind(Kind K) { return K == Decl::FriendTemplate; }
|
||||
static bool classof(const FriendTemplateDecl *D) { return true; }
|
||||
|
||||
friend class PCHDeclReader;
|
||||
};
|
||||
|
||||
/// Implementation of inline functions that require the template declarations
|
||||
|
|
|
@ -631,3 +631,8 @@ FriendTemplateDecl *FriendTemplateDecl::Create(ASTContext &Context,
|
|||
= new (Context) FriendTemplateDecl(DC, L, NParams, Params, Friend, FLoc);
|
||||
return Result;
|
||||
}
|
||||
|
||||
FriendTemplateDecl *FriendTemplateDecl::Create(ASTContext &Context,
|
||||
EmptyShell Empty) {
|
||||
return new (Context) FriendTemplateDecl(Empty);
|
||||
}
|
||||
|
|
|
@ -853,7 +853,17 @@ void PCHDeclReader::VisitFriendDecl(FriendDecl *D) {
|
|||
}
|
||||
|
||||
void PCHDeclReader::VisitFriendTemplateDecl(FriendTemplateDecl *D) {
|
||||
assert(false && "cannot read FriendTemplateDecl");
|
||||
VisitDecl(D);
|
||||
unsigned NumParams = Record[Idx++];
|
||||
D->NumParams = NumParams;
|
||||
D->Params = new TemplateParameterList*[NumParams];
|
||||
for (unsigned i = 0; i != NumParams; ++i)
|
||||
D->Params[i] = Reader.ReadTemplateParameterList(Record, Idx);
|
||||
if (Record[Idx++]) // HasFriendDecl
|
||||
D->Friend = cast<NamedDecl>(Reader.GetDecl(Record[Idx++]));
|
||||
else
|
||||
D->Friend = Reader.GetTypeSourceInfo(Record, Idx);
|
||||
D->FriendLoc = Reader.ReadSourceLocation(Record, Idx);
|
||||
}
|
||||
|
||||
void PCHDeclReader::VisitTemplateDecl(TemplateDecl *D) {
|
||||
|
@ -1374,7 +1384,7 @@ Decl *PCHReader::ReadDeclRecord(unsigned Index) {
|
|||
D = FriendDecl::Create(*Context, Decl::EmptyShell());
|
||||
break;
|
||||
case pch::DECL_FRIEND_TEMPLATE:
|
||||
assert(false && "cannot read FriendTemplateDecl");
|
||||
D = FriendTemplateDecl::Create(*Context, Decl::EmptyShell());
|
||||
break;
|
||||
case pch::DECL_CLASS_TEMPLATE:
|
||||
D = ClassTemplateDecl::Create(*Context, 0, SourceLocation(),
|
||||
|
|
|
@ -818,7 +818,17 @@ void PCHDeclWriter::VisitFriendDecl(FriendDecl *D) {
|
|||
}
|
||||
|
||||
void PCHDeclWriter::VisitFriendTemplateDecl(FriendTemplateDecl *D) {
|
||||
assert(false && "cannot write FriendTemplateDecl");
|
||||
VisitDecl(D);
|
||||
Record.push_back(D->getNumTemplateParameters());
|
||||
for (unsigned i = 0, e = D->getNumTemplateParameters(); i != e; ++i)
|
||||
Writer.AddTemplateParameterList(D->getTemplateParameterList(i), Record);
|
||||
Record.push_back(D->getFriendDecl() != 0);
|
||||
if (D->getFriendDecl())
|
||||
Writer.AddDeclRef(D->getFriendDecl(), Record);
|
||||
else
|
||||
Writer.AddTypeSourceInfo(D->getFriendType(), Record);
|
||||
Writer.AddSourceLocation(D->getFriendLoc(), Record);
|
||||
Code = pch::DECL_FRIEND_TEMPLATE;
|
||||
}
|
||||
|
||||
void PCHDeclWriter::VisitTemplateDecl(TemplateDecl *D) {
|
||||
|
|
Loading…
Reference in New Issue