[cfe-commits] r138970 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGenCXX/debug-info.cpp

Nick Lewycky nicholas at mxc.ca
Thu Sep 1 14:49:52 PDT 2011


Author: nicholas
Date: Thu Sep  1 16:49:51 2011
New Revision: 138970

URL: http://llvm.org/viewvc/llvm-project?rev=138970&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
    cfe/trunk/test/CodeGenCXX/debug-info.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=138970&r1=138969&r2=138970&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Sep  1 16:49:51 2011
@@ -774,7 +774,7 @@
     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 @@
 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(), 

Modified: cfe/trunk/test/CodeGenCXX/debug-info.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info.cpp?rev=138970&r1=138969&r2=138970&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info.cpp Thu Sep  1 16:49:51 2011
@@ -55,3 +55,15 @@
   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;
+}





More information about the cfe-commits mailing list