summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-09-14 21:59:20 +0000
committerJohn McCall <rjmccall@apple.com>2009-09-14 21:59:20 +0000
commit27b5c253d841005ecef94a4a79b0851b568891ec (patch)
tree8917dc6dc87bb21eb90d63402553d9251afd6977 /clang/lib/Sema/SemaDeclCXX.cpp
parentb4e19177cbe87bdea74b7c707938a9df66c37df7 (diff)
downloadbcm5719-llvm-27b5c253d841005ecef94a4a79b0851b568891ec.tar.gz
bcm5719-llvm-27b5c253d841005ecef94a4a79b0851b568891ec.zip
Skeletal support for friend class templates.
llvm-svn: 81801
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 0adf3e834e9..9e497782507 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -4009,12 +4009,35 @@ Sema::DeclPtrTy Sema::ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
}
Sema::DeclPtrTy Sema::ActOnFriendTypeDecl(Scope *S,
- const DeclSpec &DS) {
+ const DeclSpec &DS,
+ bool IsTemplate) {
SourceLocation Loc = DS.getSourceRange().getBegin();
assert(DS.isFriendSpecified());
assert(DS.getStorageClassSpec() == DeclSpec::SCS_unspecified);
+ // Handle friend templates specially.
+ if (IsTemplate) {
+ Decl *D;
+ switch (DS.getTypeSpecType()) {
+ default:
+ // FIXME: implement this
+ assert(false && "unelaborated type templates are currently unimplemented!");
+ case DeclSpec::TST_class:
+ case DeclSpec::TST_union:
+ case DeclSpec::TST_struct:
+ D = (Decl*) DS.getTypeRep();
+ }
+
+ ClassTemplateDecl *Temp = cast<ClassTemplateDecl>(D);
+ FriendDecl *FD = FriendDecl::Create(Context, CurContext, Loc, Temp,
+ DS.getFriendSpecLoc());
+ FD->setAccess(AS_public);
+ CurContext->addDecl(FD);
+
+ return DeclPtrTy::make(FD);
+ }
+
// Try to convert the decl specifier to a type.
bool invalid = false;
QualType T = ConvertDeclSpecToType(DS, Loc, invalid);
OpenPOWER on IntegriCloud