[Lldb-commits] [PATCH] Move full initialization to lldb/API

Greg Clayton clayborg at gmail.com
Thu Mar 19 15:01:53 PDT 2015


See inlined changes.


================
Comment at: source/API/SBDebugger.cpp:104
@@ +103,3 @@
+
+static llvm::ManagedStatic<SBDebuggerLifetimeManager> g_debugger_lifetime;
+
----------------
Please put this in a static function and call the singleton and have it return a reference. The Apple build system prohibits frameworks from having global initializers.

So make this:


```
static SBDebuggerLifetimeManager &
GetDebuggerLifetimeManager ()
{
    static llvm::ManagedStatic<SBDebuggerLifetimeManager> g_debugger_lifetime;
    return g_debugger_lifetime;
}
```


================
Comment at: source/API/SBDebugger.cpp:142
@@ -119,3 +141,3 @@
 
-    lldb_private::Initialize(LoadPlugin);
+    g_debugger_lifetime->AddRef();
 }
----------------
Change this to:

```
GetDebuggerLifetimeManager ().AddRef();
```

================
Comment at: source/API/SBDebugger.cpp:148
@@ -125,3 +147,3 @@
 {
-    lldb_private::Terminate();
+    g_debugger_lifetime->Release();
 }
----------------
Change this to:

```
GetDebuggerLifetimeManager (). Release();
```

================
Comment at: tools/lldb-server/lldb-server.cpp:35
@@ +34,3 @@
+
+static llvm::ManagedStatic<LLDBServerLifetimeManager> g_debugger_lifetime;
+
----------------
NOTE: this static is OK because this is in an application, not in a shared library or framework and Apple builds are ok with this.

http://reviews.llvm.org/D8462

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the lldb-commits mailing list