summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-11-13 03:52:47 +0000
committerGreg Clayton <gclayton@apple.com>2010-11-13 03:52:47 +0000
commit526e5afb2d616f483d44aa393473e93d962af6a0 (patch)
tree556d76a66a0884e230910c37925ce20fe8b04aff /lldb/source
parentf01b622902269c7fc01fbd9b26393eabdfb82076 (diff)
downloadbcm5719-llvm-526e5afb2d616f483d44aa393473e93d962af6a0.tar.gz
bcm5719-llvm-526e5afb2d616f483d44aa393473e93d962af6a0.zip
Modified the lldb_private::Type clang type resolving code to handle three
cases when getting the clang type: - need only a forward declaration - need a clang type that can be used for layout (members and args/return types) - need a full clang type This allows us to partially parse the clang types and be as lazy as possible. The first case is when we just need to declare a type and we will complete it later. The forward declaration happens only for class/union/structs and enums. The layout type allows us to resolve the full clang type _except_ if we have any modifiers on a pointer or reference (both R and L value). In this case when we are adding members or function args or return types, we only need to know how the type will be laid out and we can defer completing the pointee type until we later need it. The last type means we need a full definition for the clang type. Did some renaming of some enumerations to get rid of the old "DC" prefix (which stands for DebugCore which is no longer around). Modified the clang namespace support to be almost ready to be fed to the expression parser. I made a new ClangNamespaceDecl class that can carry around the AST and the namespace decl so we can copy it into the expression AST. I modified the symbol vendor and symbol file plug-ins to use this new class. llvm-svn: 118976
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/Commands/CommandObjectArgs.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectCall.cpp2
-rw-r--r--lldb/source/Core/Value.cpp48
-rw-r--r--lldb/source/Core/ValueObject.cpp10
-rw-r--r--lldb/source/Core/ValueObjectChild.cpp2
-rw-r--r--lldb/source/Core/ValueObjectConstResult.cpp2
-rw-r--r--lldb/source/Core/ValueObjectRegister.cpp2
-rw-r--r--lldb/source/Core/ValueObjectVariable.cpp4
-rw-r--r--lldb/source/Expression/ClangExpressionDeclMap.cpp30
-rw-r--r--lldb/source/Expression/ClangExpressionVariable.cpp2
-rw-r--r--lldb/source/Expression/ClangFunction.cpp4
-rw-r--r--lldb/source/Expression/DWARFExpression.cpp16
-rw-r--r--lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp6
-rw-r--r--lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp4
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp4
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp16
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp147
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h2
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp4
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h2
-rw-r--r--lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp4
-rw-r--r--lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h2
-rw-r--r--lldb/source/Symbol/ClangASTContext.cpp17
-rw-r--r--lldb/source/Symbol/ClangNamespaceDecl.cpp11
-rw-r--r--lldb/source/Symbol/Function.cpp25
-rw-r--r--lldb/source/Symbol/SymbolContext.cpp20
-rw-r--r--lldb/source/Symbol/SymbolVendor.cpp26
-rw-r--r--lldb/source/Symbol/Type.cpp158
-rw-r--r--lldb/source/Target/ThreadPlanTracer.cpp2
29 files changed, 306 insertions, 268 deletions
diff --git a/lldb/source/Commands/CommandObjectArgs.cpp b/lldb/source/Commands/CommandObjectArgs.cpp
index fd57df649af..896a058a1c0 100644
--- a/lldb/source/Commands/CommandObjectArgs.cpp
+++ b/lldb/source/Commands/CommandObjectArgs.cpp
@@ -249,7 +249,7 @@ CommandObjectArgs::Execute
return false;
}
- value.SetContext (Value::eContextTypeOpaqueClangQualType, type);
+ value.SetContext (Value::eContextTypeClangType, type);
value_list.PushValue(value);
}
diff --git a/lldb/source/Commands/CommandObjectCall.cpp b/lldb/source/Commands/CommandObjectCall.cpp
index 26746687d9d..9a1a7977d78 100644
--- a/lldb/source/Commands/CommandObjectCall.cpp
+++ b/lldb/source/Commands/CommandObjectCall.cpp
@@ -257,7 +257,7 @@ CommandObjectCall::Execute
void *cstr_type = exe_ctx.target->GetScratchClangASTContext()->GetCStringType(true);
- val.SetContext (Value::eContextTypeOpaqueClangQualType, cstr_type);
+ val.SetContext (Value::eContextTypeClangType, cstr_type);
value_list.PushValue(val);
success = true;
diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp
index 76f109744ff..920c467333e 100644
--- a/lldb/source/Core/Value.cpp
+++ b/lldb/source/Core/Value.cpp
@@ -287,7 +287,7 @@ Value::GetRegisterInfo()
if (m_context_type == eContextTypeValue)
return ((Value*)m_context)->GetRegisterInfo();
- if (m_context_type == eContextTypeDCRegisterInfo)
+ if (m_context_type == eContextTypeRegisterInfo)
return static_cast<RegisterInfo *> (m_context);
return NULL;
}
@@ -298,7 +298,7 @@ Value::GetType()
if (m_context_type == eContextTypeValue)
return ((Value*)m_context)->GetType();
- if (m_context_type == eContextTypeDCType)
+ if (m_context_type == eContextTypeLLDBType)
return static_cast<Type *> (m_context);
return NULL;
}
@@ -336,12 +336,12 @@ Value::ValueOf(ExecutionContext *exe_ctx, clang::ASTContext *ast_context)
{
default:
case eContextTypeInvalid:
- case eContextTypeOpaqueClangQualType: // clang::Type *
- case eContextTypeDCRegisterInfo: // RegisterInfo *
- case eContextTypeDCType: // Type *
+ case eContextTypeClangType: // clang::Type *
+ case eContextTypeRegisterInfo: // RegisterInfo *
+ case eContextTypeLLDBType: // Type *
break;
- case eContextTypeDCVariable: // Variable *
+ case eContextTypeVariable: // Variable *
ResolveValue(exe_ctx, ast_context);
return true;
}
@@ -365,7 +365,7 @@ Value::GetValueByteSize (clang::ASTContext *ast_context, Error *error_ptr)
error_ptr->SetErrorString ("Invalid context type, there is no way to know how much memory to read.");
break;
- case eContextTypeOpaqueClangQualType:
+ case eContextTypeClangType:
if (ast_context == NULL)
{
if (error_ptr)
@@ -378,7 +378,7 @@ Value::GetValueByteSize (clang::ASTContext *ast_context, Error *error_ptr)
}
break;
- case eContextTypeDCRegisterInfo: // RegisterInfo *
+ case eContextTypeRegisterInfo: // RegisterInfo *
if (GetRegisterInfo())
byte_size = GetRegisterInfo()->byte_size;
else if (error_ptr)
@@ -386,14 +386,14 @@ Value::GetValueByteSize (clang::ASTContext *ast_context, Error *error_ptr)
break;
- case eContextTypeDCType: // Type *
+ case eContextTypeLLDBType: // Type *
if (GetType())
byte_size = GetType()->GetByteSize();
else if (error_ptr)
error_ptr->SetErrorString ("Can't determine byte size with NULL Type *.");
break;
- case eContextTypeDCVariable: // Variable *
+ case eContextTypeVariable: // Variable *
if (GetVariable())
byte_size = GetVariable()->GetType()->GetByteSize();
else if (error_ptr)
@@ -428,18 +428,18 @@ Value::GetClangType ()
case eContextTypeInvalid:
break;
- case eContextTypeOpaqueClangQualType:
+ case eContextTypeClangType:
return m_context;
- case eContextTypeDCRegisterInfo:
+ case eContextTypeRegisterInfo:
break; // TODO: Eventually convert into a clang type?
- case eContextTypeDCType:
+ case eContextTypeLLDBType:
if (GetType())
return GetType()->GetClangType();
break;
- case eContextTypeDCVariable:
+ case eContextTypeVariable:
if (GetVariable())
return GetVariable()->GetType()->GetClangType();
break;
@@ -460,20 +460,20 @@ Value::GetValueDefaultFormat ()
case eContextTypeInvalid:
break;
- case eContextTypeOpaqueClangQualType:
+ case eContextTypeClangType:
return ClangASTType::GetFormat (m_context);
- case eContextTypeDCRegisterInfo:
+ case eContextTypeRegisterInfo:
if (GetRegisterInfo())
return GetRegisterInfo()->format;
break;
- case eContextTypeDCType:
+ case eContextTypeLLDBType:
if (GetType())
return GetType()->GetFormat();
break;
- case eContextTypeDCVariable:
+ case eContextTypeVariable:
if (GetVariable())
return GetVariable()->GetType()->GetFormat();
break;
@@ -669,7 +669,7 @@ Value::ResolveValue(ExecutionContext *exe_ctx, clang::ASTContext *ast_context)
}
}
- if (m_context_type == eContextTypeOpaqueClangQualType)
+ if (m_context_type == eContextTypeClangType)
{
void *opaque_clang_qual_type = GetClangType();
switch (m_value_type)
@@ -731,7 +731,7 @@ Value::GetVariable()
if (m_context_type == eContextTypeValue)
return ((Value*)m_context)->GetVariable();
- if (m_context_type == eContextTypeDCVariable)
+ if (m_context_type == eContextTypeVariable)
return static_cast<Variable *> (m_context);
return NULL;
}
@@ -757,10 +757,10 @@ Value::GetContextTypeAsCString (ContextType context_type)
switch (context_type)
{
case eContextTypeInvalid: return "invalid";
- case eContextTypeOpaqueClangQualType: return "clang::Type *";
- case eContextTypeDCRegisterInfo: return "RegisterInfo *";
- case eContextTypeDCType: return "Type *";
- case eContextTypeDCVariable: return "Variable *";
+ case eContextTypeClangType: return "clang::Type *";
+ case eContextTypeRegisterInfo: return "RegisterInfo *";
+ case eContextTypeLLDBType: return "Type *";
+ case eContextTypeVariable: return "Variable *";
case eContextTypeValue: return "Value"; // TODO: Sean, more description here?
};
return "???";
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index a3da90d9c3a..64c646ba567 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -179,7 +179,7 @@ ValueObject::GetLocationAsCString (ExecutionContextScope *exe_scope)
break;
case Value::eValueTypeScalar:
- if (m_value.GetContextType() == Value::eContextTypeDCRegisterInfo)
+ if (m_value.GetContextType() == Value::eContextTypeRegisterInfo)
{
RegisterInfo *reg_info = m_value.GetRegisterInfo();
if (reg_info)
@@ -611,9 +611,9 @@ ValueObject::GetValueAsCString (ExecutionContextScope *exe_scope)
switch (context_type)
{
- case Value::eContextTypeOpaqueClangQualType:
- case Value::eContextTypeDCType:
- case Value::eContextTypeDCVariable:
+ case Value::eContextTypeClangType:
+ case Value::eContextTypeLLDBType:
+ case Value::eContextTypeVariable:
{
clang_type_t clang_type = GetClangType ();
if (clang_type)
@@ -638,7 +638,7 @@ ValueObject::GetValueAsCString (ExecutionContextScope *exe_scope)
}
break;
- case Value::eContextTypeDCRegisterInfo:
+ case Value::eContextTypeRegisterInfo:
{
const RegisterInfo *reg_info = m_value.GetRegisterInfo();
if (reg_info)
diff --git a/lldb/source/Core/ValueObjectChild.cpp b/lldb/source/Core/ValueObjectChild.cpp
index ec935845614..2e1937228af 100644
--- a/lldb/source/Core/ValueObjectChild.cpp
+++ b/lldb/source/Core/ValueObjectChild.cpp
@@ -135,7 +135,7 @@ ValueObjectChild::UpdateValue (ExecutionContextScope *exe_scope)
{
if (parent->UpdateValueIfNeeded(exe_scope))
{
- m_value.SetContext(Value::eContextTypeOpaqueClangQualType, m_clang_type);
+ m_value.SetContext(Value::eContextTypeClangType, m_clang_type);
// Copy the parent scalar value and the scalar value type
m_value.GetScalar() = parent->GetValue().GetScalar();
diff --git a/lldb/source/Core/ValueObjectConstResult.cpp b/lldb/source/Core/ValueObjectConstResult.cpp
index 93e2d3eb05a..ef7c7b9e3b1 100644
--- a/lldb/source/Core/ValueObjectConstResult.cpp
+++ b/lldb/source/Core/ValueObjectConstResult.cpp
@@ -44,7 +44,7 @@ ValueObjectConstResult::ValueObjectConstResult
m_data.SetData(data_sp);
m_value.GetScalar() = (uintptr_t)data_sp->GetBytes();
m_value.SetValueType(Value::eValueTypeHostAddress);
- m_value.SetContext(Value::eContextTypeOpaqueClangQualType, clang_type);
+ m_value.SetContext(Value::eContextTypeClangType, clang_type);
m_name = name;
SetIsConstant ();
SetValueIsValid(true);
diff --git a/lldb/source/Core/ValueObjectRegister.cpp b/lldb/source/Core/ValueObjectRegister.cpp
index 7f3603f032a..dabf838bea7 100644
--- a/lldb/source/Core/ValueObjectRegister.cpp
+++ b/lldb/source/Core/ValueObjectRegister.cpp
@@ -319,7 +319,7 @@ ValueObjectRegister::UpdateValue (ExecutionContextScope *exe_scope)
{
if (m_reg_ctx->ReadRegisterBytes (m_reg_num, m_data))
{
- m_value.SetContext(Value::eContextTypeDCRegisterInfo, (void *)m_reg_info);
+ m_value.SetContext(Value::eContextTypeRegisterInfo, (void *)m_reg_info);
m_value.SetValueType(Value::eValueTypeHostAddress);
m_value.GetScalar() = (uintptr_t)m_data.GetDataStart();
SetValueIsValid (true);
diff --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp
index 104aa1f0e21..4f8bfe248fd 100644
--- a/lldb/source/Core/ValueObjectVariable.cpp
+++ b/lldb/source/Core/ValueObjectVariable.cpp
@@ -120,7 +120,7 @@ ValueObjectVariable::UpdateValue (ExecutionContextScope *exe_scope)
Value old_value(m_value);
if (expr.Evaluate (&exe_ctx, GetClangAST(), loclist_base_load_addr, NULL, m_value, &m_error))
{
- m_value.SetContext(Value::eContextTypeDCVariable, variable);
+ m_value.SetContext(Value::eContextTypeVariable, variable);
Value::ValueType value_type = m_value.GetValueType();
@@ -184,7 +184,7 @@ ValueObjectVariable::UpdateValue (ExecutionContextScope *exe_scope)
// Copy the Value and set the context to use our Variable
// so it can extract read its value into m_data appropriately
Value value(m_value);
- value.SetContext(Value::eContextTypeDCVariable, variable);
+ value.SetContext(Value::eContextTypeVariable, variable);
m_error = value.GetValueAsData(&exe_ctx, GetClangAST(), m_data, 0);
}
break;
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp
index aa7d458badb..92b1ebb0cd0 100644
--- a/lldb/source/Expression/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp
@@ -23,6 +23,7 @@
#include "lldb/Expression/ClangASTSource.h"
#include "lldb/Expression/ClangPersistentVariables.h"
#include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/ClangNamespaceDecl.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/ObjectFile.h"
@@ -760,7 +761,7 @@ ClangExpressionDeclMap::DoMaterializeOneVariable
break;
case Value::eValueTypeScalar:
{
- if (location_value->GetContextType() != Value::eContextTypeDCRegisterInfo)
+ if (location_value->GetContextType() != Value::eContextTypeRegisterInfo)
{
StreamString ss;
@@ -1019,6 +1020,18 @@ ClangExpressionDeclMap::GetDecls (NameSearchContext &context, const ConstString
else if (non_extern_symbol)
AddOneFunction(context, NULL, non_extern_symbol);
}
+
+ ClangNamespaceDecl namespace_decl (m_sym_ctx.FindNamespace(name));
+ if (namespace_decl)
+ {
+// clang::NamespaceDecl *clang_namespace_decl = AddNamespace(context, namespace_decl);
+// if (clang_namespace_decl)
+// {
+// // TODO: is this how we get the decl lookups to be called for
+// // this namespace??
+// clang_namespace_decl->setHasExternalLexicalStorage();
+// }
+ }
}
}
else
@@ -1179,7 +1192,7 @@ ClangExpressionDeclMap::GetVariableValue
type_to_use = var_opaque_type;
if (var_location.get()->GetContextType() == Value::eContextTypeInvalid)
- var_location.get()->SetContext(Value::eContextTypeOpaqueClangQualType, type_to_use);
+ var_location.get()->SetContext(Value::eContextTypeClangType, type_to_use);
if (var_location.get()->GetValueType() == Value::eValueTypeFileAddress)
{
@@ -1279,6 +1292,19 @@ ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context,
}
}
+clang::NamespaceDecl *
+ClangExpressionDeclMap::AddNamespace (NameSearchContext &context, const ClangNamespaceDecl &namespace_decl)
+{
+ lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+
+
+ clang::Decl *copied_decl = ClangASTContext::CopyDecl (context.GetASTContext(),
+ namespace_decl.GetASTContext(),
+ namespace_decl.GetNamespaceDecl());
+
+ return dyn_cast<clang::NamespaceDecl>(copied_decl);
+}
+
void
ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context,
Function* fun,
diff --git a/lldb/source/Expression/ClangExpressionVariable.cpp b/lldb/source/Expression/ClangExpressionVariable.cpp
index 370406e5e91..d1ae1d5c8ca 100644
--- a/lldb/source/Expression/ClangExpressionVariable.cpp
+++ b/lldb/source/Expression/ClangExpressionVariable.cpp
@@ -83,7 +83,7 @@ ClangExpressionVariable::PointValueAtData(Value &value, ExecutionContext *exe_ct
if (m_data_sp.get() == NULL)
return false;
- value.SetContext(Value::eContextTypeOpaqueClangQualType, m_user_type.GetOpaqueQualType());
+ value.SetContext(Value::eContextTypeClangType, m_user_type.GetOpaqueQualType());
value.SetValueType(Value::eValueTypeHostAddress);
value.GetScalar() = (uintptr_t)m_data_sp->GetBytes();
clang::ASTContext *ast_context = m_user_type.GetASTContext();
diff --git a/lldb/source/Expression/ClangFunction.cpp b/lldb/source/Expression/ClangFunction.cpp
index bc4fb73da98..40cddf3699d 100644
--- a/lldb/source/Expression/ClangFunction.cpp
+++ b/lldb/source/Expression/ClangFunction.cpp
@@ -327,7 +327,7 @@ ClangFunction::WriteFunctionArguments (ExecutionContext &exe_ctx,
// Special case: if it's a pointer, don't do anything (the ABI supports passing cstrings)
if (arg_value->GetValueType() == Value::eValueTypeHostAddress &&
- arg_value->GetContextType() == Value::eContextTypeOpaqueClangQualType &&
+ arg_value->GetContextType() == Value::eContextTypeClangType &&
ClangASTContext::IsPointerType(arg_value->GetClangType()))
continue;
@@ -421,7 +421,7 @@ ClangFunction::FetchFunctionResults (ExecutionContext &exe_ctx, lldb::addr_t arg
uint32_t offset = 0;
uint64_t return_integer = data.GetMaxU64(&offset, m_return_size);
- ret_value.SetContext (Value::eContextTypeOpaqueClangQualType, m_function_return_qual_type);
+ ret_value.SetContext (Value::eContextTypeClangType, m_function_return_qual_type);
ret_value.SetValueType(Value::eValueTypeScalar);
ret_value.GetScalar() = return_integer;
return true;
diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp
index 9c65e812e85..30381b0439e 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -658,7 +658,7 @@ ReadRegisterValueAsScalar
else
{
value.SetValueType (Value::eValueTypeScalar);
- value.SetContext (Value::eContextTypeDCRegisterInfo, const_cast<RegisterInfo *>(reg_context->GetRegisterInfoAtIndex(native_reg)));
+ value.SetContext (Value::eContextTypeRegisterInfo, const_cast<RegisterInfo *>(reg_context->GetRegisterInfoAtIndex(native_reg)));
if (reg_context->ReadRegisterValue (native_reg, value.GetScalar()))
return true;
@@ -2121,7 +2121,7 @@ DWARFExpression::Evaluate
return false;
}
- if (array_val.GetContextType() != Value::eContextTypeOpaqueClangQualType)
+ if (array_val.GetContextType() != Value::eContextTypeClangType)
{
if (error_ptr)
error_ptr->SetErrorString("Arrays without Clang types are unhandled at this time.");
@@ -2169,7 +2169,7 @@ DWARFExpression::Evaluate
Value member;
- member.SetContext(Value::eContextTypeOpaqueClangQualType, member_type);
+ member.SetContext(Value::eContextTypeClangType, member_type);
member.SetValueType(array_val.GetValueType());
addr_t array_base = (addr_t)array_val.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
@@ -2212,7 +2212,7 @@ DWARFExpression::Evaluate
StreamString new_value(Stream::eBinary, 4, eByteOrderHost);
switch (context_type)
{
- case Value::eContextTypeOpaqueClangQualType:
+ case Value::eContextTypeClangType:
{
void *clang_type = stack.back().GetClangType();
@@ -2427,7 +2427,7 @@ DWARFExpression::Evaluate
tmp = stack.back();
stack.pop_back();
- if (tmp.GetContextType() != Value::eContextTypeOpaqueClangQualType)
+ if (tmp.GetContextType() != Value::eContextTypeClangType)
{
if (error_ptr)
error_ptr->SetErrorString("Item at top of expression stack must have a Clang type");
@@ -2450,7 +2450,7 @@ DWARFExpression::Evaluate
tmp.ResolveValue(exe_ctx, ast_context);
tmp.SetValueType(value_type);
- tmp.SetContext(Value::eContextTypeOpaqueClangQualType, target_type);
+ tmp.SetContext(Value::eContextTypeClangType, target_type);
stack.push_back(tmp);
}
@@ -2483,7 +2483,7 @@ DWARFExpression::Evaluate
Value *proxy = expr_local_variable->CreateProxy();
stack.push_back(*proxy);
delete proxy;
- //stack.back().SetContext (Value::eContextTypeOpaqueClangQualType, expr_local_variable->GetClangType());
+ //stack.back().SetContext (Value::eContextTypeClangType, expr_local_variable->GetClangType());
*/
}
break;
@@ -2548,7 +2548,7 @@ DWARFExpression::Evaluate
else
{
void *clang_type = (void *)opcodes.GetMaxU64(&offset, sizeof(void*));
- stack.back().SetContext (Value::eContextTypeOpaqueClangQualType, clang_type);
+ stack.back().SetContext (Value::eContextTypeClangType, clang_type);
}
break;
//----------------------------------------------------------------------
diff --git a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
index 21adec86c60..e5a5db79477 100644
--- a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
+++ b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
@@ -234,7 +234,7 @@ ABIMacOSX_i386::PrepareNormalCall (Thread &thread,
{
default:
return false;
- case Value::eContextTypeOpaqueClangQualType:
+ case Value::eContextTypeClangType:
{
void *val_type = val->GetClangType();
uint32_t cstr_length;
@@ -433,7 +433,7 @@ ABIMacOSX_i386::GetArgumentValues (Thread &thread,
{
default:
return false;
- case Value::eContextTypeOpaqueClangQualType:
+ case Value::eContextTypeClangType:
{
void *value_type = value->GetClangType();
bool is_signed;
@@ -472,7 +472,7 @@ ABIMacOSX_i386::GetReturnValue (Thread &thread,
{
default:
return false;
- case Value::eContextTypeOpaqueClangQualType:
+ case Value::eContextTypeClangType:
{
// Extract the Clang AST context from the PC so that we can figure out type
// sizes
diff --git a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
index e447df52a92..f4045cc119d 100644
--- a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
+++ b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
@@ -304,7 +304,7 @@ ABISysV_x86_64::GetArgumentValues (Thread &thread,
{
default:
return false;
- case Value::eContextTypeOpaqueClangQualType:
+ case Value::eContextTypeClangType:
{
void *value_type = value->GetClangType();
bool is_signed;
@@ -347,7 +347,7 @@ ABISysV_x86_64::GetReturnValue (Thread &thread,
{
default:
return false;
- case Value::eContextTypeOpaqueClangQualType:
+ case Value::eContextTypeClangType:
{
void *value_type = value.GetClangType();
bool is_signed;
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
index 65a363d99fc..6e4fdb71c5b 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -97,7 +97,7 @@ AppleObjCRuntime::GetObjectDescription (Stream &str, Value &value, ExecutionCont
void *opaque_type_ptr = ast_context->GetBuiltInType_objc_id();
if (opaque_type_ptr == NULL)
opaque_type_ptr = ast_context->GetVoidPtrType(false);
- value.SetContext(Value::eContextTypeOpaqueClangQualType, opaque_type_ptr);
+ value.SetContext(Value::eContextTypeClangType, opaque_type_ptr);
}
ValueList arg_value_list;
@@ -109,7 +109,7 @@ AppleObjCRuntime::GetObjectDescription (Stream &str, Value &value, ExecutionCont
void *return_qualtype = ast_context->GetCStringType(true);
Value ret;
- ret.SetContext(Value::eContextTypeOpaqueClangQualType, return_qualtype);
+ ret.SetContext(Value::eContextTypeClangType, return_qualtype);
// Now we're ready to call the function:
ClangFunction func(target_triple, ast_context, return_qualtype, *function_address, arg_value_list);
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
index 00d27d8b0d9..d76861926a4 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
@@ -74,15 +74,15 @@ AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::SetUpRegion()
}
uint32_t offset_ptr = 0;
- uint16_t header_size = data.GetU16(&offset_ptr);
- uint16_t descriptor_size = data.GetU16(&offset_ptr);
- size_t num_descriptors = data.GetU32(&offset_ptr);
+ const uint16_t header_size = data.GetU16(&offset_ptr);
+ const uint16_t descriptor_size = data.GetU16(&offset_ptr);
+ const size_t num_descriptors = data.GetU32(&offset_ptr);
m_next_region = data.GetPointer(&offset_ptr);
// If the header size is 0, that means we've come in too early before this data is set up.
// Set ourselves as not valid, and continue.
- if (header_size == 0)
+ if (header_size == 0 || num_descriptors == 0)
{
m_valid = false;
return;
@@ -100,8 +100,8 @@ AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::SetUpRegion()
// to compute it over and over.
// Ingest the whole descriptor array:
- lldb::addr_t desc_ptr = m_header_addr + header_size;
- size_t desc_array_size = num_descriptors * descriptor_size;
+ const lldb::addr_t desc_ptr = m_header_addr + header_size;
+ const size_t desc_array_size = num_descriptors * descriptor_size;
DataBufferSP data_sp(new DataBufferHeap (desc_array_size, '\0'));
uint8_t* dst = (uint8_t*)data_sp->GetBytes();
@@ -291,7 +291,7 @@ AppleObjCTrampolineHandler::AppleObjCVTables::RefreshTrampolines (void *baton,
Value input_value;
void *clang_void_ptr_type = clang_ast_context->GetVoidPtrType(false);
input_value.SetValueType (Value::eValueTypeScalar);
- input_value.SetContext (Value::eContextTypeOpaqueClangQualType, clang_void_ptr_type);
+ input_value.SetContext (Value::eContextTypeClangType, clang_void_ptr_type);
argument_values.PushValue(input_value);
bool success = abi->GetArgumentValues (*(context->exe_ctx.thread), argument_values);
@@ -515,7 +515,7 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan (Thread &thread, bool sto
Value input_value;
void *clang_void_ptr_type = clang_ast_context->GetVoidPtrType(false);
input_value.SetValueType (Value::eValueTypeScalar);
- input_value.SetContext (Value::eContextTypeOpaqueClangQualType, clang_void_ptr_type);
+ input_value.SetContext (Value::eContextTypeClangType, clang_void_ptr_type);
int obj_index;
int sel_index;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 5deeb90747b..f3abd9e0a4a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1158,7 +1158,7 @@ SymbolFileDWARF::ParseChildMembers
accessibility = default_accessibility;
member_accessibilities.push_back(accessibility);
- GetClangASTContext().AddFieldToRecordType (class_clang_type, name, member_type->GetClangType(), accessibility, bit_size);
+ GetClangASTContext().AddFieldToRecordType (class_clang_type, name, member_type->GetClangLayoutType(), accessibility, bit_size);
}
}
}
@@ -1226,16 +1226,16 @@ SymbolFileDWARF::ParseChildMembers
}
}
- Type *base_class_dctype = ResolveTypeUID(encoding_uid);
- assert(base_class_dctype);
+ Type *base_class_type = ResolveTypeUID(encoding_uid);
+ assert(base_class_type);
if (class_language == eLanguageTypeObjC)
{
- GetClangASTContext().SetObjCSuperClass(class_clang_type, base_class_dctype->GetClangType());
+ GetClangASTContext().SetObjCSuperClass(class_clang_type, base_class_type->GetClangType());
}
else
{
- base_classes.push_back (GetClangASTContext().CreateBaseClassSpecifier (base_class_dctype->GetClangType(), accessibility, is_virtual, is_base_of_class));
+ base_classes.push_back (GetClangASTContext().CreateBaseClassSpecifier (base_class_type->GetClangType(), accessibility, is_virtual, is_base_of_class));
assert(base_classes.back());
}
}
@@ -2100,36 +2100,42 @@ SymbolFileDWARF::FindTypes(const SymbolContext& sc, const ConstString &name, boo
}
-clang::NamespaceDecl *
+ClangNamespaceDecl
SymbolFileDWARF::FindNamespace (const SymbolContext& sc,
const ConstString &name)
{
+ ClangNamespaceDecl namespace_decl;
DWARFDebugInfo* info = DebugInfo();
- if (info == NULL)
- return 0;
-
- // Index if we already haven't to make sure the compile units
- // get indexed and make their global DIE index list
- if (!m_indexed)
- Index ();
-
- DWARFCompileUnit* curr_cu = NULL;
- DWARFCompileUnit* prev_cu = NULL;
- const DWARFDebugInfoEntry* die = NULL;
- std::vector<NameToDIE::Info> die_info_array;
- const size_t num_matches = m_namespace_index.Find (name, die_info_array);
- for (size_t i=0; i<num_matches; ++i, prev_cu = curr_cu)
+ if (info)
{
- curr_cu = info->GetCompileUnitAtIndex(die_info_array[i].cu_idx);
-
- if (curr_cu != prev_cu)
- curr_cu->ExtractDIEsIfNeeded (false);
+ // Index if we already haven't to make sure the compile units
+ // get indexed and make their global DIE index list
+ if (!m_indexed)
+ Index ();
+
+ DWARFCompileUnit* curr_cu = NULL;
+ DWARFCompileUnit* prev_cu = NULL;
+ const DWARFDebugInfoEntry* die = NULL;
+ std::vector<NameToDIE::Info> die_info_array;
+ const size_t num_matches = m_namespace_index.Find (name, die_info_array);
+ for (size_t i=0; i<num_matches; ++i, prev_cu = curr_cu)
+ {
+ curr_cu = info->GetCompileUnitAtIndex(die_info_array[i].cu_idx);
+
+ if (curr_cu != prev_cu)
+ curr_cu->ExtractDIEsIfNeeded (false);
- die = curr_cu->GetDIEAtIndexUnchecked(die_info_array[i].die_idx);
+ die = curr_cu->GetDIEAtIndexUnchecked(die_info_array[i].die_idx);
- return ResolveNamespaceDIE (curr_cu, die);
+ clang::NamespaceDecl *clang_namespace_decl = ResolveNamespaceDIE (curr_cu, die);
+ if (clang_namespace_decl)
+ {
+ namespace_decl.SetASTContext (GetClangASTContext().getASTContext());
+ namespace_decl.SetNamespaceDecl (clang_namespace_decl);
+ }
+ }
}
- return NULL;
+ return namespace_decl;
}
uint32_t
@@ -2700,6 +2706,10 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
DWARFDebugInfoEntry::Attributes attributes;
const char *type_name_cstr = NULL;
ConstString type_name_const_str;
+ Type::ResolveState resolve_state = Type::eResolveStateUnresolved;
+ size_t byte_size = 0;
+ Declaration decl;
+
Type::EncodingDataType encoding_data_type = Type::eEncodingIsUID;
clang_type_t clang_type = NULL;
@@ -2719,9 +2729,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
m_die_to_type[die] = DIE_IS_BEING_PARSED;
const size_t num_attributes = die->GetAttributes(this, dwarf_cu, NULL, attributes);
- Declaration decl;
uint32_t encoding = 0;
- size_t byte_size = 0;
lldb::user_id_t encoding_uid = LLDB_INVALID_UID;
if (num_attributes > 0)
@@ -2758,47 +2766,21 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
switch (tag)
{
default:
+ break;
+
case DW_TAG_base_type:
+ resolve_state = Type::eResolveStateFull;
clang_type = ast.GetBuiltinTypeForDWARFEncodingAndBitSize (type_name_cstr,
encoding,
byte_size * 8);
break;
- case DW_TAG_pointer_type:
- // The encoding_uid will be embedded into the
- // Type object and will be looked up when the Type::GetClangType()
- encoding_data_type = Type::eEncodingIsPointerUID;
- break;
-
- case DW_TAG_reference_type:
- // The encoding_uid will be embedded into the
- // Type object and will be looked up when the Type::GetClangType()
- encoding_data_type = Type::eEncodingIsLValueReferenceUID;
- break;
-
- case DW_TAG_typedef:
- // The encoding_uid will be embedded into the
- // Type object and will be looked up when the Type::GetClangType()
- encoding_data_type = Type::eEncodingIsTypedefUID;
- break;
-
- case DW_TAG_const_type:
- // The encoding_uid will be embedded into the
- // Type object and will be looked up when the Type::GetClangType()
- encoding_data_type = Type::eEncodingIsConstUID; //ClangASTContext::AddConstModifier (clang_type);
- break;
-
- case DW_TAG_restrict_type:
- // The encoding_uid will be embedded into the
- // Type object and will be looked up when the Type::GetClangType()
- encoding_data_type = Type::eEncodingIsRestrictUID; //ClangASTContext::AddRestrictModifier (clang_type);
- break;
-
- case DW_TAG_volatile_type:
- // The encoding_uid will be embedded into the
- // Type object and will be looked up when the Type::GetClangType()
- encoding_data_type = Type::eEncodingIsVolatileUID; //ClangASTContext::AddVolatileModifier (clang_type);
- break;
+ case DW_TAG_pointer_type: encoding_data_type = Type::eEncodingIsPointerUID; break;
+ case DW_TAG_reference_type: encoding_data_type = Type::eEncodingIsLValueReferenceUID; break;
+ case DW_TAG_typedef: encoding_data_type = Type::eEncodingIsTypedefUID; break;
+ case DW_TAG_const_type: encoding_data_type = Type::eEncodingIsConstUID; break;
+ case DW_TAG_restrict_type: encoding_data_type = Type::eEncodingIsRestrictUID; break;
+ case DW_TAG_volatile_type: encoding_data_type = Type::eEncodingIsVolatileUID; break;
}
if (type_name_cstr != NULL && sc.comp_unit != NULL &&
@@ -2811,14 +2793,18 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
if (type_name_const_str == g_objc_type_name_id)
{
clang_type = ast.GetBuiltInType_objc_id();
+ resolve_state = Type::eResolveStateFull;
+
}
else if (type_name_const_str == g_objc_type_name_Class)
{
clang_type = ast.GetBuiltInType_objc_Class();
+ resolve_state = Type::eResolveStateFull;
}
else if (type_name_const_str == g_objc_type_name_selector)
{
clang_type = ast.GetBuiltInType_objc_selector();
+ resolve_state = Type::eResolveStateFull;
}
}
@@ -2831,7 +2817,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
encoding_data_type,
&decl,
clang_type,
- clang_type == NULL));
+ resolve_state));
m_die_to_type[die] = type_sp.get();
@@ -2853,10 +2839,8 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
// Set a bit that lets us know that we are currently parsing this
m_die_to_type[die] = DIE_IS_BEING_PARSED;
- size_t byte_size = 0;
LanguageType class_language = eLanguageTypeUnknown;
//bool struct_is_class = false;
- Declaration decl;
const size_t num_attributes = die->GetAttributes(this, dwarf_cu, NULL, attributes);
if (num_attributes > 0)
{
@@ -2974,7 +2958,6 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
// parameters in any class methods need it for the clang
// types for function prototypes.
m_die_to_decl_ctx[die] = ClangASTContext::GetDeclContextForType (clang_type);
- const bool is_forward_decl = die->HasChildren();
type_sp.reset (new Type (die->GetOffset(),
this,
type_name_const_str,
@@ -2984,7 +2967,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
Type::eEncodingIsUID,
&decl,
clang_type,
- is_forward_decl));
+ Type::eResolveStateForward));
m_die_to_type[die] = type_sp.get();
@@ -3013,9 +2996,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
// Set a bit that lets us know that we are currently parsing this
m_die_to_type[die] = DIE_IS_BEING_PARSED;
- size_t byte_size = 0;
lldb::user_id_t encoding_uid = DW_INVALID_OFFSET;
- Declaration decl;
const size_t num_attributes = die->GetAttributes(this, dwarf_cu, NULL, attributes);
if (num_attributes > 0)
@@ -3086,7 +3067,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
Type::eEncodingIsUID,
&decl,
clang_type,
- true));
+ Type::eResolveStateForward));
m_die_to_type[die] = type_sp.get();
@@ -3111,7 +3092,6 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
const char *mangled = NULL;
dw_offset_t type_die_offset = DW_INVALID_OFFSET;
- Declaration decl;
bool is_variadic = false;
bool is_inline = false;
bool is_static = false;
@@ -3202,7 +3182,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
func_type = ResolveTypeUID(type_die_offset);
if (func_type)
- return_clang_type = func_type->GetClangForwardType();
+ return_clang_type = func_type->GetClangLayoutType();
else
return_clang_type = ast.GetBuiltInType_void();
@@ -3339,7 +3319,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
Type::eEncodingIsUID,
&decl,
clang_type,
- false));
+ Type::eResolveStateFull));
m_die_to_type[die] = type_sp.get();
assert(type_sp.get());
@@ -3351,9 +3331,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
// Set a bit that lets us know that we are currently parsing this
m_die_to_type[die] = DIE_IS_BEING_PARSED;
- size_t byte_size = 0;
lldb::user_id_t type_die_offset = DW_INVALID_OFFSET;
- Declaration decl;
int64_t first_index = 0;
uint32_t byte_stride = 0;
uint32_t bit_stride = 0;
@@ -3432,11 +3410,12 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
empty_name,
array_element_bit_stride / 8,
NULL,
- LLDB_INVALID_UID,
+ type_die_offset,
Type::eEncodingIsUID,
&decl,
clang_type,
- false));
+ Type::eResolveStateFull));
+ type_sp->SetEncodingType (element_type);
m_die_to_type[die] = type_sp.get();
}
}
@@ -3471,14 +3450,14 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
Type *pointee_type = ResolveTypeUID(type_die_offset);
Type *class_type = ResolveTypeUID(containing_type_die_offset);
- clang_type_t pointee_clang_type = pointee_type->GetClangType();
- clang_type_t class_clang_type = class_type->GetClangType();
+ clang_type_t pointee_clang_type = pointee_type->GetClangForwardType();
+ clang_type_t class_clang_type = class_type->GetClangLayoutType();
clang_type = ast.CreateMemberPointerType(pointee_clang_type,
class_clang_type);
- size_t byte_size = ClangASTType::GetClangTypeBitWidth (ast.getASTContext(),
- clang_type) / 8;
+ byte_size = ClangASTType::GetClangTypeBitWidth (ast.getASTContext(),
+ clang_type) / 8;
type_sp.reset( new Type (die->GetOffset(),
this,
@@ -3489,7 +3468,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
Type::eEncodingIsUID,
NULL,
clang_type,
- false));
+ Type::eResolveStateForward));
m_die_to_type[die] = type_sp.get();
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index a92fbdddcd2..1106b2404ea 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -110,7 +110,7 @@ public:
virtual uint32_t FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::TypeList& types);
// virtual uint32_t FindTypes(const lldb_private::SymbolContext& sc, const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb::Type::Encoding encoding, lldb::user_id_t udt_uid, lldb_private::TypeList& types);
virtual lldb_private::TypeList *GetTypeList ();
- virtual clang::NamespaceDecl *
+ virtual lldb_private::ClangNamespaceDecl
FindNamespace (const lldb_private::SymbolContext& sc,
const lldb_private::ConstString &name);
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 7d4607e0155..a8f376331aa 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -953,11 +953,11 @@ SymbolFileDWARFDebugMap::FindTypes
//}
-clang::NamespaceDecl *
+ClangNamespaceDecl
SymbolFileDWARFDebugMap::FindNamespace (const lldb_private::SymbolContext& sc,
const lldb_private::ConstString &name)
{
- clang::NamespaceDecl *matching_namespace = NULL;
+ ClangNamespaceDecl matching_namespace;
SymbolFileDWARF *oso_dwarf;
if (sc.comp_unit)
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
index 88aceb22e7f..5ab88dc3be1 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
@@ -71,7 +71,7 @@ public:
virtual uint32_t FindFunctions (const lldb_private::RegularExpression& regex, bool append, lldb_private::SymbolContextList& sc_list);
virtual uint32_t FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::TypeList& types);
// virtual uint32_t FindTypes (const lldb_private::SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, Type::Encoding encoding, lldb::user_id_t udt_uid, TypeList& types);
- virtual clang::NamespaceDecl *
+ virtual lldb_private::ClangNamespaceDecl
FindNamespace (const lldb_private::SymbolContext& sc,
const lldb_private::ConstString &name);
diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
index 9a8d6f35ed5..56141bc73c0 100644
--- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
+++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
@@ -277,10 +277,10 @@ SymbolFileSymtab::ResolveClangOpaqueTypeDefinition (lldb::clang_type_t clang_Typ
return NULL;
}
-clang::NamespaceDecl *
+ClangNamespaceDecl
SymbolFileSymtab::FindNamespace (const SymbolContext& sc, const ConstString &name)
{
- return NULL;
+ return ClangNamespaceDecl();
}
uint32_t
diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
index 0bd4e7fc4ec..fc6a52c216a 100644
--- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
+++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
@@ -101,7 +101,7 @@ public:
// virtual uint32_t
// FindTypes(const lldb_private::SymbolContext& sc, const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb_private::TypeList& types);
- virtual clang::NamespaceDecl *
+ virtual lldb_private::ClangNamespaceDecl
FindNamespace (const lldb_private::SymbolContext& sc,
const lldb_private::ConstString &name);
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index 363b1af6e8b..a7fe230d08d 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -740,6 +740,23 @@ ClangASTContext::CopyType (ASTContext *dest_context,
return dst.getAsOpaquePtr();
}
+
+clang::Decl *
+ClangASTContext::CopyDecl (ASTContext *dest_context,
+ ASTContext *source_context,
+ clang::Decl *source_decl)
+{
+ // null_client's ownership is transferred to diagnostics
+ NullDiagnosticClient *null_client = new NullDiagnosticClient;
+ Diagnostic diagnostics(null_client);
+ FileManager file_manager;
+ ASTImporter importer(diagnostics,
+ *dest_context, file_manager,
+ *source_context, file_manager);
+
+ return importer.Import(source_decl);
+}
+
bool
ClangASTContext::AreTypesSame(ASTContext *ast_context,
clang_type_t type1,
diff --git a/lldb/source/Symbol/ClangNamespaceDecl.cpp b/lldb/source/Symbol/ClangNamespaceDecl.cpp
new file mode 100644
index 00000000000..9e764ba1cd9
--- /dev/null
+++ b/lldb/source/Symbol/ClangNamespaceDecl.cpp
@@ -0,0 +1,11 @@
+//===-- ClangNamespaceDecl.cpp ----------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Symbol/ClangNamespaceDecl.h"
+
diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp
index e89782dd3c2..373d5e6c2a1 100644
--- a/lldb/source/Symbol/Function.cpp
+++ b/lldb/source/Symbol/Function.cpp
@@ -413,8 +413,18 @@ Function::GetReturnType ()
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(), false);
+ 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;
}
@@ -455,7 +465,16 @@ Function::GetArgumentTypeAtIndex (size_t idx)
// 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(), false);
+ 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;
}
diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index 2ac99a0c619..2f5ff3a2434 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -400,6 +400,14 @@ SymbolContext::GetAddressRange (uint32_t scope, AddressRange &range) const
return false;
}
+ClangNamespaceDecl
+SymbolContext::FindNamespace (const ConstString &name) const
+{
+ ClangNamespaceDecl namespace_decl;
+ if (module_sp)
+ namespace_decl = module_sp->GetSymbolVendor()->FindNamespace (*this, name);
+ return namespace_decl;
+}
size_t
SymbolContext::FindFunctionsByName (const ConstString &name, bool append, SymbolContextList &sc_list) const
@@ -422,12 +430,12 @@ SymbolContext::FindFunctionsByName (const ConstString &name, bool append, Symbol
return sc_list.GetSize();
}
-lldb::VariableSP
-SymbolContext::FindVariableByName (const char *name) const
-{
- lldb::VariableSP return_value;
- return return_value;
-}
+//lldb::VariableSP
+//SymbolContext::FindVariableByName (const char *name) const
+//{
+// lldb::VariableSP return_value;
+// return return_value;
+//}
lldb::TypeSP
SymbolContext::FindTypeByName (const ConstString &name) const
diff --git a/lldb/source/Symbol/SymbolVendor.cpp b/lldb/source/Symbol/SymbolVendor.cpp
index d960dde30e6..f2a3681f535 100644
--- a/lldb/source/Symbol/SymbolVendor.cpp
+++ b/lldb/source/Symbol/SymbolVendor.cpp
@@ -261,22 +261,16 @@ SymbolVendor::FindTypes (const SymbolContext& sc, const ConstString &name, bool
types.Clear();
return 0;
}
-//
-//uint32_t
-//SymbolVendor::FindTypes(const SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, Type::Encoding encoding, const char *udt_name, TypeList& types)
-//{
-// Mutex::Locker locker(m_mutex);
-// if (m_sym_file_ap.get())
-// {
-// lldb::user_id_t udt_uid = LLDB_INVALID_UID;
-//
-// if (encoding == Type::user_defined_type)
-// udt_uid = UserDefType::GetUserDefTypeUID(udt_name);
-//
-// return m_sym_file_ap->FindTypes(sc, regex, append, max_matches, encoding, udt_uid, types);
-// }
-// return 0;
-//}
+
+ClangNamespaceDecl
+SymbolVendor::FindNamespace(const SymbolContext& sc, const ConstString &name)
+{
+ Mutex::Locker locker(m_mutex);
+ ClangNamespaceDecl namespace_decl;
+ if (m_sym_file_ap.get())
+ namespace_decl = m_sym_file_ap->FindNamespace (sc, name);
+ return namespace_decl;
+}
void
SymbolVendor::Dump(Stream *s)
diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index 111ec89d691..e99b1a09f20 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -39,7 +39,7 @@ lldb_private::Type::Type
EncodingDataType encoding_data_type,
const Declaration& decl,
clang_type_t clang_type,
- bool is_forward_decl
+ ResolveState clang_type_resolve_state
) :
UserID (uid),
m_name (name),
@@ -51,9 +51,7 @@ lldb_private::Type::Type
m_byte_size (byte_size),
m_decl (decl),
m_clang_type (clang_type),
- m_is_forward_decl (is_forward_decl),
- m_encoding_type_forward_decl_resolved (false),
- m_encoding_type_decl_resolved (false)
+ m_clang_type_resolve_state (clang_type ? clang_type_resolve_state : eResolveStateUnresolved)
{
}
@@ -66,9 +64,9 @@ lldb_private::Type::Type () :
m_encoding_uid_type (eEncodingInvalid),
m_encoding_uid (0),
m_byte_size (0),
- m_is_forward_decl (false),
m_decl (),
- m_clang_type (NULL)
+ m_clang_type (NULL),
+ m_clang_type_resolve_state (eResolveStateUnresolved)
{
}
@@ -86,9 +84,9 @@ lldb_private::Type::operator= (const Type& rhs)
m_encoding_uid_type = rhs.m_encoding_uid_type;
m_encoding_uid = rhs.m_encoding_uid;
m_byte_size = rhs.m_byte_size;
- m_is_forward_decl = rhs.m_is_forward_decl;
m_decl = rhs.m_decl;
m_clang_type = rhs.m_clang_type;
+ m_clang_type_resolve_state = rhs.m_clang_type_resolve_state;
}
return *this;
}
@@ -190,7 +188,7 @@ lldb_private::Type::GetName()
{
if (!(m_name))
{
- if (ResolveClangType(true))
+ if (ResolveClangType(eResolveStateForward))
{
std::string type_name = ClangASTContext::GetTypeName (m_clang_type);
if (!type_name.empty())
@@ -220,7 +218,7 @@ lldb_private::Type::DumpValue
lldb::Format format
)
{
- if (ResolveClangType(true))
+ if (ResolveClangType(eResolveStateForward))
{
if (show_types)
{
@@ -251,11 +249,8 @@ lldb_private::Type::DumpValue
lldb_private::Type *
lldb_private::Type::GetEncodingType ()
{
- if (m_encoding_type == NULL)
- {
- if (m_encoding_uid != LLDB_INVALID_UID)
- m_encoding_type = m_symbol_file->ResolveTypeUID(m_encoding_uid);
- }
+ if (m_encoding_type == NULL && m_encoding_uid != LLDB_INVALID_UID)
+ m_encoding_type = m_symbol_file->ResolveTypeUID(m_encoding_uid);
return m_encoding_type;
}
@@ -279,7 +274,7 @@ lldb_private::Type::GetByteSize()
m_byte_size = encoding_type->GetByteSize();
if (m_byte_size == 0)
{
- uint64_t bit_width = ClangASTType::GetClangTypeBitWidth (GetClangAST(), GetClangType());
+ uint64_t bit_width = ClangASTType::GetClangTypeBitWidth (GetClangAST(), GetClangLayoutType());
m_byte_size = (bit_width + 7 ) / 8;
}
}
@@ -300,7 +295,7 @@ lldb_private::Type::GetByteSize()
uint32_t
lldb_private::Type::GetNumChildren (bool omit_empty_base_classes)
{
- if (!ResolveClangType())
+ if (!ResolveClangType(eResolveStateFull))
return 0;
return ClangASTContext::GetNumChildren (m_clang_type, omit_empty_base_classes);
@@ -309,7 +304,7 @@ lldb_private::Type::GetNumChildren (bool omit_empty_base_classes)
bool
lldb_private::Type::IsAggregateType ()
{
- if (ResolveClangType())
+ if (ResolveClangType(eResolveStateForward))
return ClangASTContext::IsAggregateType (m_clang_type);
return false;
}
@@ -318,7 +313,7 @@ lldb::Format
lldb_private::Type::GetFormat ()
{
// Make sure we resolve our type if it already hasn't been.
- if (!ResolveClangType())
+ if (!ResolveClangType(eResolveStateForward))
return lldb::eFormatInvalid;
return lldb_private::ClangASTType::GetFormat (m_clang_type);
}
@@ -329,7 +324,7 @@ lldb::Encoding
lldb_private::Type::GetEncoding (uint32_t &count)
{
// Make sure we resolve our type if it already hasn't been.
- if (!ResolveClangType())
+ if (!ResolveClangType(eResolveStateForward))
return lldb::eEncodingInvalid;
return lldb_private::ClangASTType::GetEncoding (m_clang_type, count);
@@ -422,18 +417,23 @@ lldb_private::Type::GetDeclaration () const
}
bool
-lldb_private::Type::ResolveClangType (bool forward_decl_is_ok)
+lldb_private::Type::ResolveClangType (ResolveState clang_type_resolve_state)
{
+ Type *encoding_type = NULL;
if (m_clang_type == NULL)
{
TypeList *type_list = GetTypeList();
- Type *encoding_type = GetEncodingType();
+ encoding_type = GetEncodingType();
if (encoding_type)
{
switch (m_encoding_uid_type)
{
case eEncodingIsUID:
- m_clang_type = encoding_type->GetClangType();
+ if (encoding_type->ResolveClangType(clang_type_resolve_state))
+ {
+ m_clang_type = encoding_type->m_clang_type;
+ m_clang_type_resolve_state = encoding_type->m_clang_type_resolve_state;
+ }
break;
case eEncodingIsConstUID:
@@ -518,11 +518,9 @@ lldb_private::Type::ResolveClangType (bool forward_decl_is_ok)
}
// Check if we have a forward reference to a class/struct/union/enum?
- if (m_clang_type != NULL &&
- m_is_forward_decl == true &&
- forward_decl_is_ok == false)
+ if (m_clang_type && m_clang_type_resolve_state < clang_type_resolve_state)
{
- m_is_forward_decl = false;
+ m_clang_type_resolve_state = eResolveStateFull;
if (!ClangASTType::IsDefined (m_clang_type))
{
// We have a forward declaration, we need to resolve it to a complete
@@ -533,45 +531,25 @@ lldb_private::Type::ResolveClangType (bool forward_decl_is_ok)
// If we have an encoding type, then we need to make sure it is
// resolved appropriately.
- if (m_encoding_type_decl_resolved == false)
+ if (m_encoding_uid != LLDB_INVALID_UID)
{
- if ((forward_decl_is_ok == true && !m_encoding_type_forward_decl_resolved) ||
- (forward_decl_is_ok == false))
+ if (encoding_type == NULL)
+ encoding_type = GetEncodingType();
+ if (encoding_type)
{
- Type *encoding_type = GetEncodingType ();
- if (encoding_type != NULL)
- {
- bool forward_decl_is_ok_for_encoding = forward_decl_is_ok;
-// switch (m_encoding_uid_type)
-// {
-// case eEncodingIsPointerUID:
-// case eEncodingIsLValueReferenceUID:
-// case eEncodingIsRValueReferenceUID:
-// forward_decl_is_ok_for_encoding = true;
-// break;
-// default:
-// break;
-// }
-
- if (encoding_type->ResolveClangType (forward_decl_is_ok_for_encoding))
- {
- // We have at least resolve the forward declaration for our
- // encoding type...
- m_encoding_type_forward_decl_resolved = true;
-
- // Check if we fully resolved our encoding type, and if so
- // mark it as having been completely resolved.
- if (forward_decl_is_ok_for_encoding == false)
- m_encoding_type_decl_resolved = true;
- }
- }
- else
+ ResolveState encoding_clang_type_resolve_state = eResolveStateFull;
+ switch (m_encoding_uid_type)
{
- // We don't have an encoding type, so mark everything as being
- // resolved so we don't get into this if statement again
- m_encoding_type_decl_resolved = true;
- m_encoding_type_forward_decl_resolved = true;
+ case eEncodingIsPointerUID:
+ case eEncodingIsLValueReferenceUID:
+ case eEncodingIsRValueReferenceUID:
+ if (clang_type_resolve_state == eResolveStateLayout)
+ encoding_clang_type_resolve_state = eResolveStateForward;
+ break;
+ default:
+ break;
}
+ encoding_type->ResolveClangType (encoding_clang_type_resolve_state);
}
}
return m_clang_type != NULL;
@@ -592,29 +570,30 @@ lldb_private::Type::GetChildClangTypeAtIndex
bool &child_is_base_class
)
{
- if (!ResolveClangType())
- return NULL;
-
- std::string name_str;
- clang_type_t child_qual_type = GetClangASTContext().GetChildClangTypeAtIndex (
- parent_name,
- m_clang_type,
- idx,
- transparent_pointers,
- omit_empty_base_classes,
- name_str,
- child_byte_size,
- child_byte_offset,
- child_bitfield_bit_size,
- child_bitfield_bit_offset,
- child_is_base_class);
-
- if (child_qual_type)
+ clang_type_t child_qual_type = NULL;
+
+ if (GetClangType())
{
- if (!name_str.empty())
- name.SetCString(name_str.c_str());
- else
- name.Clear();
+ std::string name_str;
+ child_qual_type = GetClangASTContext().GetChildClangTypeAtIndex (parent_name,
+ m_clang_type,
+ idx,
+ transparent_pointers,
+ omit_empty_base_classes,
+ name_str,
+ child_byte_size,
+ child_byte_offset,
+ child_bitfield_bit_size,
+ child_bitfield_bit_offset,
+ child_is_base_class);
+
+ if (child_qual_type)
+ {
+ if (!name_str.empty())
+ name.SetCString(name_str.c_str());
+ else
+ name.Clear();
+ }
}
return child_qual_type;
}
@@ -623,16 +602,21 @@ lldb_private::Type::GetChildClangTypeAtIndex
clang_type_t
lldb_private::Type::GetClangType ()
{
- const bool forward_decl_is_ok = false;
- ResolveClangType(forward_decl_is_ok);
+ ResolveClangType(eResolveStateFull);
+ return m_clang_type;
+}
+
+clang_type_t
+lldb_private::Type::GetClangLayoutType ()
+{
+ ResolveClangType(eResolveStateLayout);
return m_clang_type;
}
clang_type_t
lldb_private::Type::GetClangForwardType ()
{
- const bool forward_decl_is_ok = true;
- ResolveClangType (forward_decl_is_ok);
+ ResolveClangType (eResolveStateForward);
return m_clang_type;
}
diff --git a/lldb/source/Target/ThreadPlanTracer.cpp b/lldb/source/Target/ThreadPlanTracer.cpp
index f77d0fac197..665aac590e2 100644
--- a/lldb/source/Target/ThreadPlanTracer.cpp
+++ b/lldb/source/Target/ThreadPlanTracer.cpp
@@ -245,7 +245,7 @@ void ThreadPlanAssemblyTracer::Log ()
{
Value value;
value.SetValueType (Value::eValueTypeScalar);
- value.SetContext (Value::eContextTypeOpaqueClangQualType, m_intptr_type.GetOpaqueQualType());
+ value.SetContext (Value::eContextTypeClangType, m_intptr_type.GetOpaqueQualType());
value_list.PushValue (value);
}
OpenPOWER on IntegriCloud