Added ClangExternalASTSourceCommon, a local superclass
for all our external AST sources that lets us associate
arbitrary flags with the types we put into the AST
contexts.  Also added an API on ClangASTContext that
allows access to these flags given only an ASTContext
and a type.

Because we don't have access to RTTI, and because at
some point in the future we might encounter external
AST sources that we didn't make (so they don't subclass
ClangExternalASTSourceCommon) I added a magic number
that we check before doing anything else, so that we
can catch that problem as soon as it appears.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@145748 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Symbol/ClangExternalASTSourceCommon.cpp b/source/Symbol/ClangExternalASTSourceCommon.cpp
new file mode 100644
index 0000000..d5b7d57
--- /dev/null
+++ b/source/Symbol/ClangExternalASTSourceCommon.cpp
@@ -0,0 +1,40 @@
+//===-- 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)
+
+ClangExternalASTSourceCommon::ClangExternalASTSourceCommon() : clang::ExternalASTSource()
+{
+    m_magic = ClangExternalASTSourceCommon_MAGIC;
+}
+
+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);
+    
+    m_metadata[object] = metadata;
+}
+
+bool ClangExternalASTSourceCommon::HasMetadata (uintptr_t object)
+{
+    assert (m_magic == ClangExternalASTSourceCommon_MAGIC);
+
+    return m_metadata.find(object) != m_metadata.end();
+}
\ No newline at end of file