[cfe-commits] r150040 - in /cfe/trunk/lib/CodeGen: CGDebugInfo.cpp CGDebugInfo.h

Eric Christopher echristo at apple.com
Tue Feb 7 17:53:15 PST 2012


Author: echristo
Date: Tue Feb  7 19:53:14 2012
New Revision: 150040

URL: http://llvm.org/viewvc/llvm-project?rev=150040&view=rev
Log:
Constify the getClassName routine and variables that come out of it,
and then use it for forward decl names.

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

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
    cfe/trunk/lib/CodeGen/CGDebugInfo.h

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=150040&r1=150039&r2=150040&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Feb  7 19:53:14 2012
@@ -163,8 +163,8 @@
 
 /// 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::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_unreachable("Unknown RecordDecl type!");
 
   // Create the type.
-  return DBuilder.createForwardDecl(Tag, RD->getName(), DefUnit,
+  return DBuilder.createForwardDecl(Tag, RDName, DefUnit,
                                     Line);
 }
 

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=150040&r1=150039&r2=150040&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Tue Feb  7 19:53:14 2012
@@ -293,7 +293,7 @@
   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);





More information about the cfe-commits mailing list