From: Devang Patel Date: Wed, 2 Feb 2011 22:36:18 +0000 (+0000) Subject: Emit debug info for template value parameters. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0ce34c6ba0aa79708a62179c0fdf96891b62b5dc;p=clang Emit debug info for template value parameters. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124756 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index c4a6d570f2..7a67192379 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -967,6 +967,13 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty) { llvm::DITemplateTypeParameter TTP = DBuilder.CreateTemplateTypeParameter(TheCU, TTy.getName(), TTy); TemplateParams.push_back(TTP); + } else if (TA.getKind() == TemplateArgument::Integral) { + llvm::DIType TTy = getOrCreateType(TA.getIntegralType(), Unit); + // FIXME: Get parameter name, instead of parameter type name. + llvm::DITemplateValueParameter TVP = + DBuilder.CreateTemplateValueParameter(TheCU, TTy.getName(), TTy, + TA.getAsIntegral()->getZExtValue()); + TemplateParams.push_back(TVP); } } } diff --git a/test/CodeGenCXX/debug-info-template.cpp b/test/CodeGenCXX/debug-info-template.cpp index 3fbfebf915..0ddfc242b1 100644 --- a/test/CodeGenCXX/debug-info-template.cpp +++ b/test/CodeGenCXX/debug-info-template.cpp @@ -11,3 +11,12 @@ public: }; TC tci; + +//CHECK: TU<2> +//CHECK: DW_TAG_template_value_parameter +template +class TU { + int b; +}; + +TU<2> u2;