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 | 32f2fb53d9d7c28c94d8569fd0fcf06cccee0c3d (patch) | |
tree | 5a3ac384bc2e42e82731667b31d8d2b0ed46cb3d /lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | 7eff7c4153faf45b19b5919ef409ee5f6794eb25 (diff) |
Preserve type-source information in friend declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99525 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index de6fff7bb9..cbd9086dfb 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -480,13 +480,17 @@ Decl *TemplateDeclInstantiator::VisitFriendDecl(FriendDecl *D) { // Handle friend type expressions by simply substituting template // parameters into the pattern type. - if (Type *Ty = D->getFriendType()) { - QualType T = SemaRef.SubstType(QualType(Ty,0), TemplateArgs, - D->getLocation(), DeclarationName()); - if (T.isNull()) return 0; + if (TypeSourceInfo *Ty = D->getFriendType()) { + TypeSourceInfo *InstTy = + SemaRef.SubstType(Ty, TemplateArgs, + D->getLocation(), DeclarationName()); + if (!InstTy) return 0; - assert(getLangOptions().CPlusPlus0x || T->isRecordType()); - FU = T.getTypePtr(); + // This assertion is valid because the source type was necessarily + // an elaborated-type-specifier with a record tag. + assert(getLangOptions().CPlusPlus0x || InstTy->getType()->isRecordType()); + + FU = InstTy; // Handle everything else by appropriate substitution. } else { |