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
121 lines
2.8 KiB
C++
121 lines
2.8 KiB
C++
//===-- ValueObjectConstResult.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/Core/ValueObjectConstResult.h"
|
|
|
|
#include "lldb/Core/DataExtractor.h"
|
|
#include "lldb/Core/Module.h"
|
|
#include "lldb/Core/ValueObjectList.h"
|
|
|
|
#include "lldb/Symbol/ClangASTType.h"
|
|
#include "lldb/Symbol/ObjectFile.h"
|
|
#include "lldb/Symbol/SymbolContext.h"
|
|
#include "lldb/Symbol/Type.h"
|
|
#include "lldb/Symbol/Variable.h"
|
|
|
|
#include "lldb/Target/ExecutionContext.h"
|
|
#include "lldb/Target/Process.h"
|
|
#include "lldb/Target/Target.h"
|
|
|
|
using namespace lldb;
|
|
using namespace lldb_private;
|
|
|
|
ValueObjectConstResult::ValueObjectConstResult
|
|
(
|
|
clang::ASTContext *clang_ast,
|
|
void *clang_type,
|
|
const ConstString &name,
|
|
const lldb::DataBufferSP &data_sp,
|
|
lldb::ByteOrder data_byte_order,
|
|
uint8_t data_addr_size
|
|
) :
|
|
ValueObject (NULL),
|
|
m_clang_ast (clang_ast),
|
|
m_type_name ()
|
|
{
|
|
m_data.SetByteOrder(data_byte_order);
|
|
m_data.SetAddressByteSize(data_addr_size);
|
|
m_data.SetData(data_sp);
|
|
m_value.GetScalar() = (uintptr_t)data_sp->GetBytes();
|
|
m_value.SetValueType(Value::eValueTypeHostAddress);
|
|
m_value.SetContext(Value::eContextTypeClangType, clang_type);
|
|
m_name = name;
|
|
SetIsConstant ();
|
|
SetValueIsValid(true);
|
|
}
|
|
|
|
ValueObjectConstResult::ValueObjectConstResult (const Error& error) :
|
|
ValueObject (NULL),
|
|
m_clang_ast (NULL),
|
|
m_type_name ()
|
|
{
|
|
m_error = error;
|
|
SetIsConstant ();
|
|
}
|
|
|
|
ValueObjectConstResult::~ValueObjectConstResult()
|
|
{
|
|
}
|
|
|
|
void *
|
|
ValueObjectConstResult::GetClangType()
|
|
{
|
|
return m_value.GetClangType();
|
|
}
|
|
|
|
lldb::ValueType
|
|
ValueObjectConstResult::GetValueType() const
|
|
{
|
|
return eValueTypeConstResult;
|
|
}
|
|
|
|
size_t
|
|
ValueObjectConstResult::GetByteSize()
|
|
{
|
|
// We stored all the data for this const object in our data
|
|
return m_data.GetByteSize();
|
|
}
|
|
|
|
uint32_t
|
|
ValueObjectConstResult::CalculateNumChildren()
|
|
{
|
|
return ClangASTContext::GetNumChildren (GetClangType(), true);
|
|
}
|
|
|
|
clang::ASTContext *
|
|
ValueObjectConstResult::GetClangAST ()
|
|
{
|
|
return m_clang_ast;
|
|
}
|
|
|
|
ConstString
|
|
ValueObjectConstResult::GetTypeName()
|
|
{
|
|
if (m_type_name.IsEmpty())
|
|
m_type_name = ClangASTType::GetClangTypeName (GetClangType());
|
|
return m_type_name;
|
|
}
|
|
|
|
void
|
|
ValueObjectConstResult::UpdateValue (ExecutionContextScope *exe_scope)
|
|
{
|
|
m_error.Clear();
|
|
// Const value is always valid
|
|
SetValueIsValid (true);
|
|
}
|
|
|
|
|
|
bool
|
|
ValueObjectConstResult::IsInScope (StackFrame *frame)
|
|
{
|
|
// A const result value is always in scope since it serializes all
|
|
// information needed to contain the constant value.
|
|
return true;
|
|
}
|