diff options
Diffstat (limited to 'lldb/source')
-rw-r--r-- | lldb/source/Commands/CommandObjectImage.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Core/Value.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Expression/ClangExpressionDeclMap.cpp | 12 | ||||
-rw-r--r-- | lldb/source/Expression/ClangFunction.cpp | 15 | ||||
-rw-r--r-- | lldb/source/Expression/ClangUserExpression.cpp | 5 | ||||
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | 11 | ||||
-rw-r--r-- | lldb/source/Symbol/ClangASTContext.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Symbol/Function.cpp | 83 | ||||
-rw-r--r-- | lldb/source/Symbol/Type.cpp | 2 |
9 files changed, 43 insertions, 97 deletions
diff --git a/lldb/source/Commands/CommandObjectImage.cpp b/lldb/source/Commands/CommandObjectImage.cpp index 4843e4ff21a..6b4a89a9c33 100644 --- a/lldb/source/Commands/CommandObjectImage.cpp +++ b/lldb/source/Commands/CommandObjectImage.cpp @@ -442,7 +442,7 @@ LookupTypeInModule { // Resolve the clang type so that any forward references // to types that haven't yet been parsed will get parsed. - type_sp->GetClangType (); + type_sp->GetClangFullType (); type_sp->GetDescription (&strm, eDescriptionLevelFull, true); } strm.EOL(); diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp index 2dea4bc8384..723806ffd9d 100644 --- a/lldb/source/Core/Value.cpp +++ b/lldb/source/Core/Value.cpp @@ -409,7 +409,7 @@ Value::GetValueByteSize (clang::ASTContext *ast_context, Error *error_ptr) return byte_size; } -void * +clang_type_t Value::GetClangType () { if (m_context_type == eContextTypeValue) @@ -429,12 +429,12 @@ Value::GetClangType () case eContextTypeLLDBType: if (GetType()) - return GetType()->GetClangType(); + return GetType()->GetClangForwardType(); break; case eContextTypeVariable: if (GetVariable()) - return GetVariable()->GetType()->GetClangType(); + return GetVariable()->GetType()->GetClangForwardType(); break; } diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp index 6df0692666f..b21d3eb14ca 100644 --- a/lldb/source/Expression/ClangExpressionDeclMap.cpp +++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp @@ -1503,7 +1503,7 @@ ClangExpressionDeclMap::FindVariableInScope { if (type->GetASTContext() == var_sp->GetType()->GetClangAST()) { - if (!ClangASTContext::AreTypesSame(type->GetASTContext(), type->GetOpaqueQualType(), var_sp->GetType()->GetClangType())) + if (!ClangASTContext::AreTypesSame(type->GetASTContext(), type->GetOpaqueQualType(), var_sp->GetType()->GetClangFullType())) return NULL; } else @@ -1642,7 +1642,7 @@ ClangExpressionDeclMap::GetDecls (NameSearchContext &context, const ConstString log->PutCString (strm.GetData()); } - TypeFromUser this_user_type(this_type->GetClangType(), + TypeFromUser this_user_type(this_type->GetClangFullType(), this_type->GetClangAST()); m_struct_vars->m_object_pointer_type = this_user_type; @@ -1689,7 +1689,7 @@ ClangExpressionDeclMap::GetDecls (NameSearchContext &context, const ConstString if (!self_type) return; - TypeFromUser self_user_type(self_type->GetClangType(), + TypeFromUser self_user_type(self_type->GetClangFullType(), self_type->GetClangAST()); m_struct_vars->m_object_pointer_type = self_user_type; @@ -1747,7 +1747,7 @@ ClangExpressionDeclMap::GetDecls (NameSearchContext &context, const ConstString log->PutCString (strm.GetData()); } - TypeFromUser user_type (type_sp->GetClangType(), + TypeFromUser user_type (type_sp->GetClangFullType(), type_sp->GetClangAST()); AddOneType(context, user_type, false); @@ -1775,7 +1775,7 @@ ClangExpressionDeclMap::GetVariableValue return NULL; } - void *var_opaque_type = var_type->GetClangType(); + clang_type_t var_opaque_type = var_type->GetClangFullType(); if (!var_opaque_type) { @@ -2031,7 +2031,7 @@ ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context, return; } - fun_opaque_type = fun_type->GetClangType(); + fun_opaque_type = fun_type->GetClangFullType(); if (!fun_opaque_type) { diff --git a/lldb/source/Expression/ClangFunction.cpp b/lldb/source/Expression/ClangFunction.cpp index 9ccb4fb0197..53dbff4b548 100644 --- a/lldb/source/Expression/ClangFunction.cpp +++ b/lldb/source/Expression/ClangFunction.cpp @@ -103,7 +103,7 @@ ClangFunction::ClangFunction } m_function_addr = m_function_ptr->GetAddressRange().GetBaseAddress(); - m_function_return_qual_type = m_function_ptr->GetReturnType().GetClangType(); + m_function_return_qual_type = m_function_ptr->GetReturnClangType(); } //---------------------------------------------------------------------- @@ -163,12 +163,12 @@ ClangFunction::CompileFunction (Stream &errors) std::string args_list_buffer; // This one stores the argument list called from the structure. for (size_t i = 0; i < num_args; i++) { - const char *type_string; - std::string type_stdstr; + std::string type_name; if (trust_function) { - type_string = m_function_ptr->GetArgumentTypeAtIndex(i).GetName().AsCString(); + lldb::clang_type_t arg_clang_type = m_function_ptr->GetArgumentTypeAtIndex(i); + type_name = ClangASTContext::GetTypeName(arg_clang_type); } else { @@ -176,8 +176,7 @@ ClangFunction::CompileFunction (Stream &errors) void *clang_qual_type = arg_value->GetClangType (); if (clang_qual_type != NULL) { - type_stdstr = ClangASTContext::GetTypeName(clang_qual_type); - type_string = type_stdstr.c_str(); + type_name = ClangASTContext::GetTypeName(clang_qual_type); } else { @@ -186,13 +185,13 @@ ClangFunction::CompileFunction (Stream &errors) } } - m_wrapper_function_text.append (type_string); + m_wrapper_function_text.append (type_name); if (i < num_args - 1) m_wrapper_function_text.append (", "); char arg_buf[32]; args_buffer.append (" "); - args_buffer.append (type_string); + args_buffer.append (type_name); snprintf(arg_buf, 31, "arg_%zd", i); args_buffer.push_back (' '); args_buffer.append (arg_buf); diff --git a/lldb/source/Expression/ClangUserExpression.cpp b/lldb/source/Expression/ClangUserExpression.cpp index 5f9784e7e86..715677e5b19 100644 --- a/lldb/source/Expression/ClangUserExpression.cpp +++ b/lldb/source/Expression/ClangUserExpression.cpp @@ -84,13 +84,12 @@ ClangUserExpression::ScanContext(ExecutionContext &exe_ctx) lldb::clang_type_t pointer_target_type; - if (ClangASTContext::IsPointerType(this_type->GetClangType(), + if (ClangASTContext::IsPointerType(this_type->GetClangForwardType(), &pointer_target_type)) { TypeFromUser target_ast_type(pointer_target_type, this_type->GetClangAST()); - if (target_ast_type.IsDefined() && - ClangASTContext::IsCXXClassType(target_ast_type.GetOpaqueQualType())) + if (ClangASTContext::IsCXXClassType(target_ast_type.GetOpaqueQualType())) { m_cplusplus = true; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index c4705960fac..83dd42f12b7 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -670,7 +670,7 @@ SymbolFileDWARF::ParseCompileUnitFunction (const SymbolContext& sc, DWARFCompile { Type *class_type = ResolveType (dwarf_cu, parent_die); if (class_type) - class_type->GetClangType(); + class_type->GetClangFullType(); } break; @@ -1312,17 +1312,18 @@ SymbolFileDWARF::ParseChildMembers Type *base_class_type = ResolveTypeUID(encoding_uid); assert(base_class_type); + clang_type_t base_class_clang_type = base_class_type->GetClangFullType(); + assert (base_class_clang_type); if (class_language == eLanguageTypeObjC) { - GetClangASTContext().SetObjCSuperClass(class_clang_type, base_class_type->GetClangType()); + GetClangASTContext().SetObjCSuperClass(class_clang_type, base_class_clang_type); } else { - base_classes.push_back (GetClangASTContext().CreateBaseClassSpecifier (base_class_type->GetClangType(), + base_classes.push_back (GetClangASTContext().CreateBaseClassSpecifier (base_class_clang_type, accessibility, is_virtual, is_base_of_class)); - assert(base_classes.back()); } } } @@ -3723,7 +3724,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, element_orders.push_back (1); if (byte_stride == 0 && bit_stride == 0) byte_stride = element_type->GetByteSize(); - clang_type_t array_element_type = element_type->GetClangType(); + clang_type_t array_element_type = element_type->GetClangFullType(); uint64_t array_element_bit_stride = byte_stride * 8 + bit_stride; uint64_t num_elements = 0; std::vector<uint64_t>::const_reverse_iterator pos; diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index dcaedbe3e05..a25dae81d62 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -957,8 +957,8 @@ ClangASTContext::AreTypesSame(ASTContext *ast, clang_type_t type1, clang_type_t type2) { - return ast->hasSameType(QualType::getFromOpaquePtr(type1), - QualType::getFromOpaquePtr(type2)); + return ast->hasSameType (QualType::getFromOpaquePtr(type1), + QualType::getFromOpaquePtr(type2)); } #pragma mark CVR modifiers diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp index c2ad76b2f59..160d455a9c2 100644 --- a/lldb/source/Symbol/Function.cpp +++ b/lldb/source/Symbol/Function.cpp @@ -399,39 +399,20 @@ Function::GetType() const return m_type; } -Type -Function::GetReturnType () +clang_type_t +Function::GetReturnClangType () { - clang::QualType clang_type (clang::QualType::getFromOpaquePtr(GetType()->GetClangType())); - assert (clang_type->isFunctionType()); + clang::QualType clang_type (clang::QualType::getFromOpaquePtr(GetType()->GetClangFullType())); const clang::FunctionType *function_type = dyn_cast<clang::FunctionType> (clang_type); - clang::QualType fun_return_qualtype = function_type->getResultType(); - - const ConstString fun_return_name(ClangASTType::GetClangTypeName(fun_return_qualtype.getAsOpaquePtr())); - - SymbolContext sc; - CalculateSymbolContext (&sc); - // Null out everything below the CompUnit 'cause we don't actually know these. - - size_t bit_size = ClangASTType::GetClangTypeBitWidth (GetType()->GetClangASTContext().getASTContext(), - fun_return_qualtype.getAsOpaquePtr()); - Type return_type (0, - GetType()->GetSymbolFile(), - fun_return_name, - bit_size, - sc.comp_unit, - 0, - Type::eEncodingIsSyntheticUID, - Declaration(), - fun_return_qualtype.getAsOpaquePtr(), - Type::eResolveStateFull); - return return_type; + if (function_type) + return function_type->getResultType().getAsOpaquePtr(); + return NULL; } int Function::GetArgumentCount () { - clang::QualType clang_type (clang::QualType::getFromOpaquePtr(GetType()->GetClangType())); + clang::QualType clang_type (clang::QualType::getFromOpaquePtr(GetType()->GetClangFullType())); assert (clang_type->isFunctionType()); if (!clang_type->isFunctionProtoType()) return -1; @@ -443,67 +424,33 @@ Function::GetArgumentCount () return 0; } -const Type +clang_type_t Function::GetArgumentTypeAtIndex (size_t idx) { - clang::QualType clang_type (clang::QualType::getFromOpaquePtr(GetType()->GetClangType())); - assert (clang_type->isFunctionType()); - if (!clang_type->isFunctionProtoType()) - return Type(); - + clang::QualType clang_type (clang::QualType::getFromOpaquePtr(GetType()->GetClangFullType())); const clang::FunctionProtoType *function_proto_type = dyn_cast<clang::FunctionProtoType>(clang_type); - if (function_proto_type != NULL) + if (function_proto_type) { unsigned num_args = function_proto_type->getNumArgs(); if (idx >= num_args) - return Type(); - clang::QualType arg_qualtype = (function_proto_type->arg_type_begin())[idx]; - - const ConstString arg_return_name(ClangASTType::GetClangTypeName(arg_qualtype.getAsOpaquePtr())); - SymbolContext sc; - CalculateSymbolContext (&sc); - // Null out everything below the CompUnit 'cause we don't actually know these. - - size_t bit_size = ClangASTType::GetClangTypeBitWidth ((GetType()->GetClangASTContext().getASTContext()), arg_qualtype.getAsOpaquePtr()); - Type arg_type (0, - GetType()->GetSymbolFile(), - arg_return_name, - bit_size, - sc.comp_unit, - 0, - Type::eEncodingIsSyntheticUID, - Declaration(), - arg_qualtype.getAsOpaquePtr(), - Type::eResolveStateFull); - return arg_type; + return NULL; + + return (function_proto_type->arg_type_begin())[idx].getAsOpaquePtr(); } - - return Type(); -} - -const char * -Function::GetArgumentNameAtIndex (size_t idx) -{ - const clang::Type *clang_type = static_cast<clang::QualType *>(GetType()->GetClangType())->getTypePtr(); - assert (clang_type->isFunctionType()); - if (!clang_type->isFunctionProtoType()) - return NULL; return NULL; } bool Function::IsVariadic () { - const clang::Type *clang_type = static_cast<clang::QualType *>(GetType()->GetClangType())->getTypePtr(); + const clang::Type *clang_type = static_cast<clang::QualType *>(GetType()->GetClangFullType())->getTypePtr(); assert (clang_type->isFunctionType()); if (!clang_type->isFunctionProtoType()) return false; const clang::FunctionProtoType *function_proto_type = dyn_cast<clang::FunctionProtoType>(clang_type); - if (function_proto_type != NULL) - { + if (function_proto_type) return function_proto_type->isVariadic(); - } return false; } diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp index c0cd8ede333..1ac429d0281 100644 --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -578,7 +578,7 @@ Type::GetEncodingMask () } clang_type_t -Type::GetClangType () +Type::GetClangFullType () { ResolveClangType(eResolveStateFull); return m_clang_type; |