]> granicus.if.org Git - clang/commitdiff
DebugInfo: don't require full definitions for friend classes
authorDavid Blaikie <dblaikie@gmail.com>
Sun, 18 Aug 2013 04:50:23 +0000 (04:50 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Sun, 18 Aug 2013 04:50:23 +0000 (04:50 +0000)
Fixes a crash-on-valid introduced by r188486 (which should've occurred
earlier but for a blatant bug where calling createFwdDecl from the
requireCompleteType callback was useless under -flimit-debug-info and we
were just getting lucky with other later callbacks requiring the type
anyway).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188622 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp
test/CodeGenCXX/debug-info-friend.cpp

index e6e12e4a1a60efce2bb6e352051a1feea5fcca1b..71253caabbd9a1c6a5c393afe04a9488b9a30695 100644 (file)
@@ -1136,9 +1136,8 @@ CollectCXXFriends(const CXXRecordDecl *RD, llvm::DIFile Unit,
     if ((*BI)->isUnsupportedFriend())
       continue;
     if (TypeSourceInfo *TInfo = (*BI)->getFriendType())
-      EltTys.push_back(DBuilder.createFriend(RecordTy,
-                                             getOrCreateType(TInfo->getType(),
-                                                             Unit)));
+      EltTys.push_back(DBuilder.createFriend(
+          RecordTy, getOrCreateType(TInfo->getType(), Unit, true)));
   }
 }
 
index c50f281a3b8faef4b09e4a9b1634a255feb250d0..cf6651cde18edb353c95bee857178ef983ff7da6 100644 (file)
@@ -1,11 +1,17 @@
-// RUN: %clang -fverbose-asm -S -g %s -o - | grep DW_TAG_friend
+// RUN: %clang -emit-llvm -S -g %s -o - | FileCheck %s
 
 class MyFriend;
 
-class SomeClass
-{
friend class MyFriend;
+class SomeClass {
+  friend class MyFriend;
 typedef int SomeType;
 };
 
-SomeClass sc;
+SomeClass *x;
 
+struct MyFriend {
+  static void func(SomeClass::SomeType) {
+  }
+};
+
+// CHECK: DW_TAG_friend