diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-09-01 21:49:51 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-09-01 21:49:51 +0000 |
commit | 7803ec829d1cc657e21bb0d1afb8596a81bfd542 (patch) | |
tree | f767feb40678383a482b11739d1a80a23e1b2762 | |
parent | 898267f67b8131c4bed4430e2cfaf69ccf4c2de1 (diff) |
Don't try to emit unsupported templated friend declarations. They're unsupported
and may very well be dependent-types, triggering an assertion in debug info
codegen.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138970 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 5 | ||||
-rw-r--r-- | test/CodeGenCXX/debug-info.cpp | 12 |
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 44c16a32b3..01aa6e906a 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -774,7 +774,7 @@ CGDebugInfo::CreateCXXMemberFunction(const CXXMethodDecl *Method, Flags |= llvm::DIDescriptor::FlagPrototyped; llvm::DISubprogram SP = - DBuilder.createMethod(RecordTy , MethodName, MethodLinkageName, + DBuilder.createMethod(RecordTy, MethodName, MethodLinkageName, MethodDefUnit, MethodLine, MethodTy, /*isLocalToUnit=*/false, /* isDefinition=*/ false, @@ -811,9 +811,10 @@ void CGDebugInfo:: CollectCXXFriends(const CXXRecordDecl *RD, llvm::DIFile Unit, SmallVectorImpl<llvm::Value *> &EltTys, llvm::DIType RecordTy) { - for (CXXRecordDecl::friend_iterator BI = RD->friend_begin(), BE = RD->friend_end(); BI != BE; ++BI) { + if ((*BI)->isUnsupportedFriend()) + continue; if (TypeSourceInfo *TInfo = (*BI)->getFriendType()) EltTys.push_back(DBuilder.createFriend(RecordTy, getOrCreateType(TInfo->getType(), diff --git a/test/CodeGenCXX/debug-info.cpp b/test/CodeGenCXX/debug-info.cpp index 71c8603a9f..33b52789ca 100644 --- a/test/CodeGenCXX/debug-info.cpp +++ b/test/CodeGenCXX/debug-info.cpp @@ -55,3 +55,15 @@ void foo() { const wchar_t c = L'x'; wchar_t d = c; } + +namespace b5249287 { +template <typename T> class A { + struct B; +}; + +class Cls { + template <typename T> friend class A<T>::B; +}; + +Cls obj; +} |