Skip to content

Reapply "Make llvm::telemetry::Manager::preDispatch protected. (#127114) #127431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions llvm/include/llvm/Telemetry/Telemetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,6 @@ class Manager {
public:
virtual ~Manager() = default;

// Optional callback for subclasses to perform additional tasks before
// dispatching to Destinations.
virtual Error preDispatch(TelemetryInfo *Entry) = 0;

// Dispatch Telemetry data to the Destination(s).
// The argument is non-const because the Manager may add or remove
// data from the entry.
Expand All @@ -150,6 +146,11 @@ class Manager {
// Register a Destination.
void addDestination(std::unique_ptr<Destination> Destination);

protected:
// Optional callback for subclasses to perform additional tasks before
// dispatching to Destinations.
virtual Error preDispatch(TelemetryInfo *Entry);

private:
std::vector<std::unique_ptr<Destination>> Destinations;
};
Expand Down
15 changes: 15 additions & 0 deletions llvm/lib/Telemetry/Telemetry.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file provides the basic framework for Telemetry.
/// Refer to its documentation at llvm/docs/Telemetry.rst for more details.
//===---------------------------------------------------------------------===//

#include "llvm/Telemetry/Telemetry.h"

namespace llvm {
Expand All @@ -22,5 +35,7 @@ void Manager::addDestination(std::unique_ptr<Destination> Dest) {
Destinations.push_back(std::move(Dest));
}

Error Manager::preDispatch(TelemetryInfo *Entry) { return Error::success(); }

} // namespace telemetry
} // namespace llvm