From d0f251b4cd60c9746bbd5ebbed5058cd7769d8c3 Mon Sep 17 00:00:00 2001
From: Devang Patel <dpatel@apple.com>
Date: Wed, 20 Jan 2010 23:56:40 +0000
Subject: [PATCH]  A Decl->getName() is not unique. However, the debug info
 descriptors  are uniqued. The debug info descriptor describing record's
 context is necessary to keep two Decl's descriptor unique if their name
 match.

There is more work to do to create descriptors for DeclContext.
As a temp. step use type's name in FwdDecl.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94050 91177308-0d34-0410-b5e6-96231b3b80d8
---
 lib/CodeGen/CGDebugInfo.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index d9c1e00012..1ffad3edca 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -609,8 +609,15 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty,
   // its members.  Finally, we create a descriptor for the complete type (which
   // may refer to the forward decl if the struct is recursive) and replace all
   // uses of the forward declaration with the final definition.
+
+  // A Decl->getName() is not unique. However, the debug info descriptors 
+  // are uniqued. The debug info descriptor describing record's context is
+  // necessary to keep two Decl's descriptor unique if their name match.
+  // FIXME : Use RecordDecl's DeclContext's descriptor. As a temp. step
+  // use type's name in FwdDecl.
+  std::string STy = QualType(Ty, 0).getAsString();
   llvm::DICompositeType FwdDecl =
-    DebugFactory.CreateCompositeType(Tag, Unit, Decl->getName(),
+    DebugFactory.CreateCompositeType(Tag, Unit, STy.c_str(),
                                      DefUnit, Line, 0, 0, 0, 0,
                                      llvm::DIType(), llvm::DIArray());