summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2012-02-08 01:53:14 +0000
committerEric Christopher <echristo@apple.com>2012-02-08 01:53:14 +0000
commitb2db8e47e2a9cbd7fea6acc2794c42a8fc1182be (patch)
treec342000caf5beaa7e36704df5b409e2123e0da9e /clang/lib/CodeGen
parent3434b19d63328364fd43ec5ae284c2c75f77e512 (diff)
downloadbcm5719-llvm-b2db8e47e2a9cbd7fea6acc2794c42a8fc1182be.tar.gz
bcm5719-llvm-b2db8e47e2a9cbd7fea6acc2794c42a8fc1182be.zip
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 llvm-svn: 150040
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp11
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.h2
2 files changed, 8 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 13a0666ccdd..1392091e66e 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/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);
}
diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h
index c2a28fd8e3c..c00c4690972 100644
--- a/clang/lib/CodeGen/CGDebugInfo.h
+++ b/clang/lib/CodeGen/CGDebugInfo.h
@@ -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);
OpenPOWER on IntegriCloud