]> granicus.if.org Git - clang/commitdiff
Constify the getClassName routine and variables that come out of it,
authorEric Christopher <echristo@apple.com>
Wed, 8 Feb 2012 01:53:14 +0000 (01:53 +0000)
committerEric Christopher <echristo@apple.com>
Wed, 8 Feb 2012 01:53:14 +0000 (01:53 +0000)
and then use it for forward decl names.

Part of rdar://10209967 and rdar://10400981

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

lib/CodeGen/CGDebugInfo.cpp
lib/CodeGen/CGDebugInfo.h

index 13a0666ccdd398710540fc1ecb6a1444c162dee8..1392091e66e1719ef4d760a444c4c45e79a04697 100644 (file)
@@ -163,8 +163,8 @@ StringRef CGDebugInfo::getSelectorName(Selector S) {
 
 /// getClassName - Get class name including template argument list.
 StringRef 
-CGDebugInfo::getClassName(RecordDecl *RD) {
-  ClassTemplateSpecializationDecl *Spec
+CGDebugInfo::getClassName(const RecordDecl *RD) {
+  const ClassTemplateSpecializationDecl *Spec
     = dyn_cast<ClassTemplateSpecializationDecl>(RD);
   if (!Spec)
     return RD->getName();
@@ -486,12 +486,15 @@ llvm::DIType CGDebugInfo::createRecordFwdDecl(const RecordDecl *RD,
 
   llvm::DIFile DefUnit = getOrCreateFile(RD->getLocation());
   unsigned Line = getLineNumber(RD->getLocation());
+  StringRef RDName = RD->getName();
 
   // Get the tag.
   const CXXRecordDecl *CXXDecl = dyn_cast<CXXRecordDecl>(RD);
   unsigned Tag = 0;
-  if (CXXDecl)
+  if (CXXDecl) {
+    RDName = getClassName(RD);
     Tag = llvm::dwarf::DW_TAG_class_type;
+  }
   else if (RD->isStruct())
     Tag = llvm::dwarf::DW_TAG_structure_type;
   else if (RD->isUnion())
@@ -500,7 +503,7 @@ llvm::DIType CGDebugInfo::createRecordFwdDecl(const RecordDecl *RD,
     llvm_unreachable("Unknown RecordDecl type!");
 
   // Create the type.
-  return DBuilder.createForwardDecl(Tag, RD->getName(), DefUnit,
+  return DBuilder.createForwardDecl(Tag, RDName, DefUnit,
                                     Line);
 }
 
index c2a28fd8e3c1318f9b70dd0c850f94bb23074110..c00c469097235fcebec3dfa72e55c230058f3d14 100644 (file)
@@ -293,7 +293,7 @@ private:
   StringRef getSelectorName(Selector S);
 
   /// getClassName - Get class name including template argument list.
-  StringRef getClassName(RecordDecl *RD);
+  StringRef getClassName(const RecordDecl *RD);
 
   /// getVTableName - Get vtable name for the given Class.
   StringRef getVTableName(const CXXRecordDecl *Decl);