<rdar://problem/13298695>
Fixed LLDB to be able to correctly parse template parameters that have no name and no type. This can be triggered by the following LLVM/Clang code:
template <typename T, typename = void>
class SmallVectorTemplateCommon : public SmallVectorBase {
The “typename = void” was emitting DWARF with an empty DW_AT_name and no DW_AT_type. We now correctly infer that no DW_AT_type means “void” and that an empty name is ok.
This means you can now call functions on things that inherit from SmallVectorTemplateCommon.
llvm-svn: 180155
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 3583779..6bb8fd17 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1273,15 +1273,26 @@
}
}
- if (name && lldb_type && clang_type)
+ clang::ASTContext *ast = GetClangASTContext().getASTContext();
+ if (!clang_type)
+ clang_type = ast->VoidTy.getAsOpaquePtr();
+
+ if (clang_type)
{
bool is_signed = false;
- template_param_infos.names.push_back(name);
+ if (name && name[0])
+ template_param_infos.names.push_back(name);
+ else
+ template_param_infos.names.push_back(NULL);
+
clang::QualType clang_qual_type (clang::QualType::getFromOpaquePtr (clang_type));
- if (tag == DW_TAG_template_value_parameter && ClangASTContext::IsIntegerType (clang_type, is_signed) && uval64_valid)
+ if (tag == DW_TAG_template_value_parameter &&
+ lldb_type != NULL &&
+ ClangASTContext::IsIntegerType (clang_type, is_signed) &&
+ uval64_valid)
{
llvm::APInt apint (lldb_type->GetByteSize() * 8, uval64, is_signed);
- template_param_infos.args.push_back (clang::TemplateArgument (*GetClangASTContext().getASTContext(),
+ template_param_infos.args.push_back (clang::TemplateArgument (*ast,
llvm::APSInt(apint),
clang_qual_type));
}