llvm-project/lldb/source/Expression/ClangPersistentVariables.cpp
Greg Clayton 1d3afba3a3 Added a new ValueObject type that will be used to freeze dry expression
results. The clang opaque type for the expression result will be added to the
Target's ASTContext, and the bytes will be stored in a DataBuffer inside
the new object. The class is named: ValueObjectConstResult

Now after an expression is evaluated, we can get a ValueObjectSP back that
contains a ValueObjectConstResult object.

Relocated the value object dumping code into a static function within
the ValueObject class instead of being in the CommandObjectFrame.cpp file
which is what contained the code to dump variables ("frame variables").

llvm-svn: 115578
2010-10-05 00:00:42 +00:00

53 lines
1.5 KiB
C++

//===-- ClangPersistentVariables.cpp ----------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "ClangPersistentVariables.h"
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Core/Value.h"
using namespace lldb_private;
ClangPersistentVariables::ClangPersistentVariables () :
ClangExpressionVariableStore()
{
m_result_counter = 0;
}
void
ClangPersistentVariables::GetNextResultName (std::string &name)
{
StreamString s;
s.Printf("$%llu", m_result_counter);
m_result_counter++;
name = s.GetString();
}
bool
ClangPersistentVariables::CreatePersistentVariable(const char *name,
TypeFromUser user_type)
{
if (GetVariable(name))
return false;
ClangExpressionVariable &pvar (VariableAtIndex(CreateVariable()));
pvar.m_name = name;
pvar.m_user_type = user_type;
// TODO: Sean, why do we need to call this?, we can just make it below
// and we aren't checking the result or anything... Is this cruft left
// over from an old code re-org?
//pvar.EnableDataVars();
pvar.m_data_sp.reset(new DataBufferHeap(pvar.Size(), 0));
return true;
}