diff options
5 files changed, 14 insertions, 9 deletions
diff --git a/lldb/include/lldb/Symbol/ClangASTContext.h b/lldb/include/lldb/Symbol/ClangASTContext.h index 2261914818d..5a68f5e077c 100644 --- a/lldb/include/lldb/Symbol/ClangASTContext.h +++ b/lldb/include/lldb/Symbol/ClangASTContext.h @@ -397,7 +397,8 @@ public: CompilerType CreateEnumerationType(const char *name, clang::DeclContext *decl_ctx, const Declaration &decl, - const CompilerType &integer_qual_type); + const CompilerType &integer_qual_type, + bool is_scoped); //------------------------------------------------------------------ // Integer type functions diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py index e8d3284f609..82e44fb1759 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py @@ -99,8 +99,8 @@ class CPP11EnumTypesTestCase(TestBase): # Look up information about the 'DayType' enum type. # Check for correct display. self.expect("image lookup -t DayType", DATA_TYPES_DISPLAYED_CORRECTLY, - substrs=['enum DayType {', - 'Monday', + patterns=['enum( struct| class) DayType {'], + substrs=['Monday', 'Tuesday', 'Wednesday', 'Thursday', diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index 482f0e58c39..cf344b0f563 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -927,6 +927,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, // Set a bit that lets us know that we are currently parsing this dwarf->GetDIEToType()[die.GetDIE()] = DIE_IS_BEING_PARSED; + bool is_scoped = false; DWARFFormValue encoding_form; const size_t num_attributes = die.GetAttributes(attributes); @@ -963,6 +964,9 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, case DW_AT_declaration: is_forward_declaration = form_value.Boolean(); break; + case DW_AT_enum_class: + is_scoped = form_value.Boolean(); + break; case DW_AT_allocated: case DW_AT_associated: case DW_AT_bit_stride: @@ -1052,7 +1056,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, clang_type = m_ast.CreateEnumerationType( type_name_cstr, GetClangDeclContextContainingDIE(die, nullptr), - decl, enumerator_clang_type); + decl, enumerator_clang_type, is_scoped); } else { enumerator_clang_type = m_ast.GetEnumerationIntegerType(clang_type.GetOpaqueQualType()); diff --git a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp index 852aa7277bf..9b98ebe112a 100644 --- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp +++ b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp @@ -109,7 +109,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) { m_ast.GetBuiltinTypeForEncodingAndBitSize(encoding, bytes * 8); CompilerType ast_enum = m_ast.CreateEnumerationType( - name.c_str(), tu_decl_ctx, decl, builtin_type); + name.c_str(), tu_decl_ctx, decl, builtin_type, false); auto enum_values = enum_type->findAllChildren<PDBSymbolData>(); while (auto enum_value = enum_values->getNext()) { if (enum_value->getDataKind() != PDB_DataKind::Constant) diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index 86f1055f93b..0f5e6f25df7 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -2169,20 +2169,20 @@ CompilerType ClangASTContext::GetOrCreateStructForIdentifier( CompilerType ClangASTContext::CreateEnumerationType(const char *name, DeclContext *decl_ctx, const Declaration &decl, - const CompilerType &integer_clang_type) { + const CompilerType &integer_clang_type, + bool is_scoped) { // TODO: Do something intelligent with the Declaration object passed in // like maybe filling in the SourceLocation with it... ASTContext *ast = getASTContext(); // TODO: ask about these... - // const bool IsScoped = false; // const bool IsFixed = false; EnumDecl *enum_decl = EnumDecl::Create( *ast, decl_ctx, SourceLocation(), SourceLocation(), name && name[0] ? &ast->Idents.get(name) : nullptr, nullptr, - false, // IsScoped - false, // IsScopedUsingClassTag + is_scoped, + true, // IsScopedUsingClassTag false); // IsFixed if (enum_decl) { |