1 //===-- OCamlLanguage.cpp ----------------------------------------*- C++
4 // The LLVM Compiler Infrastructure
6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
17 // Other libraries and framework includes
18 #include "llvm/ADT/StringRef.h"
21 #include "OCamlLanguage.h"
22 #include "lldb/Core/PluginManager.h"
23 #include "lldb/DataFormatters/DataVisualization.h"
24 #include "lldb/DataFormatters/FormattersHelpers.h"
25 #include "lldb/Symbol/OCamlASTContext.h"
26 #include "lldb/Utility/ConstString.h"
29 using namespace lldb_private;
31 void OCamlLanguage::Initialize() {
32 PluginManager::RegisterPlugin(GetPluginNameStatic(), "OCaml Language",
36 void OCamlLanguage::Terminate() {
37 PluginManager::UnregisterPlugin(CreateInstance);
40 lldb_private::ConstString OCamlLanguage::GetPluginNameStatic() {
41 static ConstString g_name("OCaml");
45 lldb_private::ConstString OCamlLanguage::GetPluginName() {
46 return GetPluginNameStatic();
49 uint32_t OCamlLanguage::GetPluginVersion() { return 1; }
51 Language *OCamlLanguage::CreateInstance(lldb::LanguageType language) {
52 if (language == eLanguageTypeOCaml)
53 return new OCamlLanguage();
57 bool OCamlLanguage::IsNilReference(ValueObject &valobj) {
58 if (!valobj.GetCompilerType().IsReferenceType())
61 // If we failed to read the value then it is not a nil reference.
62 return valobj.GetValueAsUnsigned(UINT64_MAX) == 0;