]> granicus.if.org Git - clang/commitdiff
change Sema::ActOnFriendTypeDecl to use GetTypeForDeclarator instead
authorChris Lattner <sabre@nondot.org>
Sun, 25 Oct 2009 17:47:27 +0000 (17:47 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 25 Oct 2009 17:47:27 +0000 (17:47 +0000)
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

include/clang/Parse/Action.h
lib/Sema/SemaDeclCXX.cpp

index 050b3f42e4cd2781b82a9d1bd47d2aa9f19ee1b7..21e6e2c84cb90ce27af01a674b07c32c930227d7 100644 (file)
@@ -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();
   }
index 21f9e8472802407250522f517ec0577564b8a026..fd8ffc8302baf233a5cb3e64c1f4dcbe01da3bbc 100644 (file)
@@ -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 <class T> friend class A<int>::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