CompilerType: Add ability to retrieve an integral template argument
Summary:
Despite it's name, GetTemplateArgument was only really working for Type
template arguments. This adds the ability to retrieve integral arguments
as well (which I've needed for the std::bitset data formatter).
I've done this by splitting the function into three pieces. The idea is
that one first calls GetTemplateArgumentKind (first function) to
determine the what kind of a parameter this is. Based on that, one can
then use specialized functions to retrieve the correct value. Currently,
I only implement two of these: GetTypeTemplateArgument and
GetIntegralTemplateArgument.
Reviewers: jingham, clayborg
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D39844
llvm-svn: 318040
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
index e3018a1..3e2b715 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
@@ -117,11 +117,8 @@
CompilerType my_type(valobj_sp->GetCompilerType());
if (my_type.GetNumTemplateArguments() >= 1) {
- TemplateArgumentKind kind;
- CompilerType pair_type = my_type.GetTemplateArgument(0, kind);
- if (kind != eTemplateArgumentKindType &&
- kind != eTemplateArgumentKindTemplate &&
- kind != eTemplateArgumentKindTemplateExpansion)
+ CompilerType pair_type = my_type.GetTypeTemplateArgument(0);
+ if (!pair_type)
return false;
m_pair_type = pair_type;
} else