diff options
| author | John McCall <rjmccall@apple.com> | 2010-03-25 18:04:51 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-03-25 18:04:51 +0000 |
| commit | 15ad0962dc93e9e8c833aef846d75b7d9f3ef031 (patch) | |
| tree | c36fdc23950e70fc8f8bf5ac7f785f2948d2daa3 /clang/lib/Sema/SemaDeclCXX.cpp | |
| parent | 49e121d5e42c5d7429805d7a5a0d1f40b91edecf (diff) | |
| download | bcm5719-llvm-15ad0962dc93e9e8c833aef846d75b7d9f3ef031.tar.gz bcm5719-llvm-15ad0962dc93e9e8c833aef846d75b7d9f3ef031.zip | |
Preserve type-source information in friend declarations.
llvm-svn: 99525
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 76875c97739..9a68f472e67 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -5372,7 +5372,8 @@ Sema::DeclPtrTy Sema::ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS, // friend templates because ActOnTag never produces a ClassTemplateDecl // for a TUK_Friend. Declarator TheDeclarator(DS, Declarator::MemberContext); - QualType T = GetTypeForDeclarator(TheDeclarator, S); + TypeSourceInfo *TSI; + QualType T = GetTypeForDeclarator(TheDeclarator, S, &TSI); if (TheDeclarator.isInvalidType()) return DeclPtrTy(); @@ -5437,16 +5438,20 @@ Sema::DeclPtrTy Sema::ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS, // deadline. It's also a very silly restriction that seriously // affects inner classes and which nobody else seems to implement; // thus we never diagnose it, not even in -pedantic. + // + // But note that we could warn about it: it's always useless to + // friend one of your own members (it's not, however, worthless to + // friend a member of an arbitrary specialization of your template). Decl *D; if (TempParams.size()) D = FriendTemplateDecl::Create(Context, CurContext, Loc, TempParams.size(), (TemplateParameterList**) TempParams.release(), - T.getTypePtr(), + TSI, DS.getFriendSpecLoc()); else - D = FriendDecl::Create(Context, CurContext, Loc, T.getTypePtr(), + D = FriendDecl::Create(Context, CurContext, Loc, TSI, DS.getFriendSpecLoc()); D->setAccess(AS_public); CurContext->addDecl(D); |

