Path: blob/main/contrib/llvm-project/llvm/lib/Telemetry/Telemetry.cpp
213765 views
//===----------------------------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7///8/// \file9/// This file provides the basic framework for Telemetry.10/// Refer to its documentation at llvm/docs/Telemetry.rst for more details.11//===---------------------------------------------------------------------===//1213#include "llvm/Telemetry/Telemetry.h"1415namespace llvm {16namespace telemetry {1718void TelemetryInfo::serialize(Serializer &serializer) const {19serializer.write("SessionId", SessionId);20}2122Error Manager::dispatch(TelemetryInfo *Entry) {23assert(Config::BuildTimeEnableTelemetry &&24"Telemetry should have been enabled");25if (Error Err = preDispatch(Entry))26return Err;2728Error AllErrs = Error::success();29for (auto &Dest : Destinations) {30AllErrs = joinErrors(std::move(AllErrs), Dest->receiveEntry(Entry));31}32return AllErrs;33}3435void Manager::addDestination(std::unique_ptr<Destination> Dest) {36Destinations.push_back(std::move(Dest));37}3839Error Manager::preDispatch(TelemetryInfo *Entry) { return Error::success(); }4041} // namespace telemetry42} // namespace llvm434445