aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-02-02 21:38:49 +0000
committerDevang Patel <dpatel@apple.com>2011-02-02 21:38:49 +0000
commitfa275dfad7c4eb053ffef423a863afbe15534476 (patch)
treee9e538dc1794cd5b8e6fa4ed3b905573468c38e9 /lib/CodeGen/CGDebugInfo.cpp
parent322c29fefe7fa33f03273136eb5f8b7f5b4df7c0 (diff)
Emit debug info for template type parameters.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124753 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index a98c32a8d0..c4a6d570f2 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -953,9 +953,23 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty) {
}
CollectRecordFields(RD, Unit, EltTys);
+ llvm::SmallVector<llvm::Value *, 16> TemplateParams;
if (CXXDecl) {
CollectCXXMemberFunctions(CXXDecl, Unit, EltTys, FwdDecl);
CollectCXXFriends(CXXDecl, Unit, EltTys, FwdDecl);
+ if (ClassTemplateSpecializationDecl *TSpecial
+ = dyn_cast<ClassTemplateSpecializationDecl>(RD)) {
+ const TemplateArgumentList &TAL = TSpecial->getTemplateArgs();
+ for (unsigned i = 0, e = TAL.size(); i != e; ++i) {
+ const TemplateArgument &TA = TAL[i];
+ if (TA.getKind() == TemplateArgument::Type) {
+ llvm::DIType TTy = getOrCreateType(TA.getAsType(), Unit);
+ llvm::DITemplateTypeParameter TTP =
+ DBuilder.CreateTemplateTypeParameter(TheCU, TTy.getName(), TTy);
+ TemplateParams.push_back(TTP);
+ }
+ }
+ }
}
RegionStack.pop_back();
@@ -1000,9 +1014,12 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty) {
}
else if (CXXDecl->isDynamicClass())
ContainingType = FwdDecl;
+ llvm::DIArray TParamsArray =
+ DBuilder.GetOrCreateArray(TemplateParams.data(), TemplateParams.size());
RealDecl = DBuilder.CreateClassType(RDContext, RDName, DefUnit, Line,
Size, Align, 0, 0, llvm::DIType(),
- Elements, ContainingType);
+ Elements, ContainingType,
+ TParamsArray);
}
// Now that we have a real decl for the struct, replace anything using the