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).

llvm-svn: 188622

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

index e6e12e4..71253ca 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 c50f281..cf6651c 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