diff options
author | Greg Clayton <gclayton@apple.com> | 2016-06-24 23:48:00 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2016-06-24 23:48:00 +0000 |
commit | d7f71add86c892ced324fc26cb0945911f3e26a5 (patch) | |
tree | 9ed27eb7686df44798786a1e5b80a0d9ec5c2e7f /lldb/source/Plugins/SymbolFile/DWARF | |
parent | 4d32eb6939d77f8059683c008bb807167110e930 (diff) | |
download | bcm5719-llvm-d7f71add86c892ced324fc26cb0945911f3e26a5.tar.gz bcm5719-llvm-d7f71add86c892ced324fc26cb0945911f3e26a5.zip |
Made templates that have Enumeration values as arguments work correctly.
We were checking for integer types only before this. So I added the ability for CompilerType objects to check for integer and enum types.
Then I searched for places that were using the CompilerType::IsIntegerType(...) function. Many of these places also wanted to be checking for enumeration types as well, so I have fixed those places. These are in the ABI plug-ins where we are figuring out which arguments would go in where in regisers/stack when making a function call, or determining where the return value would live. The real fix for this is to use clang to compiler a CGFunctionInfo and then modify the code to be able to take the IR and a calling convention and have the backend answer the questions correctly for us so we don't need to create a really bad copy of the ABI in each plug-in, but that is beyond the scope of this bug fix.
Also added a test case to ensure this doesn't regress in the future.
llvm-svn: 273750
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF')
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index 1a7af84803e..c2f53fbb709 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -1995,8 +1995,7 @@ DWARFASTParserClang::ParseTemplateDIE (const DWARFDIE &die, { DWARFAttributes attributes; const size_t num_attributes = die.GetAttributes (attributes); - const char *name = NULL; - Type *lldb_type = NULL; + const char *name = nullptr; CompilerType clang_type; uint64_t uval64 = 0; bool uval64_valid = false; @@ -2017,7 +2016,7 @@ DWARFASTParserClang::ParseTemplateDIE (const DWARFDIE &die, case DW_AT_type: if (attributes.ExtractFormValueAtIndex(i, form_value)) { - lldb_type = die.ResolveTypeUID(DIERef(form_value)); + Type *lldb_type = die.ResolveTypeUID(DIERef(form_value)); if (lldb_type) clang_type = lldb_type->GetForwardCompilerType (); } @@ -2047,12 +2046,12 @@ DWARFASTParserClang::ParseTemplateDIE (const DWARFDIE &die, else template_param_infos.names.push_back(NULL); - if (tag == DW_TAG_template_value_parameter && - lldb_type != NULL && - clang_type.IsIntegerType (is_signed) && - uval64_valid) + // Get the signed value for any integer or enumeration if available + clang_type.IsIntegerOrEnumerationType (is_signed); + + if (tag == DW_TAG_template_value_parameter && uval64_valid) { - llvm::APInt apint (lldb_type->GetByteSize() * 8, uval64, is_signed); + llvm::APInt apint (clang_type.GetBitSize(nullptr), uval64, is_signed); template_param_infos.args.push_back( clang::TemplateArgument(*ast, llvm::APSInt(apint, !is_signed), ClangUtil::GetQualType(clang_type))); } |