summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-03-25 18:04:51 +0000
committerJohn McCall <rjmccall@apple.com>2010-03-25 18:04:51 +0000
commit15ad0962dc93e9e8c833aef846d75b7d9f3ef031 (patch)
treec36fdc23950e70fc8f8bf5ac7f785f2948d2daa3 /clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
parent49e121d5e42c5d7429805d7a5a0d1f40b91edecf (diff)
downloadbcm5719-llvm-15ad0962dc93e9e8c833aef846d75b7d9f3ef031.tar.gz
bcm5719-llvm-15ad0962dc93e9e8c833aef846d75b7d9f3ef031.zip
Preserve type-source information in friend declarations.
llvm-svn: 99525
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiateDecl.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index de6fff7bb91..cbd9086dfb2 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/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 {
OpenPOWER on IntegriCloud