diff options
author | Eric Christopher <echristo@apple.com> | 2012-02-08 01:53:14 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2012-02-08 01:53:14 +0000 |
commit | 9caf440928c16a8862de932fd19744dc8a6f4157 (patch) | |
tree | f0a4eb29d3746a3befcd52406931c941fc66764f /lib/CodeGen/CGDebugInfo.cpp | |
parent | 526cdfb2bf51c8c6612504f1d06c02c736d3d126 (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150040 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 13a0666ccd..1392091e66 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -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); } |