ebtaleb updated the summary for this revision.
ebtaleb removed a reviewer: tberghammer.
ebtaleb updated this revision to Diff 64473.
https://reviews.llvm.org/D22132
Files:
cmake/LLDBDependencies.cmake
include/lldb/Symbol/OCamlASTContext.h
include/lldb/Symbol/TypeSystem.h
source/API/SystemInitializerFull.cpp
source/Plugins/Language/CMakeLists.txt
source/Plugins/Language/OCaml/CMakeLists.txt
source/Plugins/Language/OCaml/OCamlLanguage.cpp
source/Plugins/Language/OCaml/OCamlLanguage.h
source/Plugins/SymbolFile/DWARF/CMakeLists.txt
source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.cpp
source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.h
source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
source/Symbol/CMakeLists.txt
source/Symbol/OCamlASTContext.cpp
Index: source/Symbol/OCamlASTContext.cpp
===
--- /dev/null
+++ source/Symbol/OCamlASTContext.cpp
@@ -0,0 +1,798 @@
+//===-- OCamlASTContext.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/Log.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/StreamFile.h"
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Symbol/SymbolFile.h"
+#include "lldb/Symbol/OCamlASTContext.h"
+#include "lldb/Symbol/Type.h"
+#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/Target.h"
+
+#include "Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+namespace lldb_private
+{
+class OCamlASTContext::OCamlType
+{
+public:
+enum LLVMCastKind
+{
+eKindPrimitive,
+eKindObject,
+eKindReference,
+eKindArray,
+kNumKinds
+};
+
+OCamlType(LLVMCastKind kind) : m_kind(kind) {}
+
+virtual ~OCamlType() = default;
+
+virtual ConstString
+GetName() = 0;
+
+virtual void
+Dump(Stream *s) = 0;
+
+virtual bool
+IsCompleteType() = 0;
+
+LLVMCastKind
+getKind() const
+{
+return m_kind;
+}
+
+private:
+LLVMCastKind m_kind;
+};
+
+} // end of namespace lldb_private
+
+namespace
+{
+
+class OCamlPrimitiveType : public OCamlASTContext::OCamlType
+{
+public:
+enum TypeKind
+{
+eTypeInt,
+};
+
+OCamlPrimitiveType(TypeKind type_kind, uint32_t byte_size) : OCamlType(OCamlType::eKindPrimitive), m_type_kind(type_kind), m_type(ConstString()), m_byte_size(byte_size) {}
+
+OCamlPrimitiveType(TypeKind type_kind, ConstString s, uint32_t byte_size) : OCamlType(OCamlType::eKindPrimitive), m_type_kind(type_kind), m_type(s), m_byte_size(byte_size) {}
+
+ConstString
+GetName() override
+{
+switch (m_type_kind)
+{
+case eTypeInt:
+return m_type;
+}
+return ConstString();
+}
+
+TypeKind
+GetTypeKind()
+{
+return m_type_kind;
+}
+
+void
+Dump(Stream *s) override
+{
+s->Printf("%s\n", GetName().GetCString());
+}
+
+bool
+IsCompleteType() override
+{
+return true;
+}
+
+static bool
+classof(const OCamlType *ot)
+{
+return ot->getKind() == OCamlType::eKindPrimitive;
+}
+
+uint64_t
+GetByteSize() const
+{
+return m_byte_size;
+}
+
+private:
+const TypeKind m_type_kind;
+const ConstString m_type;
+uint64_t m_byte_size;
+};
+}
+
+OCamlASTContext::OCamlASTContext()
+: TypeSystem(eKindOCaml),
+ m_pointer_byte_size(0),
+ m_int_byte_size(0)
+{
+}
+
+OCamlASTContext::~OCamlASTContext()
+{
+}
+
+ConstString
+OCamlASTContext::GetPluginNameStatic()
+{
+return ConstString("ocaml");
+}
+
+ConstString
+OCamlASTContext::GetPluginName()
+{
+return OCamlASTContext::GetPluginNameStatic();
+}
+
+uint32_t
+OCamlASTContext::GetPluginVersion()
+{
+return 1;
+}
+
+lldb::TypeSystemSP
+OCamlASTContext::CreateInstance (lldb::LanguageType language, Module *module, Target *target)
+{
+Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_LANGUAGE));
+