2011-12-03 11:15:28 +08:00
|
|
|
//===-- ClangExternalASTSourceCommon.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/ClangExternalASTSourceCommon.h"
|
|
|
|
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
#define ClangExternalASTSourceCommon_MAGIC (0x00112233aabbccddull)
|
|
|
|
|
2012-04-13 08:10:03 +08:00
|
|
|
uint64_t g_TotalSizeOfMetadata = 0;
|
|
|
|
|
2011-12-03 11:15:28 +08:00
|
|
|
ClangExternalASTSourceCommon::ClangExternalASTSourceCommon() : clang::ExternalASTSource()
|
|
|
|
{
|
|
|
|
m_magic = ClangExternalASTSourceCommon_MAGIC;
|
2012-04-13 08:10:03 +08:00
|
|
|
|
|
|
|
g_TotalSizeOfMetadata += m_metadata.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
ClangExternalASTSourceCommon::~ClangExternalASTSourceCommon()
|
|
|
|
{
|
|
|
|
g_TotalSizeOfMetadata -= m_metadata.size();
|
2011-12-03 11:15:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t ClangExternalASTSourceCommon::GetMetadata (uintptr_t object)
|
|
|
|
{
|
|
|
|
assert (m_magic == ClangExternalASTSourceCommon_MAGIC);
|
|
|
|
|
|
|
|
return m_metadata[object];
|
|
|
|
}
|
|
|
|
|
|
|
|
void ClangExternalASTSourceCommon::SetMetadata (uintptr_t object, uint64_t metadata)
|
|
|
|
{
|
|
|
|
assert (m_magic == ClangExternalASTSourceCommon_MAGIC);
|
|
|
|
|
2012-04-13 08:10:03 +08:00
|
|
|
uint64_t orig_size = m_metadata.size();
|
2011-12-03 11:15:28 +08:00
|
|
|
m_metadata[object] = metadata;
|
2012-04-13 08:10:03 +08:00
|
|
|
uint64_t new_size = m_metadata.size();
|
|
|
|
g_TotalSizeOfMetadata += (new_size - orig_size);
|
2011-12-03 11:15:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool ClangExternalASTSourceCommon::HasMetadata (uintptr_t object)
|
|
|
|
{
|
|
|
|
assert (m_magic == ClangExternalASTSourceCommon_MAGIC);
|
|
|
|
|
|
|
|
return m_metadata.find(object) != m_metadata.end();
|
2011-12-04 04:02:42 +08:00
|
|
|
}
|