Changed all of our synthesized "___clang" functions, types and variables that get used in expressions over to have a prefix of "$_lldb". Now when we do name lookups we can easily switch off of the first '$' character to know if we should look through only our internal (when first char is '$') stuff, or when we should look through program variables, functions and types. Converted all of the clang expression code over to using "const ConstString&" values for names instead of "const char *" since there were many places that were converting the "const char *" names into ConstString names and them throwing them away. We now avoid making a lot of ConstString conversions and benefit from the quick comparisons in a few extra spots. Converted a lot of code from LLVM coding conventions into LLDB coding conventions. llvm-svn: 116634
50 lines
1.5 KiB
C++
50 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 (ConstString &name)
|
|
{
|
|
char result_name[256];
|
|
::snprintf (result_name, sizeof(result_name), "$%llu", m_result_counter++);
|
|
name.SetCString(result_name);
|
|
}
|
|
|
|
bool
|
|
ClangPersistentVariables::CreatePersistentVariable (const ConstString &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;
|
|
} |