================
@@ -0,0 +1,34 @@
+//===-- TestFakePlugin.cpp 
------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Telemetry.h"
+#include "plugin/FakePlugin.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Telemetry/Telemetry.h"
+#include "gtest/gtest.h"
+
+#include <memory>
+
+TEST(TelemetryTest, PluginTest) {
+  // This would have been called by the plugin reg in a "real" plugin
+  // For tests, we just call it directly.
+  lldb_private::FakePlugin::Initialize();
+
+  auto ins = lldb_private::telemetry::TelemetryManager::getInstance();
+
+  ASSERT_NE(ins, nullptr);
+  lldb_private::FakeTelemetryInfo entry;
+  entry.msg = "";
+
+  auto stat = ins->preDispatch(&entry);
----------------
oontvoo wrote:

> So you don't need to make it public if all you want is overridability 
> (customizability of behavior).
Ok, i'll send a separate PR to move preDispatch to protected.

> That makes sense, but then I also wonder why is `dispatch` virtual, because 
> `preDispatch` is basically equivalent to overriding `dispatch` to do the 
> custom thing and then delegate to base class.

The reason we have `dispatch` do most of the work was to avoid having 
subclasses repeating pretty much the same code (ie., iterating over the list of 
Destinations ... ).  But we made it virtual because it's possible downstream 
implementation want to do the dispatch in some different way (i., parallel ? 
whatnot)






https://github.com/llvm/llvm-project/pull/126588
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to