]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Plugins/Language/OCaml/OCamlLanguage.cpp
MFC r345805: Unify SCSI_STATUS_BUSY retry handling with other cases.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / Plugins / Language / OCaml / OCamlLanguage.cpp
1 //===-- OCamlLanguage.cpp ----------------------------------------*- C++
2 //-*-===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10
11 // C Includes
12 #include <string.h>
13 // C++ Includes
14 #include <functional>
15 #include <mutex>
16
17 // Other libraries and framework includes
18 #include "llvm/ADT/StringRef.h"
19
20 // Project includes
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"
27
28 using namespace lldb;
29 using namespace lldb_private;
30
31 void OCamlLanguage::Initialize() {
32   PluginManager::RegisterPlugin(GetPluginNameStatic(), "OCaml Language",
33                                 CreateInstance);
34 }
35
36 void OCamlLanguage::Terminate() {
37   PluginManager::UnregisterPlugin(CreateInstance);
38 }
39
40 lldb_private::ConstString OCamlLanguage::GetPluginNameStatic() {
41   static ConstString g_name("OCaml");
42   return g_name;
43 }
44
45 lldb_private::ConstString OCamlLanguage::GetPluginName() {
46   return GetPluginNameStatic();
47 }
48
49 uint32_t OCamlLanguage::GetPluginVersion() { return 1; }
50
51 Language *OCamlLanguage::CreateInstance(lldb::LanguageType language) {
52   if (language == eLanguageTypeOCaml)
53     return new OCamlLanguage();
54   return nullptr;
55 }
56
57 bool OCamlLanguage::IsNilReference(ValueObject &valobj) {
58   if (!valobj.GetCompilerType().IsReferenceType())
59     return false;
60
61   // If we failed to read the value then it is not a nil reference.
62   return valobj.GetValueAsUnsigned(UINT64_MAX) == 0;
63 }