From: Chris Lattner Date: Sun, 25 Oct 2009 17:47:27 +0000 (+0000) Subject: change Sema::ActOnFriendTypeDecl to use GetTypeForDeclarator instead X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c7f1904474600aa74f5f014941d2ed5c4cf462aa;p=clang change Sema::ActOnFriendTypeDecl to use GetTypeForDeclarator instead of ConvertDeclSpecToType, which I'd like to keep private to SemaType.cpp. We do this by cons'ing up a trivial Declarator for the type. John, please review. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85060 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h index 050b3f42e4..21e6e2c84c 100644 --- a/include/clang/Parse/Action.h +++ b/include/clang/Parse/Action.h @@ -1245,8 +1245,7 @@ public: } /// ActOnFriendTypeDecl - Parsed a friend type declaration. - virtual DeclPtrTy ActOnFriendTypeDecl(Scope *S, - const DeclSpec &DS, + virtual DeclPtrTy ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS, MultiTemplateParamsArg TParams) { return DeclPtrTy(); } diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 21f9e84728..fd8ffc8302 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -4271,8 +4271,7 @@ Sema::DeclPtrTy Sema::ActOnStaticAssertDeclaration(SourceLocation AssertLoc, /// We permit this as a special case; if there are any template /// parameters present at all, require proper matching, i.e. /// template <> template friend class A::B; -Sema::DeclPtrTy Sema::ActOnFriendTypeDecl(Scope *S, - const DeclSpec &DS, +Sema::DeclPtrTy Sema::ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS, MultiTemplateParamsArg TempParams) { SourceLocation Loc = DS.getSourceRange().getBegin(); @@ -4282,9 +4281,11 @@ Sema::DeclPtrTy Sema::ActOnFriendTypeDecl(Scope *S, // Try to convert the decl specifier to a type. This works for // friend templates because ActOnTag never produces a ClassTemplateDecl // for a TUK_Friend. - bool invalid = false; - QualType T = ConvertDeclSpecToType(DS, Loc, invalid); - if (invalid) return DeclPtrTy(); + Declarator TheDeclarator(DS, Declarator::MemberContext); + // TODO: Should use D.SetIdentifier() to specify where the identifier is? + QualType T = GetTypeForDeclarator(TheDeclarator, S); + if (TheDeclarator.isInvalidType()) + return DeclPtrTy(); // This is definitely an error in C++98. It's probably meant to // be forbidden in C++0x, too, but the specification is just