summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclFriend.cpp
diff options
context:
space:
mode:
authorEnea Zaffanella <zaffanella@cs.unipr.it>2013-01-31 09:54:08 +0000
committerEnea Zaffanella <zaffanella@cs.unipr.it>2013-01-31 09:54:08 +0000
commiteb22c870aca64819ec919607c6328b8ded2480c0 (patch)
treea78d4cb0d2f2379f5520cd60afa501be603167bd /clang/lib/AST/DeclFriend.cpp
parent102846714a88538554c7ff69773140152e6135e9 (diff)
downloadbcm5719-llvm-eb22c870aca64819ec919607c6328b8ded2480c0.tar.gz
bcm5719-llvm-eb22c870aca64819ec919607c6328b8ded2480c0.zip
Added outer template parameter lists to friend type AST nodes.
llvm-svn: 174050
Diffstat (limited to 'clang/lib/AST/DeclFriend.cpp')
-rw-r--r--clang/lib/AST/DeclFriend.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/clang/lib/AST/DeclFriend.cpp b/clang/lib/AST/DeclFriend.cpp
index 553d170fc3d..37a812e71aa 100644
--- a/clang/lib/AST/DeclFriend.cpp
+++ b/clang/lib/AST/DeclFriend.cpp
@@ -27,7 +27,8 @@ FriendDecl *FriendDecl::getNextFriendSlowCase() {
FriendDecl *FriendDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L,
FriendUnion Friend,
- SourceLocation FriendL) {
+ SourceLocation FriendL,
+ ArrayRef<TemplateParameterList*> FriendTypeTPLists) {
#ifndef NDEBUG
if (Friend.is<NamedDecl*>()) {
NamedDecl *D = Friend.get<NamedDecl*>();
@@ -40,15 +41,25 @@ FriendDecl *FriendDecl::Create(ASTContext &C, DeclContext *DC,
// to the original declaration when instantiating members.
assert(D->getFriendObjectKind() ||
(cast<CXXRecordDecl>(DC)->getTemplateSpecializationKind()));
+ // These template parameters are for friend types only.
+ assert(FriendTypeTPLists.size() == 0);
}
#endif
- FriendDecl *FD = new (C) FriendDecl(DC, L, Friend, FriendL);
+ std::size_t Size = sizeof(FriendDecl)
+ + FriendTypeTPLists.size() * sizeof(TemplateParameterList*);
+ void *Mem = C.Allocate(Size);
+ FriendDecl *FD = new (Mem) FriendDecl(DC, L, Friend, FriendL,
+ FriendTypeTPLists);
cast<CXXRecordDecl>(DC)->pushFriendDecl(FD);
return FD;
}
-FriendDecl *FriendDecl::CreateDeserialized(ASTContext &C, unsigned ID) {
- void *Mem = AllocateDeserializedDecl(C, ID, sizeof(FriendDecl));
- return new (Mem) FriendDecl(EmptyShell());
+FriendDecl *FriendDecl::CreateDeserialized(ASTContext &C, unsigned ID,
+ unsigned FriendTypeNumTPLists) {
+ std::size_t Size = sizeof(FriendDecl)
+ + FriendTypeNumTPLists * sizeof(TemplateParameterList*);
+ void *Mem = AllocateDeserializedDecl(C, ID, Size);
+ return new (Mem) FriendDecl(EmptyShell(), FriendTypeNumTPLists);
}
+
OpenPOWER on IntegriCloud