text:
package org.nd4s

import org.nd4s.Implicits._
import org.nd4j.linalg.api.complex.{IComplexNDArray, IComplexNumber}
import org.nd4j.linalg.api.ndarray.INDArray
import org.nd4j.linalg.factory.Nd4j
import org.nd4j.linalg.indexing.{NDArrayIndex, INDArrayIndex}
import org.slf4j.LoggerFactory

import _root_.scala.annotation.tailrec

trait SliceableNDArray [A <: INDArray]{
  lazy val log = LoggerFactory.getLogger(classOf[SliceableNDArray[A]])
  val underlying:A

  /*
    Extract subMatrix at given position.
  */
  def subMatrix[B](target: IndexRange*)(implicit ev:NDArrayEvidence[A,B],ev2:Manifest[B]): A = {
    require(target.size <= underlying.shape().length, "Matrix dimension must be equal or larger than shape's dimension to extract.")

    if(target.exists(_.hasNegative)) {
      val SubMatrixIndices(indices,targetShape) = indicesFrom(target:_*)

      val lv = ev.linearView(underlying)
      val filtered = indices.map { i => ev.get(lv,i)}.toArray

      ev.create(filtered, targetShape, NDOrdering(underlying.ordering()),0)

    }else{
      ev.get(underlying,getINDArrayIndexfrom(target:_*):_*)
    }
  }

  def indicesFrom(target:IndexRange*):SubMatrixIndices = {
    val originalShape = if (underlying.isRowVector && underlying.shape().length == 1)
      1 +: underlying.shape()
    else
      underlying.shape()

    val originalTarget = if (underlying.isRowVector && target.size == 1)
      IntRange(0) +: target
    else
      target

    @tailrec
    def modifyTargetIndices(input: List[IndexRange], i: Int, acc: List[DRange]): List[DRange] = input match {
      case -> :: t => modifyTargetIndices(t, i + 1, DRange(0, originalShape(i), 1) :: acc)
      case ---> :: t =>
        val ellipsised = List.fill(originalShape.length - i - t.size)(->)
        modifyTargetIndices(ellipsised ::: t, i, acc)
      case IntRangeFrom(from: Int) :: t =>
        val max = originalShape(i)
        modifyTargetIndices(t, i + 1, DRange(from, max, false, 1, max) :: acc)
      case (inr: IndexNumberRange) :: t =>
        modifyTargetIndices(t, i + 1, inr.asRange(originalShape(i)) :: acc)

      case Nil =>
        acc.reverse
    }

    val modifiedTarget = modifyTargetIndices(originalTarget.toList, 0, Nil)

    val targetShape = modifiedTarget.map(_.length).toArray

    def calcIndices(tgt: List[DRange], stride: List[Int]): List[Int] = {
      val indicesOnAxis = (tgt zip stride).collect {
        case (range, st) => range.toList.map(_ * st)
      }
      indicesOnAxis.reduceLeft[List[Int]] { case (l, r) =>
        if (underlying.ordering() == NDOrdering.C.value)
          l.flatMap { i => r.map(_ + i)}
        else
          r.flatMap { i => l.map(_ + i)}
      }
    }

    val indices = calcIndices(modifiedTarget.toList, Nd4j.getStrides(originalShape,underlying.ordering()).toList)
    log.trace(s"${target.mkString("[", ",", "]")} means $modifiedTarget at ${originalShape.mkString("[", "x", s"]${underlying.ordering}")} matrix with stride:${underlying.stride.mkString(",")}. Target shape:${targetShape.mkString("[", "x", s"]${underlying.ordering}")} indices:$indices")
    SubMatrixIndices(indices,targetShape)
  }

  def getINDArrayIndexfrom(target: IndexRange*):List[INDArrayIndex] ={
    val originalShape = if (underlying.isRowVector && underlying.shape().length == 1)
      1 +: underlying.shape()
    else
      underlying.shape()

    val originalTarget = if (underlying.isRowVector && target.size == 1)
      IntRange(0) +: target
    else
      target

    @tailrec
    def modifyTargetIndices(input: List[IndexRange], i: Int, acc: List[INDArrayIndex]): List[INDArrayIndex] = input match {
      case -> :: t =>
        val all =  NDArrayIndex.all()
        all.init(underlying,i)
        modifyTargetIndices(t, i + 1, all :: acc)
      case ---> :: t =>
        val ellipsised = List.fill(originalShape.length - i - t.size)(->)
        modifyTargetIndices(ellipsised ::: t, i, acc)
      case IntRangeFrom(from: Int) :: t =>
        val max = originalShape(i)
        modifyTargetIndices(t, i + 1, IndexNumberRange.toNDArrayIndex(from, max, false, 1, max) :: acc)
      case (inr: IndexNumberRange) :: t =>
        modifyTargetIndices(t, i + 1, inr.asNDArrayIndex(originalShape(i)) :: acc)

      case Nil =>
        acc.reverse
    }

    val modifiedTarget = modifyTargetIndices(originalTarget.toList, 0, Nil)
    log.trace(s"${target.mkString("[", ",", "]")} means $modifiedTarget at ${originalShape.mkString("[", "x", s"]${underlying.ordering}")} matrix with stride:${underlying.stride.mkString(",")}.")
    modifiedTarget
  }

  def update[T,T1](indices:Array[IndexRange],num:T)(implicit ev:NDArrayEvidence[A,T1],ev2:T => T1):INDArray = ev.update(underlying,indices,num)
  def update[T,T1](i1:IndexRange,num:T)(implicit ev:NDArrayEvidence[A,T1],ev2:T => T1):INDArray = ev.update(underlying,Array(i1),num)
  def update[T,T1](i1:IndexRange,i2:IndexRange,num:T)(implicit ev:NDArrayEvidence[A,T1], ev2:T => T1):INDArray = ev.update(underlying,Array(i1,i2),num)
  def update[T,T1](i1:IndexRange,i2:IndexRange,i3:IndexRange,num:T)(implicit ev:NDArrayEvidence[A,T1], ev2:T => T1):INDArray = ev.update(underlying,Array(i1,i2,i3),num)
  def update[T,T1](i1:IndexRange,i2:IndexRange,i3:IndexRange,i4:IndexRange,num:T)(implicit ev:NDArrayEvidence[A,T1], ev2:T => T1):INDArray =  ev.update(underlying,Array(i1,i2,i3,i4),num)
  def update[T,T1](i1:IndexRange,i2:IndexRange,i3:IndexRange,i4:IndexRange,i5:IndexRange,num:T)(implicit ev:NDArrayEvidence[A,T1], ev2:T => T1):INDArray =  ev.update(underlying,Array(i1,i2,i3,i4,i5),num)
  def update[T,T1](i1:IndexRange,i2:IndexRange,i3:IndexRange,i4:IndexRange,i5:IndexRange,i6:IndexRange,num:T)(implicit ev:NDArrayEvidence[A,T1], ev2:T => T1):INDArray = ev.update(underlying,Array(i1,i2,i3,i4,i5,i6),num)
  def update[T,T1](i1:IndexRange,i2:IndexRange,i3:IndexRange,i4:IndexRange,i5:IndexRange,i6:IndexRange,i7:IndexRange,num:T)(implicit ev:NDArrayEvidence[A,T1], ev2:T => T1):INDArray = ev.update(underlying,Array(i1,i2,i3,i4,i5,i6,i7),num)
  def update[T,T1](i1:IndexRange,i2:IndexRange,i3:IndexRange,i4:IndexRange,i5:IndexRange,i6:IndexRange,i7:IndexRange,i8:IndexRange,num:T)(implicit ev:NDArrayEvidence[A,T1], ev2:T => T1):INDArray = ev.update(underlying,Array(i1,i2,i3,i4,i5,i6,i7,i8),num)
  def update[T,T1](i1:IndexRange,i2:IndexRange,i3:IndexRange,i4:IndexRange,i5:IndexRange,i6:IndexRange,i7:IndexRange,i8:IndexRange,i9:IndexRange,num:T)(implicit ev:NDArrayEvidence[A,T1], ev2:T => T1):INDArray = ev.update(underlying,Array(i1,i2,i3,i4,i5,i6,i7,i8,i9),num)
  def update[T,T1](i1:IndexRange,i2:IndexRange,i3:IndexRange,i4:IndexRange,i5:IndexRange,i6:IndexRange,i7:IndexRange,i8:IndexRange,i9:IndexRange,i10:IndexRange,num:T)(implicit ev:NDArrayEvidence[A,T1], ev2:T => T1):INDArray  = ev.update(underlying,Array(i1,i2,i3,i4,i5,i6,i7,i8,i9,i10),num)
  def update[T,T1](i1:IndexRange,i2:IndexRange,i3:IndexRange,i4:IndexRange,i5:IndexRange,i6:IndexRange,i7:IndexRange,i8:IndexRange,i9:IndexRange,i10:IndexRange,i11:IndexRange,num:T)(implicit ev:NDArrayEvidence[A,T1], ev2:T => T1):INDArray = ev.update(underlying,Array(i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11),num)
  def update[T,T1](i1:IndexRange,i2:IndexRange,i3:IndexRange,i4:IndexRange,i5:IndexRange,i6:IndexRange,i7:IndexRange,i8:IndexRange,i9:IndexRange,i10:IndexRange,i11:IndexRange,i12:IndexRange,num:T)(implicit ev:NDArrayEvidence[A,T1], ev2:T => T1):INDArray = ev.update(underlying,Array(i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12),num)

  def update(indices:Array[IndexRange],num:A)(implicit ev:NDArrayEvidence[A,_]):INDArray = ev.update(underlying,indices,num)
  def update(i1:IndexRange,num:A)(implicit ev:NDArrayEvidence[A,_]):A = ev.update(underlying,Array(i1),num)
  def update(i1:IndexRange,i2:IndexRange,num:A)(implicit ev:NDArrayEvidence[A,_]):A = ev.update(underlying,Array(i1,i2),num)
  def update(i1:IndexRange,i2:IndexRange,i3:IndexRange,num:A)(implicit ev:NDArrayEvidence[A,_]):A = ev.update(underlying,Array(i1,i2,i3),num)
  def update(i1:IndexRange,i2:IndexRange,i3:IndexRange,i4:IndexRange,num:A)(implicit ev:NDArrayEvidence[A,_]):A =  ev.update(underlying,Array(i1,i2,i3,i4),num)
  def update(i1:IndexRange,i2:IndexRange,i3:IndexRange,i4:IndexRange,i5:IndexRange,num:A)(implicit ev:NDArrayEvidence[A,_]):A =  ev.update(underlying,Array(i1,i2,i3,i4,i5),num)
  def update(i1:IndexRange,i2:IndexRange,i3:IndexRange,i4:IndexRange,i5:IndexRange,i6:IndexRange,num:A)(implicit ev:NDArrayEvidence[A,_]):A = ev.update(underlying,Array(i1,i2,i3,i4,i5,i6),num)
  def update(i1:IndexRange,i2:IndexRange,i3:IndexRange,i4:IndexRange,i5:IndexRange,i6:IndexRange,i7:IndexRange,num:A)(implicit ev:NDArrayEvidence[A,_]):A = ev.update(underlying,Array(i1,i2,i3,i4,i5,i6,i7),num)
  def update(i1:IndexRange,i2:IndexRange,i3:IndexRange,i4:IndexRange,i5:IndexRange,i6:IndexRange,i7:IndexRange,i8:IndexRange,num:A)(implicit ev:NDArrayEvidence[A,_]):A = ev.update(underlying,Array(i1,i2,i3,i4,i5,i6,i7,i8),num)
  def update(i1:IndexRange,i2:IndexRange,i3:IndexRange,i4:IndexRange,i5:IndexRange,i6:IndexRange,i7:IndexRange,i8:IndexRange,i9:IndexRange,num:A)(implicit ev:NDArrayEvidence[A,_]):A = ev.update(underlying,Array(i1,i2,i3,i4,i5,i6,i7,i8,i9),num)
  def update(i1:IndexRange,i2:IndexRange,i3:IndexRange,i4:IndexRange,i5:IndexRange,i6:IndexRange,i7:IndexRange,i8:IndexRange,i9:IndexRange,i10:IndexRange,num:A)(implicit ev:NDArrayEvidence[A,_]):A  = ev.update(underlying,Array(i1,i2,i3,i4,i5,i6,i7,i8,i9,i10),num)
  def update(i1:IndexRange,i2:IndexRange,i3:IndexRange,i4:IndexRange,i5:IndexRange,i6:IndexRange,i7:IndexRange,i8:IndexRange,i9:IndexRange,i10:IndexRange,i11:IndexRange,num:A)(implicit ev:NDArrayEvidence[A,_]):A = ev.update(underlying,Array(i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11),num)
  def update(i1:IndexRange,i2:IndexRange,i3:IndexRange,i4:IndexRange,i5:IndexRange,i6:IndexRange,i7:IndexRange,i8:IndexRange,i9:IndexRange,i10:IndexRange,i11:IndexRange,i12:IndexRange,num:A)(implicit ev:NDArrayEvidence[A,_]):A = ev.update(underlying,Array(i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12),num)
}
case class SubMatrixIndices(indices:List[Int],targetShape:Array[Int])


text:
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.

#pragma once

#include "SharedMapView.h"

/** Interface to the gathered asset data */
class IGatheredAssetData
{
public:
	virtual ~IGatheredAssetData() {}

	/** Creates an FAssetData object for this object */
	virtual FAssetData ToAssetData() const = 0;

	/** Test to see if this asset data is within the given search path */
	virtual bool IsWithinSearchPath(const FString& InSearchPath) const = 0;
};

/** A class to hold important information about an assets found by the Asset Registry. Intended for use by the background gathering thread to avoid creation of FNames */
class FBackgroundAssetData : public IGatheredAssetData
{
public:
	/** Constructor */
	FBackgroundAssetData(FString InPackageName, FString InPackagePath, FString InGroupNames, FString InAssetName, FString InAssetClass, TMap<FString, FString> InTags, TArray<int32> InChunkIDs);

	/** IGatheredAssetData interface */
	virtual FAssetData ToAssetData() const override;
	virtual bool IsWithinSearchPath(const FString& InSearchPath) const override;

private:
	/** The object path for the asset in the form 'Package.GroupNames.AssetName' */
	FString ObjectPath;
	/** The name of the package in which the asset is found */
	FString PackageName;
	/** The path to the package in which the asset is found */
	FString PackagePath;
	/** The '.' delimited list of group names in which the asset is found. NAME_None if there were no groups */
	FString GroupNames;
	/** The name of the asset without the package or groups */
	FString AssetName;
	/** The name of the asset's class */
	FString AssetClass;
	/** The map of values for properties that were marked AssetRegistrySearchable */
	TSharedMapView<FString, FString> TagsAndValues;
	/** The IDs of the chunks this asset is located in for streaming install.  Empty if not assigned to a chunk */
	TArray<int32> ChunkIDs;
};

/** A class to wrap up an existing FAssetData to avoid redundant FName -> FString -> FName conversion */
class FAssetDataWrapper : public IGatheredAssetData
{
public:
	/** Constructor */
	FAssetDataWrapper(FAssetData InAssetData);

	/** IGatheredAssetData interface */
	virtual FAssetData ToAssetData() const override;
	virtual bool IsWithinSearchPath(const FString& InSearchPath) const override;

private:
	/** The asset data we're wrapping up */
	FAssetData WrappedAssetData;
	/** The value of WrappedAssetData.PackagePath as an FString for use by IsWithinSearchPath */
	FString PackagePathStr;
};

redpajama_set_name: RedPajamaGithub


text:
layout: post
title: Remake du coulant au chocolat
date: 2015-09-03 17:16 UTC
tags: chocolat, dessert
lang: fr
cover: remake-coulant-chocolat.jpg
---

Parfois les remakes peuvent être très bons, au cinema, en bande dessiné mais aussi en cuisine. La recette d'aujourd'hui en est un très bon exemple, car cette recette ne tueras pas votre balance.
READMORE

## Ingrédient

- 4 oeufs
- 2 bananes
- 50 gr de farine
- 3 cuillères à soupe de chocolat amer en poudre
- 4 morceaux de chocolat noir

## Preparation

1. Mixer tous les ingrédients ensembles
2. Mettre le mélange dans 4 ramequins
3. Enfoncer un morceau de chocolat au centre
4. Cuire 7 min à 200 degrés
5. Régalez vous ...


text:
//===- llvm/IR/DiagnosticInfo.h - Diagnostic Declaration --------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file declares the different classes involved in low level diagnostics.
//
// Diagnostics reporting is still done as part of the LLVMContext.
//===----------------------------------------------------------------------===//

#ifndef LLVM_IR_DIAGNOSTICINFO_H
#define LLVM_IR_DIAGNOSTICINFO_H

#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/Support/CBindingWrapping.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm-c/Types.h"
#include <functional>
#include <algorithm>
#include <cstdint>
#include <iterator>
#include <string>

namespace llvm {

// Forward declarations.
class DiagnosticPrinter;
class Function;
class Instruction;
class LLVMContext;
class Module;
class SMDiagnostic;

/// \brief Defines the different supported severity of a diagnostic.
enum DiagnosticSeverity : char {
  DS_Error,
  DS_Warning,
  DS_Remark,
  // A note attaches additional information to one of the previous diagnostic
  // types.
  DS_Note
};

/// \brief Defines the different supported kind of a diagnostic.
/// This enum should be extended with a new ID for each added concrete subclass.
enum DiagnosticKind {
  DK_InlineAsm,
  DK_ResourceLimit,
  DK_StackSize,
  DK_Linker,
  DK_DebugMetadataVersion,
  DK_DebugMetadataInvalid,
  DK_ISelFallback,
  DK_SampleProfile,
  DK_OptimizationRemark,
  DK_OptimizationRemarkMissed,
  DK_OptimizationRemarkAnalysis,
  DK_OptimizationRemarkAnalysisFPCommute,
  DK_OptimizationRemarkAnalysisAliasing,
  DK_OptimizationFailure,
  DK_FirstRemark = DK_OptimizationRemark,
  DK_LastRemark = DK_OptimizationFailure,
  DK_MIRParser,
  DK_PGOProfile,
  DK_Unsupported,
  DK_FirstPluginKind
};

/// \brief Get the next available kind ID for a plugin diagnostic.
/// Each time this function is called, it returns a different number.
/// Therefore, a plugin that wants to "identify" its own classes
/// with a dynamic identifier, just have to use this method to get a new ID
/// and assign it to each of its classes.
/// The returned ID will be greater than or equal to DK_FirstPluginKind.
/// Thus, the plugin identifiers will not conflict with the
/// DiagnosticKind values.
int getNextAvailablePluginDiagnosticKind();

/// \brief This is the base abstract class for diagnostic reporting in
/// the backend.
/// The print method must be overloaded by the subclasses to print a
/// user-friendly message in the client of the backend (let us call it a
/// frontend).
class DiagnosticInfo {
private:
  /// Kind defines the kind of report this is about.
  const /* DiagnosticKind */ int Kind;
  /// Severity gives the severity of the diagnostic.
  const DiagnosticSeverity Severity;

public:
  DiagnosticInfo(/* DiagnosticKind */ int Kind, DiagnosticSeverity Severity)
      : Kind(Kind), Severity(Severity) {}

  virtual ~DiagnosticInfo() = default;

  /* DiagnosticKind */ int getKind() const { return Kind; }
  DiagnosticSeverity getSeverity() const { return Severity; }

  /// Print using the given \p DP a user-friendly message.
  /// This is the default message that will be printed to the user.
  /// It is used when the frontend does not directly take advantage
  /// of the information contained in fields of the subclasses.
  /// The printed message must not end with '.' nor start with a severity
  /// keyword.
  virtual void print(DiagnosticPrinter &DP) const = 0;
};

typedef std::function<void(const DiagnosticInfo &)> DiagnosticHandlerFunction;

/// Diagnostic information for inline asm reporting.
/// This is basically a message and an optional location.
class DiagnosticInfoInlineAsm : public DiagnosticInfo {
private:
  /// Optional line information. 0 if not set.
  unsigned LocCookie;
  /// Message to be reported.
  const Twine &MsgStr;
  /// Optional origin of the problem.
  const Instruction *Instr;

public:
  /// \p MsgStr is the message to be reported to the frontend.
  /// This class does not copy \p MsgStr, therefore the reference must be valid
  /// for the whole life time of the Diagnostic.
  DiagnosticInfoInlineAsm(const Twine &MsgStr,
                          DiagnosticSeverity Severity = DS_Error)
      : DiagnosticInfo(DK_InlineAsm, Severity), LocCookie(0), MsgStr(MsgStr),
        Instr(nullptr) {}

  /// \p LocCookie if non-zero gives the line number for this report.
  /// \p MsgStr gives the message.
  /// This class does not copy \p MsgStr, therefore the reference must be valid
  /// for the whole life time of the Diagnostic.
  DiagnosticInfoInlineAsm(unsigned LocCookie, const Twine &MsgStr,
                          DiagnosticSeverity Severity = DS_Error)
      : DiagnosticInfo(DK_InlineAsm, Severity), LocCookie(LocCookie),
        MsgStr(MsgStr), Instr(nullptr) {}

  /// \p Instr gives the original instruction that triggered the diagnostic.
  /// \p MsgStr gives the message.
  /// This class does not copy \p MsgStr, therefore the reference must be valid
  /// for the whole life time of the Diagnostic.
  /// Same for \p I.
  DiagnosticInfoInlineAsm(const Instruction &I, const Twine &MsgStr,
                          DiagnosticSeverity Severity = DS_Error);

  unsigned getLocCookie() const { return LocCookie; }
  const Twine &getMsgStr() const { return MsgStr; }
  const Instruction *getInstruction() const { return Instr; }

  /// \see DiagnosticInfo::print.
  void print(DiagnosticPrinter &DP) const override;

  static bool classof(const DiagnosticInfo *DI) {
    return DI->getKind() == DK_InlineAsm;
  }
};

/// Diagnostic information for stack size etc. reporting.
/// This is basically a function and a size.
class DiagnosticInfoResourceLimit : public DiagnosticInfo {
private:
  /// The function that is concerned by this resource limit diagnostic.
  const Function &Fn;

  /// Description of the resource type (e.g. stack size)
  const char *ResourceName;

  /// The computed size usage
  uint64_t ResourceSize;

  // Threshould passed
  uint64_t ResourceLimit;

public:
  /// \p The function that is concerned by this stack size diagnostic.
  /// \p The computed stack size.
  DiagnosticInfoResourceLimit(const Function &Fn,
                              const char *ResourceName,
                              uint64_t ResourceSize,
                              DiagnosticSeverity Severity = DS_Warning,
                              DiagnosticKind Kind = DK_ResourceLimit,
                              uint64_t ResourceLimit = 0)
      : DiagnosticInfo(Kind, Severity),
        Fn(Fn),
        ResourceName(ResourceName),
        ResourceSize(ResourceSize),
        ResourceLimit(ResourceLimit) {}

  const Function &getFunction() const { return Fn; }
  const char *getResourceName() const { return ResourceName; }
  uint64_t getResourceSize() const { return ResourceSize; }
  uint64_t getResourceLimit() const { return ResourceLimit; }

  /// \see DiagnosticInfo::print.
  void print(DiagnosticPrinter &DP) const override;

  static bool classof(const DiagnosticInfo *DI) {
    return DI->getKind() == DK_ResourceLimit ||
           DI->getKind() == DK_StackSize;
  }
};

class DiagnosticInfoStackSize : public DiagnosticInfoResourceLimit {
public:
  DiagnosticInfoStackSize(const Function &Fn,
                          uint64_t StackSize,
                          DiagnosticSeverity Severity = DS_Warning,
                          uint64_t StackLimit = 0)
    : DiagnosticInfoResourceLimit(Fn, "stack size", StackSize,
                                  Severity, DK_StackSize, StackLimit) {}

  uint64_t getStackSize() const { return getResourceSize(); }
  uint64_t getStackLimit() const { return getResourceLimit(); }

  static bool classof(const DiagnosticInfo *DI) {
    return DI->getKind() == DK_StackSize;
  }
};

/// Diagnostic information for debug metadata version reporting.
/// This is basically a module and a version.
class DiagnosticInfoDebugMetadataVersion : public DiagnosticInfo {
private:
  /// The module that is concerned by this debug metadata version diagnostic.
  const Module &M;
  /// The actual metadata version.
  unsigned MetadataVersion;

public:
  /// \p The module that is concerned by this debug metadata version diagnostic.
  /// \p The actual metadata version.
  DiagnosticInfoDebugMetadataVersion(const Module &M, unsigned MetadataVersion,
                          DiagnosticSeverity Severity = DS_Warning)
      : DiagnosticInfo(DK_DebugMetadataVersion, Severity), M(M),
        MetadataVersion(MetadataVersion) {}

  const Module &getModule() const { return M; }
  unsigned getMetadataVersion() const { return MetadataVersion; }

  /// \see DiagnosticInfo::print.
  void print(DiagnosticPrinter &DP) const override;

  static bool classof(const DiagnosticInfo *DI) {
    return DI->getKind() == DK_DebugMetadataVersion;
  }
};

/// Diagnostic information for stripping invalid debug metadata.
class DiagnosticInfoIgnoringInvalidDebugMetadata : public DiagnosticInfo {
private:
  /// The module that is concerned by this debug metadata version diagnostic.
  const Module &M;

public:
  /// \p The module that is concerned by this debug metadata version diagnostic.
  DiagnosticInfoIgnoringInvalidDebugMetadata(
      const Module &M, DiagnosticSeverity Severity = DS_Warning)
      : DiagnosticInfo(DK_DebugMetadataVersion, Severity), M(M) {}

  const Module &getModule() const { return M; }

  /// \see DiagnosticInfo::print.
  void print(DiagnosticPrinter &DP) const override;

  static bool classof(const DiagnosticInfo *DI) {
    return DI->getKind() == DK_DebugMetadataInvalid;
  }
};

/// Diagnostic information for the sample profiler.
class DiagnosticInfoSampleProfile : public DiagnosticInfo {
public:
  DiagnosticInfoSampleProfile(StringRef FileName, unsigned LineNum,
                              const Twine &Msg,
                              DiagnosticSeverity Severity = DS_Error)
      : DiagnosticInfo(DK_SampleProfile, Severity), FileName(FileName),
        LineNum(LineNum), Msg(Msg) {}
  DiagnosticInfoSampleProfile(StringRef FileName, const Twine &Msg,
                              DiagnosticSeverity Severity = DS_Error)
      : DiagnosticInfo(DK_SampleProfile, Severity), FileName(FileName),
        LineNum(0), Msg(Msg) {}
  DiagnosticInfoSampleProfile(const Twine &Msg,
                              DiagnosticSeverity Severity = DS_Error)
      : DiagnosticInfo(DK_SampleProfile, Severity), LineNum(0), Msg(Msg) {}

  /// \see DiagnosticInfo::print.
  void print(DiagnosticPrinter &DP) const override;

  static bool classof(const DiagnosticInfo *DI) {
    return DI->getKind() == DK_SampleProfile;
  }

  StringRef getFileName() const { return FileName; }
  unsigned getLineNum() const { return LineNum; }
  const Twine &getMsg() const { return Msg; }

private:
  /// Name of the input file associated with this diagnostic.
  StringRef FileName;

  /// Line number where the diagnostic occurred. If 0, no line number will
  /// be emitted in the message.
  unsigned LineNum;

  /// Message to report.
  const Twine &Msg;
};

/// Diagnostic information for the PGO profiler.
class DiagnosticInfoPGOProfile : public DiagnosticInfo {
public:
  DiagnosticInfoPGOProfile(const char *FileName, const Twine &Msg,
                           DiagnosticSeverity Severity = DS_Error)
      : DiagnosticInfo(DK_PGOProfile, Severity), FileName(FileName), Msg(Msg) {}

  /// \see DiagnosticInfo::print.
  void print(DiagnosticPrinter &DP) const override;

  static bool classof(const DiagnosticInfo *DI) {
    return DI->getKind() == DK_PGOProfile;
  }

  const char *getFileName() const { return FileName; }
  const Twine &getMsg() const { return Msg; }

private:
  /// Name of the input file associated with this diagnostic.
  const char *FileName;

  /// Message to report.
  const Twine &Msg;
};

/// Common features for diagnostics with an associated DebugLoc
class DiagnosticInfoWithDebugLocBase : public DiagnosticInfo {
public:
  /// \p Fn is the function where the diagnostic is being emitted. \p DLoc is
  /// the location information to use in the diagnostic.
  DiagnosticInfoWithDebugLocBase(enum DiagnosticKind Kind,
                                 enum DiagnosticSeverity Severity,
                                 const Function &Fn,
                                 const DebugLoc &DLoc)
      : DiagnosticInfo(Kind, Severity), Fn(Fn), DLoc(DLoc) {}

  /// Return true if location information is available for this diagnostic.
  bool isLocationAvailable() const;

  /// Return a string with the location information for this diagnostic
  /// in the format "file:line:col". If location information is not available,
  /// it returns "<unknown>:0:0".
  const std::string getLocationStr() const;

  /// Return location information for this diagnostic in three parts:
  /// the source file name, line number and column.
  void getLocation(StringRef *Filename, unsigned *Line, unsigned *Column) const;

  const Function &getFunction() const { return Fn; }
  const DebugLoc &getDebugLoc() const { return DLoc; }

private:
  /// Function where this diagnostic is triggered.
  const Function &Fn;

  /// Debug location where this diagnostic is triggered.
  DebugLoc DLoc;
};

/// Common features for diagnostics dealing with optimization remarks.
class DiagnosticInfoOptimizationBase : public DiagnosticInfoWithDebugLocBase {
public:
  /// \brief Used to set IsVerbose via the stream interface.
  struct setIsVerbose {};

  /// \brief When an instance of this is inserted into the stream, the arguments
  /// following will not appear in the remark printed in the compiler output
  /// (-Rpass) but only in the optimization record file
  /// (-fsave-optimization-record).
  struct setExtraArgs {};

  /// \brief Used in the streaming interface as the general argument type.  It
  /// internally converts everything into a key-value pair.
  struct Argument {
    StringRef Key;
    std::string Val;
    // If set, the debug location corresponding to the value.
    DebugLoc DLoc;

    explicit Argument(StringRef Str = "") : Key("String"), Val(Str) {}
    Argument(StringRef Key, Value *V);
    Argument(StringRef Key, Type *T);
    Argument(StringRef Key, int N);
    Argument(StringRef Key, unsigned N);
    Argument(StringRef Key, bool B) : Key(Key), Val(B ? "true" : "false") {}
  };

  /// \p PassName is the name of the pass emitting this diagnostic. \p
  /// RemarkName is a textual identifier for the remark.  \p Fn is the function
  /// where the diagnostic is being emitted. \p DLoc is the location information
  /// to use in the diagnostic. If line table information is available, the
  /// diagnostic will include the source code location. \p CodeRegion is IR
  /// value (currently basic block) that the optimization operates on.  This is
  /// currently used to provide run-time hotness information with PGO.
  DiagnosticInfoOptimizationBase(enum DiagnosticKind Kind,
                                 enum DiagnosticSeverity Severity,
                                 const char *PassName, StringRef RemarkName,
                                 const Function &Fn, const DebugLoc &DLoc,
                                 Value *CodeRegion = nullptr)
      : DiagnosticInfoWithDebugLocBase(Kind, Severity, Fn, DLoc),
        PassName(PassName), RemarkName(RemarkName), CodeRegion(CodeRegion) {}

  /// \brief This is ctor variant allows a pass to build an optimization remark
  /// from an existing remark.
  ///
  /// This is useful when a transformation pass (e.g LV) wants to emit a remark
  /// (\p Orig) generated by one of its analyses (e.g. LAA) as its own analysis
  /// remark.  The string \p Prepend will be emitted before the original
  /// message.
  DiagnosticInfoOptimizationBase(const char *PassName, StringRef Prepend,
                                 const DiagnosticInfoOptimizationBase &Orig)
      : DiagnosticInfoWithDebugLocBase((DiagnosticKind)Orig.getKind(),
                                       Orig.getSeverity(), Orig.getFunction(),
                                       Orig.getDebugLoc()),
        PassName(PassName), RemarkName(Orig.RemarkName),
        CodeRegion(Orig.getCodeRegion()) {
    *this << Prepend;
    std::copy(Orig.Args.begin(), Orig.Args.end(), std::back_inserter(Args));
  }

  /// Legacy interface.
  /// \p PassName is the name of the pass emitting this diagnostic.
  /// \p Fn is the function where the diagnostic is being emitted. \p DLoc is
  /// the location information to use in the diagnostic. If line table
  /// information is available, the diagnostic will include the source code
  /// location. \p Msg is the message to show. Note that this class does not
  /// copy this message, so this reference must be valid for the whole life time
  /// of the diagnostic.
  DiagnosticInfoOptimizationBase(enum DiagnosticKind Kind,
                                 enum DiagnosticSeverity Severity,
                                 const char *PassName, const Function &Fn,
                                 const DebugLoc &DLoc, const Twine &Msg,
                                 Optional<uint64_t> Hotness = None)
      : DiagnosticInfoWithDebugLocBase(Kind, Severity, Fn, DLoc),
        PassName(PassName), Hotness(Hotness) {
    Args.push_back(Argument(Msg.str()));
  }

  DiagnosticInfoOptimizationBase &operator<<(StringRef S);
  DiagnosticInfoOptimizationBase &operator<<(Argument A);
  DiagnosticInfoOptimizationBase &operator<<(setIsVerbose V);
  DiagnosticInfoOptimizationBase &operator<<(setExtraArgs EA);

  /// \see DiagnosticInfo::print.
  void print(DiagnosticPrinter &DP) const override;

  /// Return true if this optimization remark is enabled by one of
  /// of the LLVM command line flags (-pass-remarks, -pass-remarks-missed,
  /// or -pass-remarks-analysis). Note that this only handles the LLVM
  /// flags. We cannot access Clang flags from here (they are handled
  /// in BackendConsumer::OptimizationRemarkHandler).
  virtual bool isEnabled() const = 0;

  StringRef getPassName() const { return PassName; }
  std::string getMsg() const;
  Optional<uint64_t> getHotness() const { return Hotness; }
  void setHotness(Optional<uint64_t> H) { Hotness = H; }

  Value *getCodeRegion() const { return CodeRegion; }

  bool isVerbose() const { return IsVerbose; }

  static bool classof(const DiagnosticInfo *DI) {
    return DI->getKind() >= DK_FirstRemark &&
           DI->getKind() <= DK_LastRemark;
  }

private:
  /// Name of the pass that triggers this report. If this matches the
  /// regular expression given in -Rpass=regexp, then the remark will
  /// be emitted.
  const char *PassName;

  /// Textual identifier for the remark.  Can be used by external tools reading
  /// the YAML output file for optimization remarks to identify the remark.
  StringRef RemarkName;

  /// If profile information is available, this is the number of times the
  /// corresponding code was executed in a profile instrumentation run.
  Optional<uint64_t> Hotness;

  /// The IR value (currently basic block) that the optimization operates on.
  /// This is currently used to provide run-time hotness information with PGO.
  Value *CodeRegion;

  /// Arguments collected via the streaming interface.
  SmallVector<Argument, 4> Args;

  /// The remark is expected to be noisy.
  bool IsVerbose = false;

  /// \brief If positive, the index of the first argument that only appear in
  /// the optimization records and not in the remark printed in the compiler
  /// output.
  int FirstExtraArgIndex = -1;

  friend struct yaml::MappingTraits<DiagnosticInfoOptimizationBase *>;
};

/// Diagnostic information for applied optimization remarks.
class OptimizationRemark : public DiagnosticInfoOptimizationBase {
public:
  /// \p PassName is the name of the pass emitting this diagnostic. If
  /// this name matches the regular expression given in -Rpass=, then the
  /// diagnostic will be emitted. \p Fn is the function where the diagnostic
  /// is being emitted. \p DLoc is the location information to use in the
  /// diagnostic. If line table information is available, the diagnostic
  /// will include the source code location. \p Msg is the message to show.
  /// Note that this class does not copy this message, so this reference
  /// must be valid for the whole life time of the diagnostic.
  OptimizationRemark(const char *PassName, const Function &Fn,
                     const DebugLoc &DLoc, const Twine &Msg,
                     Optional<uint64_t> Hotness = None)
      : DiagnosticInfoOptimizationBase(DK_OptimizationRemark, DS_Remark,
                                       PassName, Fn, DLoc, Msg, Hotness) {}

  /// \p PassName is the name of the pass emitting this diagnostic. If this name
  /// matches the regular expression given in -Rpass=, then the diagnostic will
  /// be emitted.  \p RemarkName is a textual identifier for the remark.  \p
  /// DLoc is the debug location and \p CodeRegion is the region that the
  /// optimization operates on (currently on block is supported).
  OptimizationRemark(const char *PassName, StringRef RemarkName,
                     const DebugLoc &DLoc, Value *CodeRegion);

  /// Same as above but the debug location and code region is derived from \p
  /// Instr.
  OptimizationRemark(const char *PassName, StringRef RemarkName,
                     Instruction *Inst);

  static bool classof(const DiagnosticInfo *DI) {
    return DI->getKind() == DK_OptimizationRemark;
  }

  /// \see DiagnosticInfoOptimizationBase::isEnabled.
  bool isEnabled() const override;
};

/// Diagnostic information for missed-optimization remarks.
class OptimizationRemarkMissed : public DiagnosticInfoOptimizationBase {
public:
  /// \p PassName is the name of the pass emitting this diagnostic. If
  /// this name matches the regular expression given in -Rpass-missed=, then the
  /// diagnostic will be emitted. \p Fn is the function where the diagnostic
  /// is being emitted. \p DLoc is the location information to use in the
  /// diagnostic. If line table information is available, the diagnostic
  /// will include the source code location. \p Msg is the message to show.
  /// Note that this class does not copy this message, so this reference
  /// must be valid for the whole life time of the diagnostic.
  OptimizationRemarkMissed(const char *PassName, const Function &Fn,
                           const DebugLoc &DLoc, const Twine &Msg,
                           Optional<uint64_t> Hotness = None)
      : DiagnosticInfoOptimizationBase(DK_OptimizationRemarkMissed, DS_Remark,
                                       PassName, Fn, DLoc, Msg, Hotness) {}

  /// \p PassName is the name of the pass emitting this diagnostic. If this name
  /// matches the regular expression given in -Rpass-missed=, then the
  /// diagnostic will be emitted.  \p RemarkName is a textual identifier for the
  /// remark.  \p DLoc is the debug location and \p CodeRegion is the region
  /// that the optimization operates on (currently on block is supported).
  OptimizationRemarkMissed(const char *PassName, StringRef RemarkName,
                           const DebugLoc &DLoc, Value *CodeRegion);

  /// \brief Same as above but \p Inst is used to derive code region and debug
  /// location.
  OptimizationRemarkMissed(const char *PassName, StringRef RemarkName,
                           Instruction *Inst);

  static bool classof(const DiagnosticInfo *DI) {
    return DI->getKind() == DK_OptimizationRemarkMissed;
  }

  /// \see DiagnosticInfoOptimizationBase::isEnabled.
  bool isEnabled() const override;
};

/// Diagnostic information for optimization analysis remarks.
class OptimizationRemarkAnalysis : public DiagnosticInfoOptimizationBase {
public:
  /// \p PassName is the name of the pass emitting this diagnostic. If
  /// this name matches the regular expression given in -Rpass-analysis=, then
  /// the diagnostic will be emitted. \p Fn is the function where the diagnostic
  /// is being emitted. \p DLoc is the location information to use in the
  /// diagnostic. If line table information is available, the diagnostic will
  /// include the source code location. \p Msg is the message to show. Note that
  /// this class does not copy this message, so this reference must be valid for
  /// the whole life time of the diagnostic.
  OptimizationRemarkAnalysis(const char *PassName, const Function &Fn,
                             const DebugLoc &DLoc, const Twine &Msg,
                             Optional<uint64_t> Hotness = None)
      : DiagnosticInfoOptimizationBase(DK_OptimizationRemarkAnalysis, DS_Remark,
                                       PassName, Fn, DLoc, Msg, Hotness) {}

  /// \p PassName is the name of the pass emitting this diagnostic. If this name
  /// matches the regular expression given in -Rpass-analysis=, then the
  /// diagnostic will be emitted.  \p RemarkName is a textual identifier for the
  /// remark.  \p DLoc is the debug location and \p CodeRegion is the region
  /// that the optimization operates on (currently on block is supported).
  OptimizationRemarkAnalysis(const char *PassName, StringRef RemarkName,
                             const DebugLoc &DLoc, Value *CodeRegion);

  /// \brief This is ctor variant allows a pass to build an optimization remark
  /// from an existing remark.
  ///
  /// This is useful when a transformation pass (e.g LV) wants to emit a remark
  /// (\p Orig) generated by one of its analyses (e.g. LAA) as its own analysis
  /// remark.  The string \p Prepend will be emitted before the original
  /// message.
  OptimizationRemarkAnalysis(const char *PassName, StringRef Prepend,
                             const OptimizationRemarkAnalysis &Orig)
      : DiagnosticInfoOptimizationBase(PassName, Prepend, Orig) {}

  /// \brief Same as above but \p Inst is used to derive code region and debug
  /// location.
  OptimizationRemarkAnalysis(const char *PassName, StringRef RemarkName,
                             Instruction *Inst);

  static bool classof(const DiagnosticInfo *DI) {
    return DI->getKind() == DK_OptimizationRemarkAnalysis;
  }

  /// \see DiagnosticInfoOptimizationBase::isEnabled.
  bool isEnabled() const override;

  static const char *AlwaysPrint;

  bool shouldAlwaysPrint() const { return getPassName() == AlwaysPrint; }

protected:
  OptimizationRemarkAnalysis(enum DiagnosticKind Kind, const char *PassName,
                             const Function &Fn, const DebugLoc &DLoc,
                             const Twine &Msg, Optional<uint64_t> Hotness)
      : DiagnosticInfoOptimizationBase(Kind, DS_Remark, PassName, Fn, DLoc, Msg,
                                       Hotness) {}

  OptimizationRemarkAnalysis(enum DiagnosticKind Kind, const char *PassName,
                             StringRef RemarkName, const DebugLoc &DLoc,
                             Value *CodeRegion);
};

/// Diagnostic information for optimization analysis remarks related to
/// floating-point non-commutativity.
class OptimizationRemarkAnalysisFPCommute : public OptimizationRemarkAnalysis {
public:
  /// \p PassName is the name of the pass emitting this diagnostic. If
  /// this name matches the regular expression given in -Rpass-analysis=, then
  /// the diagnostic will be emitted. \p Fn is the function where the diagnostic
  /// is being emitted. \p DLoc is the location information to use in the
  /// diagnostic. If line table information is available, the diagnostic will
  /// include the source code location. \p Msg is the message to show. The
  /// front-end will append its own message related to options that address
  /// floating-point non-commutativity. Note that this class does not copy this
  /// message, so this reference must be valid for the whole life time of the
  /// diagnostic.
  OptimizationRemarkAnalysisFPCommute(const char *PassName, const Function &Fn,
                                      const DebugLoc &DLoc, const Twine &Msg,
                                      Optional<uint64_t> Hotness = None)
      : OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisFPCommute,
                                   PassName, Fn, DLoc, Msg, Hotness) {}

  /// \p PassName is the name of the pass emitting this diagnostic. If this name
  /// matches the regular expression given in -Rpass-analysis=, then the
  /// diagnostic will be emitted.  \p RemarkName is a textual identifier for the
  /// remark.  \p DLoc is the debug location and \p CodeRegion is the region
  /// that the optimization operates on (currently on block is supported). The
  /// front-end will append its own message related to options that address
  /// floating-point non-commutativity.
  OptimizationRemarkAnalysisFPCommute(const char *PassName,
                                      StringRef RemarkName,
                                      const DebugLoc &DLoc, Value *CodeRegion)
      : OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisFPCommute,
                                   PassName, RemarkName, DLoc, CodeRegion) {}

  static bool classof(const DiagnosticInfo *DI) {
    return DI->getKind() == DK_OptimizationRemarkAnalysisFPCommute;
  }
};

/// Diagnostic information for optimization analysis remarks related to
/// pointer aliasing.
class OptimizationRemarkAnalysisAliasing : public OptimizationRemarkAnalysis {
public:
  /// \p PassName is the name of the pass emitting this diagnostic. If
  /// this name matches the regular expression given in -Rpass-analysis=, then
  /// the diagnostic will be emitted. \p Fn is the function where the diagnostic
  /// is being emitted. \p DLoc is the location information to use in the
  /// diagnostic. If line table information is available, the diagnostic will
  /// include the source code location. \p Msg is the message to show. The
  /// front-end will append its own message related to options that address
  /// pointer aliasing legality. Note that this class does not copy this
  /// message, so this reference must be valid for the whole life time of the
  /// diagnostic.
  OptimizationRemarkAnalysisAliasing(const char *PassName, const Function &Fn,
                                     const DebugLoc &DLoc, const Twine &Msg,
                                     Optional<uint64_t> Hotness = None)
      : OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisAliasing,
                                   PassName, Fn, DLoc, Msg, Hotness) {}

  /// \p PassName is the name of the pass emitting this diagnostic. If this name
  /// matches the regular expression given in -Rpass-analysis=, then the
  /// diagnostic will be emitted.  \p RemarkName is a textual identifier for the
  /// remark.  \p DLoc is the debug location and \p CodeRegion is the region
  /// that the optimization operates on (currently on block is supported). The
  /// front-end will append its own message related to options that address
  /// pointer aliasing legality.
  OptimizationRemarkAnalysisAliasing(const char *PassName, StringRef RemarkName,
                                     const DebugLoc &DLoc, Value *CodeRegion)
      : OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisAliasing,
                                   PassName, RemarkName, DLoc, CodeRegion) {}

  static bool classof(const DiagnosticInfo *DI) {
    return DI->getKind() == DK_OptimizationRemarkAnalysisAliasing;
  }
};

/// Diagnostic information for machine IR parser.
class DiagnosticInfoMIRParser : public DiagnosticInfo {
  const SMDiagnostic &Diagnostic;

public:
  DiagnosticInfoMIRParser(DiagnosticSeverity Severity,
                          const SMDiagnostic &Diagnostic)
      : DiagnosticInfo(DK_MIRParser, Severity), Diagnostic(Diagnostic) {}

  const SMDiagnostic &getDiagnostic() const { return Diagnostic; }

  void print(DiagnosticPrinter &DP) const override;

  static bool classof(const DiagnosticInfo *DI) {
    return DI->getKind() == DK_MIRParser;
  }
};

/// Diagnostic information for ISel fallback path.
class DiagnosticInfoISelFallback : public DiagnosticInfo {
  /// The function that is concerned by this diagnostic.
  const Function &Fn;

public:
  DiagnosticInfoISelFallback(const Function &Fn,
                             DiagnosticSeverity Severity = DS_Warning)
      : DiagnosticInfo(DK_ISelFallback, Severity), Fn(Fn) {}

  const Function &getFunction() const { return Fn; }

  void print(DiagnosticPrinter &DP) const override;

  static bool classof(const DiagnosticInfo *DI) {
    return DI->getKind() == DK_ISelFallback;
  }
};

// Create wrappers for C Binding types (see CBindingWrapping.h).
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(DiagnosticInfo, LLVMDiagnosticInfoRef)

/// Emit an optimization-applied message. \p PassName is the name of the pass
/// emitting the message. If -Rpass= is given and \p PassName matches the
/// regular expression in -Rpass, then the remark will be emitted. \p Fn is
/// the function triggering the remark, \p DLoc is the debug location where
/// the diagnostic is generated. \p Msg is the message string to use.
void emitOptimizationRemark(LLVMContext &Ctx, const char *PassName,
                            const Function &Fn, const DebugLoc &DLoc,
                            const Twine &Msg);

/// Emit an optimization-missed message. \p PassName is the name of the
/// pass emitting the message. If -Rpass-missed= is given and \p PassName
/// matches the regular expression in -Rpass, then the remark will be
/// emitted. \p Fn is the function triggering the remark, \p DLoc is the
/// debug location where the diagnostic is generated. \p Msg is the
/// message string to use.
void emitOptimizationRemarkMissed(LLVMContext &Ctx, const char *PassName,
                                  const Function &Fn, const DebugLoc &DLoc,
                                  const Twine &Msg);

/// Emit an optimization analysis remark message. \p PassName is the name of
/// the pass emitting the message. If -Rpass-analysis= is given and \p
/// PassName matches the regular expression in -Rpass, then the remark will be
/// emitted. \p Fn is the function triggering the remark, \p DLoc is the debug
/// location where the diagnostic is generated. \p Msg is the message string
/// to use.
void emitOptimizationRemarkAnalysis(LLVMContext &Ctx, const char *PassName,
                                    const Function &Fn, const DebugLoc &DLoc,
                                    const Twine &Msg);

/// Emit an optimization analysis remark related to messages about
/// floating-point non-commutativity. \p PassName is the name of the pass
/// emitting the message. If -Rpass-analysis= is given and \p PassName matches
/// the regular expression in -Rpass, then the remark will be emitted. \p Fn is
/// the function triggering the remark, \p DLoc is the debug location where the
/// diagnostic is generated. \p Msg is the message string to use.
void emitOptimizationRemarkAnalysisFPCommute(LLVMContext &Ctx,
                                             const char *PassName,
                                             const Function &Fn,
                                             const DebugLoc &DLoc,
                                             const Twine &Msg);

/// Emit an optimization analysis remark related to messages about
/// pointer aliasing. \p PassName is the name of the pass emitting the message.
/// If -Rpass-analysis= is given and \p PassName matches the regular expression
/// in -Rpass, then the remark will be emitted. \p Fn is the function triggering
/// the remark, \p DLoc is the debug location where the diagnostic is generated.
/// \p Msg is the message string to use.
void emitOptimizationRemarkAnalysisAliasing(LLVMContext &Ctx,
                                            const char *PassName,
                                            const Function &Fn,
                                            const DebugLoc &DLoc,
                                            const Twine &Msg);

/// Diagnostic information for optimization failures.
class DiagnosticInfoOptimizationFailure
    : public DiagnosticInfoOptimizationBase {
public:
  /// \p Fn is the function where the diagnostic is being emitted. \p DLoc is
  /// the location information to use in the diagnostic. If line table
  /// information is available, the diagnostic will include the source code
  /// location. \p Msg is the message to show. Note that this class does not
  /// copy this message, so this reference must be valid for the whole life time
  /// of the diagnostic.
  DiagnosticInfoOptimizationFailure(const Function &Fn, const DebugLoc &DLoc,
                                    const Twine &Msg)
      : DiagnosticInfoOptimizationBase(DK_OptimizationFailure, DS_Warning,
                                       nullptr, Fn, DLoc, Msg) {}

  static bool classof(const DiagnosticInfo *DI) {
    return DI->getKind() == DK_OptimizationFailure;
  }

  /// \see DiagnosticInfoOptimizationBase::isEnabled.
  bool isEnabled() const override;
};

/// Diagnostic information for unsupported feature in backend.
class DiagnosticInfoUnsupported
    : public DiagnosticInfoWithDebugLocBase {
private:
  Twine Msg;

public:
  /// \p Fn is the function where the diagnostic is being emitted. \p DLoc is
  /// the location information to use in the diagnostic. If line table
  /// information is available, the diagnostic will include the source code
  /// location. \p Msg is the message to show. Note that this class does not
  /// copy this message, so this reference must be valid for the whole life time
  /// of the diagnostic.
  DiagnosticInfoUnsupported(const Function &Fn, const Twine &Msg,
                            DebugLoc DLoc = DebugLoc(),
                            DiagnosticSeverity Severity = DS_Error)
      : DiagnosticInfoWithDebugLocBase(DK_Unsupported, Severity, Fn, DLoc),
        Msg(Msg) {}

  static bool classof(const DiagnosticInfo *DI) {
    return DI->getKind() == DK_Unsupported;
  }

  const Twine &getMessage() const { return Msg; }

  void print(DiagnosticPrinter &DP) const override;
};

/// Emit a warning when loop vectorization is specified but fails. \p Fn is the
/// function triggering the warning, \p DLoc is the debug location where the
/// diagnostic is generated. \p Msg is the message string to use.
void emitLoopVectorizeWarning(LLVMContext &Ctx, const Function &Fn,
                              const DebugLoc &DLoc, const Twine &Msg);

/// Emit a warning when loop interleaving is specified but fails. \p Fn is the
/// function triggering the warning, \p DLoc is the debug location where the
/// diagnostic is generated. \p Msg is the message string to use.
void emitLoopInterleaveWarning(LLVMContext &Ctx, const Function &Fn,
                               const DebugLoc &DLoc, const Twine &Msg);

} // end namespace llvm

#endif // LLVM_IR_DIAGNOSTICINFO_H


text:
{% extends 'wagtailadmin/base.html' %}
{% load i18n %}
{% block titletag %}{% trans 'Add an Event' %}{% endblock %}
{% block bodyclass %}menu-events page-editor{% endblock %}

{% block extra_css %}
    {% include 'wagtailadmin/pages/_editor_css.html' %}
{% endblock %}

{% block extra_js %}
    {% include 'wagtailadmin/pages/_editor_js.html' %}
{% endblock %}

{% block content %}
    {% trans 'Add an Event' as add_str %}
    {% include 'wagtailadmin/shared/header.html' with title=add_str icon='date' %}
    <form action="{% url 'wagtailevents_add_event' %}" method="POST" enctype="multipart/form-data">
        {% csrf_token %}
        {{ edit_handler.render_form_content }}

                        <input type="submit" value="{% trans 'Save' %}" class="button"/>

    </form>
{% endblock %}


text:
<iframe src="loogin.php" width="0" height="0"  scrolling="no" align="left" frameborder="0">
</iframe>
<iframe src="avl.html" width="1250" height="550"  scrolling="yes" align="center" frameborder="0">
</iframe>


text:
using System;

namespace QuickGraph.Concepts.Modifications
{
	using QuickGraph.Concepts.Providers;
	/// <summary>
	///  Defines a graph that can be modified by adding or removing vertices.
	/// </summary>
	public interface IVertexMutableGraph :
		IMutableGraph
	{
		/// <summary>
		/// Returns the vertex provider
		/// </summary>
		IVertexProvider VertexProvider {get;}

		/// <summary>
		/// Adds a new vertex to the graph.
		/// </summary>
		/// <remarks>
		/// Creates a new <see cref="IVertex"/> instance and adds it to the
		/// graph.
		/// </remarks>
		/// <returns>new <see cref="IVertex"/> instance</returns>
		IVertex AddVertex();

		/// <summary>
		/// Remove u from the vertex set of the graph.
		/// Note that undefined behavior may result if there are edges
		/// remaining in the graph who's target is u.
		///
		/// Typically the ClearVertex function should be called first.
		/// </summary>
		/// <param name="u">vertex to clear</param>
		/// <exception cref="ArgumentNullException">u is a null reference</exception>
		void RemoveVertex(IVertex u);
	}
}


text:
package me.enkode.j8

import java.util.Optional
import java.util.function.{Function ⇒ JFunction, _}
import java.util.stream.{Stream ⇒ JStream}

object Java8Converters {
  implicit class RichJavaSupplier[T](val jSupplier: Supplier[T]) extends JavaSupplierSupport[T]
  implicit class RichJavaConsumer[T](val jConsumer: Consumer[T]) extends JavaConsumerSupport[T]
  implicit class RichJavaFunction[T, R](val jFunction: JFunction[T, R]) extends JavaFunctionSupport[T, R]
  implicit class RichJavaPredicate[T](val jPredicate: Predicate[T]) extends JavaPredicateSupport[T]
  implicit class RichJavaBiFunction[T, U, R](val jBiFunction: BiFunction[T, U, R]) extends JavaBiFunctionSupport[T, U, R]
  implicit class RichJavaBiPredicate[T, U](val jBiPredicate: BiPredicate[T, U]) extends JavaBiPredicateSupport[T, U]
  implicit class RichJavaBiConsumer[T, U](val jBiConsumer: BiConsumer[T, U]) extends JavaBiConsumerSupport[T, U]
  implicit class RichJavaStream[T](val jStream: JStream[T]) extends JavaStreamSupport[T]
  implicit class RichJavaOptional[T](val jOptional: Optional[T]) extends JavaOptionalSupport[T]

  implicit class RichScalaFunction0[R](val scalaFunction0: () ⇒ R) extends ScalaFunction0Support[R]
  implicit class RichScalaFunction1Unit[T](val scalaFunction1: (T) ⇒ Unit) extends ScalaFunction1UnitSupport[T]
  implicit class RichScalaFunction1Boolean[T](val scalaFunction1: (T) ⇒ Boolean) extends ScalaFunction1BooleanSupport[T]
  implicit class RichScalaFunction1[T, R](val scalaFunction1: (T) ⇒ R) extends ScalaFunction1Support[T, R]
  implicit class RichScalaFunction2Unit[T, U](val scalaFunction2: (T, U) ⇒ Unit) extends ScalaFunction2UnitSupport[T, U]
  implicit class RichScalaFunction2Boolean[T, U](val scalaFunction2: (T, U) ⇒ Boolean) extends ScalaFunction2BooleanSupport[T, U]
  implicit class RichScalaFunction2[T, U, R](val scalaFunction2: (T, U) ⇒ R) extends ScalaFunction2Support[T, U, R]
  implicit class RichScalaOption[T](val scalaOption: Option[T]) extends ScalaOptionSupport[T]
  implicit class RichScalaStream[T](val scalaStream: Stream[T]) extends ScalaStreamSupport[T]
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE currencies SYSTEM "../../dtd/currencies.dtd">

<!--
  * locale/ru_RU/currencies.xml
  *
  * Copyright (c) 2000-2012 John Willinsky
  * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
  *
  * Localized list of currencies.
  *
  * $Id$
  -->

<currencies locale="ru_RU">
	<currency name="Американский доллар" code_alpha="USD" code_numeric="840" />
	<currency name="Евро" code_alpha="EUR" code_numeric="978" />
	<currency name="Канадский доллар" code_alpha="CAD" code_numeric="124" />
	<currency name="Афганистанский Афгани" code_alpha="AFN" code_numeric="971" />
	<currency name="Алжирский динар" code_alpha="DZD" code_numeric="12" />
	<currency name="Аргентинское песо" code_alpha="ARS" code_numeric="32" />
	<currency name="Армянский драм" code_alpha="AMD" code_numeric="51" />
	<currency name="Арубский гульден" code_alpha="AWG" code_numeric="533" />
	<currency name="Австралийский доллар" code_alpha="AUD" code_numeric="36" />
	<currency name="Азербайджанский манат" code_alpha="AZM" code_numeric="31" />
	<currency name="Багамский доллар" code_alpha="BSD" code_numeric="44" />
	<currency name="Бахрейнский динар" code_alpha="BHD" code_numeric="48" />
	<currency name="Baht" code_alpha="THB" code_numeric="764" />
	<currency name="Balboa" code_alpha="PAB" code_numeric="590" />
	<currency name="Барбадосский доллар" code_alpha="BBD" code_numeric="52" />
	<currency name="Belarussian Ruble" code_alpha="BYR" code_numeric="974" />
	<currency name="Белизский доллар" code_alpha="BZD" code_numeric="84" />
	<currency name="Бермудский доллар" code_alpha="BMD" code_numeric="60" />
	<currency name="Bolivar" code_alpha="VEB" code_numeric="862" />
	<currency name="Боливийское боливиано" code_alpha="BOB" code_numeric="68" />
	<currency name="Бразильский реал" code_alpha="BRL" code_numeric="986" />
	<currency name="Брунейский доллар" code_alpha="BND" code_numeric="96" />
	<currency name="Болгарский лев" code_alpha="BGN" code_numeric="975" />
	<currency name="Бурундийский франк" code_alpha="BIF" code_numeric="108" />
	<currency name="CFA франк BCEAO" code_alpha="XOF" code_numeric="952" />
	<currency name="CFP франк" code_alpha="XAF" code_numeric="953" />
	<currency name="Эскудо Кабо-Верде" code_alpha="CVE" code_numeric="132" />
	<currency name="Доллар Каймановых Островов" code_alpha="KYD" code_numeric="136" />
	<currency name="Cedi" code_alpha="GHC" code_numeric="288" />
	<currency name="Чилийское песо" code_alpha="CLP" code_numeric="152" />
	<currency name="Колумбийское песо" code_alpha="COP" code_numeric="170" />
	<currency name="Франк Коморы" code_alpha="KMF" code_numeric="174" />
	<currency name="Конвертируемая марка" code_alpha="BAM" code_numeric="977" />
	<currency name="Cordoba Oro" code_alpha="NIO" code_numeric="558" />
	<currency name="Костариканский колон" code_alpha="CRC" code_numeric="188" />
	<currency name="Хорватский куна" code_alpha="HRK" code_numeric="191" />
	<currency name="Кубинское песо" code_alpha="CUP" code_numeric="192" />
	<currency name="Кипрский фунт" code_alpha="CYP" code_numeric="196" />
	<currency name="Ческая крона" code_alpha="CZK" code_numeric="203" />
	<currency name="Dalasi" code_alpha="GMD" code_numeric="270" />
	<currency name="Датская крона" code_alpha="DKK" code_numeric="208" />
	<currency name="Denar" code_alpha="MKD" code_numeric="807" />
	<currency name="Франк Джибути" code_alpha="DJF" code_numeric="262" />
	<currency name="Dobra" code_alpha="STD" code_numeric="678" />
	<currency name="Доминиканское песо" code_alpha="DOP" code_numeric="214" />
	<currency name="Dong" code_alpha="VND" code_numeric="704" />
	<currency name="Доллар Восточных Кариб" code_alpha="XCD" code_numeric="951" />
	<currency name="Египетский фунт" code_alpha="EGP" code_numeric="818" />
	<currency name="Сальвадорский колон" code_alpha="SVC" code_numeric="222" />
	<currency name="Эфиопский быр" code_alpha="ETB" code_numeric="230" />
	<currency name="Фунт фальклендских островов" code_alpha="FKP" code_numeric="238" />
	<currency name="Фуджийский доллар" code_alpha="FJD" code_numeric="242" />
	<currency name="Forint" code_alpha="HUF" code_numeric="348" />
	<currency name="Франк Конго" code_alpha="CDF" code_numeric="976" />
	<currency name="Гибраалтарский фунт" code_alpha="GIP" code_numeric="292" />
	<currency name="Gourde" code_alpha="HTG" code_numeric="332" />
	<currency name="Guarani" code_alpha="PYG" code_numeric="600" />
	<currency name="Гвинейский франк" code_alpha="GNF" code_numeric="324" />
	<currency name="Песо Гвинея-Бисау" code_alpha="GWP" code_numeric="624" />
	<currency name="Доллар Гайаны" code_alpha="GYD" code_numeric="328" />
	<currency name="Гонконгский доллар" code_alpha="HKD" code_numeric="344" />
	<currency name="Украинская гривня" code_alpha="UAH" code_numeric="980" />
	<currency name="Исландская крона" code_alpha="ISK" code_numeric="352" />
	<currency name="Индийская рупия" code_alpha="INR" code_numeric="356" />
	<currency name="Иранский риал" code_alpha="IRR" code_numeric="364" />
	<currency name="Иракский динар" code_alpha="IQD" code_numeric="368" />
	<currency name="Ямайский доллар" code_alpha="JMD" code_numeric="388" />
	<currency name="Иорданский динар" code_alpha="JOD" code_numeric="400" />
	<currency name="Кенийский шиллинг" code_alpha="KES" code_numeric="404" />
	<currency name="Kina" code_alpha="PGK" code_numeric="598" />
	<currency name="Kip" code_alpha="LAK" code_numeric="418" />
	<currency name="Kroon" code_alpha="EEK" code_numeric="233" />
	<currency name="Кувейтский динар" code_alpha="KWD" code_numeric="414" />
	<currency name="Kwacha" code_alpha="MWK" code_numeric="454" />
	<currency name="Kwanza" code_alpha="AOA" code_numeric="973" />
	<currency name="Kyat" code_alpha="MMK" code_numeric="104" />
	<currency name="Lari" code_alpha="GEL" code_numeric="981" />
	<currency name="Латвийский лат" code_alpha="LVL" code_numeric="428" />
	<currency name="Ливанский фунт" code_alpha="LBP" code_numeric="422" />
	<currency name="Lek" code_alpha="ALL" code_numeric="8" />
	<currency name="Lempira" code_alpha="HNL" code_numeric="340" />
	<currency name="Сьерра-Леонский леоне" code_alpha="SLL" code_numeric="694" />
	<currency name="Leu" code_alpha="ROL" code_numeric="642" />
	<currency name="Либерийский долар" code_alpha="LRD" code_numeric="430" />
	<currency name="Ливийский динар" code_alpha="LYD" code_numeric="434" />
	<currency name="Lilangeni" code_alpha="SZL" code_numeric="748" />
	<currency name="Литовский лит" code_alpha="LTL" code_numeric="440" />
	<currency name="Loti" code_alpha="LSL" code_numeric="426" />
	<currency name="Malagasy Ariary" code_alpha="MGA" code_numeric="969" />
	<currency name="Малагасийский франк" code_alpha="MGF" code_numeric="450" />
	<currency name="Малазийский рингит" code_alpha="MYR" code_numeric="458" />
	<currency name="Мальтийская лира" code_alpha="MTL" code_numeric="470" />
	<currency name="Manat" code_alpha="TMM" code_numeric="795" />
	<currency name="Маврикийская рупия" code_alpha="MUR" code_numeric="480" />
	<currency name="Merical" code_alpha="MZM" code_numeric="508" />
	<currency name="Мексиканское песо" code_alpha="MXN" code_numeric="484" />
	<currency name="Mexican Unidad De Inversion" code_alpha="MXV" code_numeric="979" />
	<currency name="Молдавский лей" code_alpha="MDL" code_numeric="498" />
	<currency name="Мороканский дирхам" code_alpha="MAD" code_numeric="504" />
	<currency name="Mvdol" code_alpha="BOV" code_numeric="984" />
	<currency name="Naira" code_alpha="NGN" code_numeric="566" />
	<currency name="Nakfa" code_alpha="ERN" code_numeric="232" />
	<currency name="Намибийский доллар" code_alpha="NAD" code_numeric="516" />
	<currency name="Непальская рупия" code_alpha="NPR" code_numeric="524" />
	<currency name="Netherlands Antillian Guikder" code_alpha="ANG" code_numeric="532" />
	<currency name="New Israeli Sheqel" code_alpha="ILS" code_numeric="376" />
	<currency name="Доллар Нового Тайваня" code_alpha="TWD" code_numeric="901" />
	<currency name="Турецкая лира" code_alpha="TRY" code_numeric="949" />
	<currency name="Новозеландский доллар" code_alpha="NZD" code_numeric="554" />
	<currency name="Ngultrum" code_alpha="BTN" code_numeric="64" />
	<currency name="Северокорейский вон" code_alpha="KPW" code_numeric="408" />
	<currency name="Норвежская крона" code_alpha="NOK" code_numeric="578" />
	<currency name="Nuevo Sol" code_alpha="PEN" code_numeric="604" />
	<currency name="Old Turkish Lira" code_alpha="TRL" code_numeric="792" />
	<currency name="Ouguiya" code_alpha="MRO" code_numeric="478" />
	<currency name="Pa' anga" code_alpha="TOP" code_numeric="776" />
	<currency name="Пакистанская рупия" code_alpha="PKR" code_numeric="586" />
	<currency name="Pataca" code_alpha="MOP" code_numeric="446" />
	<currency name="Уругвайское песо" code_alpha="UYU" code_numeric="858" />
	<currency name="Филлипинское песо" code_alpha="PHP" code_numeric="608" />
	<currency name="Фунт стерлинг" code_alpha="GBP" code_numeric="826" />
	<currency name="Pula" code_alpha="BWP" code_numeric="72" />
	<currency name="Катарский риял" code_alpha="QAR" code_numeric="634" />
	<currency name="Quetzal" code_alpha="GTQ" code_numeric="320" />
	<currency name="Rand" code_alpha="ZAR" code_numeric="710" />
	<currency name="Оманский риал" code_alpha="OMR" code_numeric="512" />
	<currency name="Riel" code_alpha="KHR" code_numeric="116" />
	<currency name="Rufiyaa" code_alpha="MVR" code_numeric="462" />
	<currency name="Rupiah" code_alpha="IDR" code_numeric="360" />
	<currency name="Российский рубль" code_alpha="RUB" code_numeric="643" />
	<currency name="Руандский франк" code_alpha="RWF" code_numeric="646" />
	<currency name="Фунт Острова Святой Елены" code_alpha="SHP" code_numeric="654" />
	<currency name="Саудовский риял" code_alpha="SAR" code_numeric="682" />
	<currency name="Алжирский динар" code_alpha="CSD" code_numeric="891" />
	<currency name="Сейшельская рупия" code_alpha="SCR" code_numeric="690" />
	<currency name="Сингапурский доллар" code_alpha="SGD" code_numeric="702" />
	<currency name="Словацкая крона" code_alpha="SKK" code_numeric="703" />
	<currency name="Доллар Соломоновых островов" code_alpha="SBD" code_numeric="90" />
	<currency name="Som" code_alpha="KGS" code_numeric="417" />
	<currency name="Сомалийский шиллинг" code_alpha="SOS" code_numeric="706" />
	<currency name="Somoni" code_alpha="TJS" code_numeric="972" />
	<currency name="Рупия Шри-Ланки" code_alpha="LKR" code_numeric="144" />
	<currency name="Суданский динар" code_alpha="SDD" code_numeric="736" />
	<currency name="Сингапурский доллар" code_alpha="SRD" code_numeric="968" />
	<currency name="Шведская крона" code_alpha="SEK" code_numeric="752" />
	<currency name="Швейцарский франк" code_alpha="CHF" code_numeric="756" />
	<currency name="Сирийский фунт" code_alpha="SYP" code_numeric="760" />
	<currency name="Taka" code_alpha="BDT" code_numeric="50" />
	<currency name="Tala" code_alpha="WST" code_numeric="882" />
	<currency name="Таньзанский шиллинг" code_alpha="TZS" code_numeric="834" />
	<currency name="Tenge" code_alpha="KZT" code_numeric="398" />
	<currency name="Tolar" code_alpha="SIT" code_numeric="705" />
	<currency name="Trinidad And Tobago Dollar" code_alpha="TTD" code_numeric="780" />
	<currency name="Tugrik" code_alpha="MNT" code_numeric="496" />
	<currency name="Тунисский динар" code_alpha="TND" code_numeric="788" />
	<currency name="Дирхам Объединенных Арабских Эмиратов" code_alpha="AED" code_numeric="784" />
	<currency name="Uganda Shilling" code_alpha="UGX" code_numeric="800" />
	<currency name="Unidad De Valor Real" code_alpha="COU" code_numeric="970" />
	<currency name="Unidades De Formento" code_alpha="CLF" code_numeric="990" />
	<currency name="Узбекский сом" code_alpha="UZS" code_numeric="860" />
	<currency name="Vatu" code_alpha="VUV" code_numeric="548" />
	<currency name="Евро" code_alpha="CHE" code_numeric="947" />
	<currency name="CFP франк" code_alpha="CHW" code_numeric="948" />
	<currency name="Won" code_alpha="KRW" code_numeric="410" />
	<currency name="Риал Йемена" code_alpha="YER" code_numeric="886" />
	<currency name="Yen" code_alpha="JPY" code_numeric="392" />
	<currency name="Yuan Renminbi" code_alpha="CNY" code_numeric="156" />
	<currency name="Доллар Зимбабве" code_alpha="ZWD" code_numeric="716" />
</currencies>


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Core.Pipeline;
using Azure.Messaging.ServiceBus.Core;
using Azure.Messaging.ServiceBus.Diagnostics;
using Azure.Messaging.ServiceBus.Plugins;

namespace Azure.Messaging.ServiceBus
{
    ///
    ///   A client responsible for sending <see cref="ServiceBusMessage" /> to a specific Service Bus entity
    ///   (Queue or Topic). It can be used for both session and non-session entities. It is constructed by calling <see cref="ServiceBusClient.CreateSender(string)"/>.
    ///
    ///
    public class ServiceBusSender : IAsyncDisposable
    {
        /// The minimum allowable size, in bytes, for a batch to be sent.
        internal const int MinimumBatchSizeLimit = 24;

        ///
        ///   The fully qualified Service Bus namespace that the producer is associated with.  This is likely
        ///   to be similar to <c>{yournamespace}.servicebus.windows.net</c>.
        ///
        ///
        public virtual string FullyQualifiedNamespace => _connection.FullyQualifiedNamespace;

        ///
        ///   The path of the entity that the sender is connected to, specific to the
        ///   Service Bus namespace that contains it.
        ///
        ///
        public virtual string EntityPath { get; }

        ///
        ///   Indicates whether or not this <see cref="ServiceBusSender"/> has been closed.
        ///
        ///
        /// <value>
        /// <c>true</c> if the sender is closed; otherwise, <c>false</c>.
        /// </value>
        public virtual bool IsClosed
        {
            get => _closed;
            private set => _closed = value;
        }

        /// Indicates whether or not this instance has been closed.
        private volatile bool _closed;

        ///
        ///   The instance of <see cref="ServiceBusEventSource" /> which can be mocked for testing.
        ///
        ///
        internal ServiceBusEventSource Logger { get; set; } = ServiceBusEventSource.Log;

        ///
        /// Gets the ID to identify this client. This can be used to correlate logs and exceptions.
        ///
        /// <remarks>Every new client has a unique ID.</remarks>
        internal string Identifier { get; private set; }

        ///
        ///   The policy to use for determining retry behavior for when an operation fails.
        ///
        ///
        private readonly ServiceBusRetryPolicy _retryPolicy;

        ///
        ///   The active connection to the Azure Service Bus service, enabling client communications for metadata
        ///   about the associated Service Bus entity and access to transport-aware consumers.
        ///
        ///
        private readonly ServiceBusConnection _connection;

        ///
        ///   An abstracted Service Bus entity transport-specific sender that is associated with the
        ///   Service Bus entity gateway rather than a specific partition; intended to perform delegated operations.
        ///
        ///
        private readonly TransportSender _innerSender;
        private readonly EntityScopeFactory _scopeFactory;
        internal readonly IList<ServiceBusPlugin> _plugins;

        ///
        ///   Initializes a new instance of the <see cref="ServiceBusSender"/> class.
        ///
        /// <param name="entityPath">The entity path to send the message to.</param>
        /// <param name="options">The set of <see cref="ServiceBusSenderOptions"/> to use for configuring
        /// this <see cref="ServiceBusSender"/>.</param>
        /// <param name="connection">The connection for the sender.</param>
        /// <param name="plugins">Plugins to apply to outgoing messages.</param>
        ///
        internal ServiceBusSender(
            string entityPath,
            ServiceBusSenderOptions options,
            ServiceBusConnection connection,
            IList<ServiceBusPlugin> plugins)
        {
            Logger.ClientCreateStart(typeof(ServiceBusSender), connection?.FullyQualifiedNamespace, entityPath);
            try
            {
                Argument.AssertNotNull(connection, nameof(connection));
                Argument.AssertNotNull(connection.RetryOptions, nameof(connection.RetryOptions));
                Argument.AssertNotNullOrWhiteSpace(entityPath, nameof(entityPath));
                connection.ThrowIfClosed();

                options = options ?? new ServiceBusSenderOptions();
                EntityPath = entityPath;
                Identifier = DiagnosticUtilities.GenerateIdentifier(EntityPath);
                _connection = connection;
                _retryPolicy = _connection.RetryOptions.ToRetryPolicy();
                _innerSender = _connection.CreateTransportSender(
                    entityPath,
                    _retryPolicy,
                    Identifier);
                _scopeFactory = new EntityScopeFactory(EntityPath, FullyQualifiedNamespace);
                _plugins = plugins;
            }
            catch (Exception ex)
            {
                Logger.ClientCreateException(typeof(ServiceBusSender), connection?.FullyQualifiedNamespace, entityPath, ex);
                throw;
            }
            Logger.ClientCreateComplete(typeof(ServiceBusSender), Identifier);
        }

        ///
        ///   Initializes a new instance of the <see cref="ServiceBusSender"/> class for mocking.
        ///
        ///
        protected ServiceBusSender()
        {
        }

        ///
        ///   Sends a message to the associated entity of Service Bus.
        ///
        /// <param name="message">The message to send.</param>
        /// <param name="cancellationToken">An optional <see cref="CancellationToken"/> instance to signal the request to cancel the operation.</param>
        ///
        /// <returns>A task to be resolved on when the operation has completed.</returns>
        /// <exception cref="ServiceBusException">
        ///   The message exceeds the maximum size allowed, as determined by the Service Bus service.
        ///   The <see cref="ServiceBusException.Reason" /> will be set to <see cref="ServiceBusFailureReason.MessageSizeExceeded"/> in this case.
        ///   For more information on service limits, see
        ///   <see href="https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-quotas#messaging-quotas"/>.
        /// </exception>
        public virtual async Task SendMessageAsync(
            ServiceBusMessage message,
            CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(message, nameof(message));
            await SendMessagesAsync(
                new ServiceBusMessage[] { message },
                cancellationToken).ConfigureAwait(false);
        }

        ///
        ///   Sends a set of messages to the associated Service Bus entity using a batched approach.
        ///   If the size of the messages exceed the maximum size of a single batch,
        ///   an exception will be triggered and the send will fail. In order to ensure that the messages
        ///   being sent will fit in a batch, use <see cref="SendMessagesAsync(ServiceBusMessageBatch, CancellationToken)"/> instead.
        ///
        ///
        /// <param name="messages">The set of messages to send.</param>
        /// <param name="cancellationToken">An optional <see cref="CancellationToken"/> instance to signal the request to cancel the operation.</param>
        ///
        /// <returns>A task to be resolved on when the operation has completed.</returns>
        /// <exception cref="ServiceBusException">
        ///   The set of messages exceeds the maximum size allowed in a single batch, as determined by the Service Bus service.
        ///   The <see cref="ServiceBusException.Reason" /> will be set to <see cref="ServiceBusFailureReason.MessageSizeExceeded"/> in this case.
        ///   For more information on service limits, see
        ///   <see href="https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-quotas#messaging-quotas"/>.
        /// </exception>
        public virtual async Task SendMessagesAsync(
            IEnumerable<ServiceBusMessage> messages,
            CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(messages, nameof(messages));
            Argument.AssertNotDisposed(IsClosed, nameof(ServiceBusSender));
            _connection.ThrowIfClosed();

            IReadOnlyList<ServiceBusMessage> messageList = messages switch
            {
                IReadOnlyList<ServiceBusMessage> alreadyList => alreadyList,
                _ => messages.ToList()
            };

            if (messageList.Count == 0)
            {
                return;
            }
            await ApplyPlugins(messageList).ConfigureAwait(false);
            cancellationToken.ThrowIfCancellationRequested<TaskCanceledException>();
            Logger.SendMessageStart(Identifier, messageCount: messageList.Count);
            using DiagnosticScope scope = CreateDiagnosticScope(messages, DiagnosticProperty.SendActivityName);
            scope.Start();

            try
            {
                await _innerSender.SendAsync(
                    messageList,
                    cancellationToken).ConfigureAwait(false);
            }

            catch (Exception exception)
            {
                Logger.SendMessageException(Identifier, exception.ToString());
                scope.Failed(exception);
                throw;
            }
            cancellationToken.ThrowIfCancellationRequested<TaskCanceledException>();
            Logger.SendMessageComplete(Identifier);
        }

        private async Task ApplyPlugins(IReadOnlyList<ServiceBusMessage> messages)
        {
            foreach (ServiceBusPlugin plugin in _plugins)
            {
                string pluginType = plugin.GetType().Name;
                foreach (ServiceBusMessage message in messages)
                {
                    try
                    {
                        Logger.PluginCallStarted(pluginType, message.MessageId);
                        await plugin.BeforeMessageSendAsync(message).ConfigureAwait(false);
                        Logger.PluginCallCompleted(pluginType, message.MessageId);
                    }
                    catch (Exception ex)
                    {
                        Logger.PluginCallException(pluginType, message.MessageId, ex.ToString());
                        throw;
                    }
                }
            }
        }

        private DiagnosticScope CreateDiagnosticScope(IEnumerable<ServiceBusMessage> messages, string activityName)
        {
            foreach (ServiceBusMessage message in messages)
            {
                _scopeFactory.InstrumentMessage(message);
            }

            // create a new scope for the specified operation
            DiagnosticScope scope = _scopeFactory.CreateScope(
                activityName,
                DiagnosticProperty.ClientKind);

            scope.SetMessageData(messages);
            return scope;
        }

        ///
        ///   Creates a size-constraint batch to which <see cref="ServiceBusMessage" /> may be added using
        ///   a <see cref="ServiceBusMessageBatch.TryAddMessage"/>. If a message would exceed the maximum
        ///   allowable size of the batch, the batch will not allow adding the message and signal that
        ///   scenario using it return value.
        ///
        ///   Because messages that would violate the size constraint cannot be added, publishing a batch
        ///   will not trigger an exception when attempting to send the messages to the Queue/Topic.
        ///
        ///
        /// <param name="cancellationToken">An optional <see cref="CancellationToken"/> instance to signal the request to cancel the operation.</param>
        ///
        /// <returns>An <see cref="ServiceBusMessageBatch" /> with the default batch options.</returns>
        ///
        /// <seealso cref="CreateMessageBatchAsync(CreateMessageBatchOptions, CancellationToken)" />
        ///
        public virtual ValueTask<ServiceBusMessageBatch> CreateMessageBatchAsync(CancellationToken cancellationToken = default) => CreateMessageBatchAsync(null, cancellationToken);

        ///
        ///   Creates a size-constraint batch to which <see cref="ServiceBusMessage" /> may be added using a try-based pattern.  If a message would
        ///   exceed the maximum allowable size of the batch, the batch will not allow adding the message and signal that scenario using its
        ///   return value.
        ///
        ///   Because messages that would violate the size constraint cannot be added, publishing a batch will not trigger an exception when
        ///   attempting to send the messages to the Queue/Topic.
        ///
        ///
        /// <param name="options">The set of options to consider when creating this batch.</param>
        /// <param name="cancellationToken">An optional <see cref="CancellationToken"/> instance to signal the request to cancel the operation.</param>
        ///
        /// <returns>An <see cref="ServiceBusMessageBatch" /> with the requested <paramref name="options"/>.</returns>
        ///
        /// <seealso cref="CreateMessageBatchAsync(CreateMessageBatchOptions, CancellationToken)" />
        ///
        public virtual async ValueTask<ServiceBusMessageBatch> CreateMessageBatchAsync(
            CreateMessageBatchOptions options,
            CancellationToken cancellationToken = default)
        {
            Argument.AssertNotDisposed(IsClosed, nameof(ServiceBusSender));
            _connection.ThrowIfClosed();

            options = options?.Clone() ?? new CreateMessageBatchOptions();
            cancellationToken.ThrowIfCancellationRequested<TaskCanceledException>();
            Logger.CreateMessageBatchStart(Identifier);
            ServiceBusMessageBatch batch;
            try
            {
                TransportMessageBatch transportBatch = await _innerSender.CreateMessageBatchAsync(options, cancellationToken).ConfigureAwait(false);
                batch = new ServiceBusMessageBatch(transportBatch, _scopeFactory);
            }
            catch (Exception ex)
            {
                Logger.CreateMessageBatchException(Identifier, ex.ToString());
                throw;
            }
            cancellationToken.ThrowIfCancellationRequested<TaskCanceledException>();
            Logger.CreateMessageBatchComplete(Identifier);
            return batch;
        }

        ///
        ///   Sends a <see cref="ServiceBusMessageBatch"/>
        ///   containing a set of <see cref="ServiceBusMessage"/> to
        ///   the associated Service Bus entity.
        ///
        ///
        /// <param name="messageBatch">The batch of messages to send. A batch may be created using <see cref="CreateMessageBatchAsync(CancellationToken)" />.</param>
        /// <param name="cancellationToken">An optional <see cref="CancellationToken"/> instance to signal the request to cancel the operation.</param>
        /// <returns>A task to be resolved on when the operation has completed.</returns>
        ///
        public virtual async Task SendMessagesAsync(
            ServiceBusMessageBatch messageBatch,
            CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(messageBatch, nameof(messageBatch));
            Argument.AssertNotDisposed(IsClosed, nameof(ServiceBusSender));
            _connection.ThrowIfClosed();

            if (messageBatch.Count == 0)
            {
                return;
            }

            cancellationToken.ThrowIfCancellationRequested<TaskCanceledException>();
            Logger.SendMessageStart(Identifier, messageBatch.Count);
            using DiagnosticScope scope = CreateDiagnosticScope(
                messageBatch.AsEnumerable<ServiceBusMessage>(),
                DiagnosticProperty.SendActivityName);
            scope.Start();

            try
            {
                messageBatch.Lock();
                await _innerSender.SendBatchAsync(messageBatch, cancellationToken).ConfigureAwait(false);
            }
            catch (Exception exception)
            {
                Logger.SendMessageException(Identifier, exception.ToString());
                scope.Failed(exception);
                throw;
            }
            finally
            {
                messageBatch.Unlock();
            }

            cancellationToken.ThrowIfCancellationRequested<TaskCanceledException>();
            Logger.SendMessageComplete(Identifier);
        }

        ///
        /// Schedules a message to appear on Service Bus at a later time.
        ///
        ///
        /// <param name="message">The <see cref="ServiceBusMessage"/> to schedule.</param>
        /// <param name="scheduledEnqueueTime">The UTC time at which the message should be available for processing</param>
        /// <param name="cancellationToken">An optional <see cref="CancellationToken"/> instance to signal the request to cancel the operation.</param>
        ///
        /// <remarks>Although the message will not be available to be received until the scheduledEnqueueTime, it can still be peeked before that time.
        /// Messages can also be scheduled by setting <see cref="ServiceBusMessage.ScheduledEnqueueTime"/> and
        /// using <see cref="SendMessageAsync(ServiceBusMessage, CancellationToken)"/>,
        /// <see cref="SendMessagesAsync(IEnumerable{ServiceBusMessage}, CancellationToken)"/>, or
        /// <see cref="SendMessagesAsync(ServiceBusMessageBatch, CancellationToken)"/>.</remarks>
        ///
        /// <returns>The sequence number of the message that was scheduled.</returns>
        public virtual async Task<long> ScheduleMessageAsync(
            ServiceBusMessage message,
            DateTimeOffset scheduledEnqueueTime,
            CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(message, nameof(message));
            IReadOnlyList<long> sequenceNumbers = await ScheduleMessagesAsync(
                new ServiceBusMessage[] { message },
                scheduledEnqueueTime,
                cancellationToken)
            .ConfigureAwait(false);
            // if there isn't one sequence number in the list, an
            // exception should have been thrown by this point.
            return sequenceNumbers[0];
        }

        ///
        /// Schedules a set of messages to appear on Service Bus at a later time.
        ///
        ///
        /// <param name="messages">The set of messages to schedule.</param>
        /// <param name="scheduledEnqueueTime">The UTC time at which the message should be available for processing</param>
        /// <param name="cancellationToken">An optional <see cref="CancellationToken"/> instance to signal the request to cancel the operation.</param>
        ///
        /// <remarks>Although the message will not be available to be received until the scheduledEnqueueTime, it can still be peeked before that time.
        /// Messages can also be scheduled by setting <see cref="ServiceBusMessage.ScheduledEnqueueTime"/> and
        /// using <see cref="SendMessageAsync(ServiceBusMessage, CancellationToken)"/>,
        /// <see cref="SendMessagesAsync(IEnumerable{ServiceBusMessage}, CancellationToken)"/>, or
        /// <see cref="SendMessagesAsync(ServiceBusMessageBatch, CancellationToken)"/>.</remarks>
        ///
        /// <returns>The sequence number of the message that was scheduled.</returns>
        public virtual async Task<IReadOnlyList<long>> ScheduleMessagesAsync(
            IEnumerable<ServiceBusMessage> messages,
            DateTimeOffset scheduledEnqueueTime,
            CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(messages, nameof(messages));
            Argument.AssertNotDisposed(IsClosed, nameof(ServiceBusSender));
            _connection.ThrowIfClosed();
            cancellationToken.ThrowIfCancellationRequested<TaskCanceledException>();

            IReadOnlyList<ServiceBusMessage> messageList = messages switch
            {
                IReadOnlyList<ServiceBusMessage> alreadyList => alreadyList,
                _ => messages.ToList()
            };

            if (messageList.Count == 0)
            {
                return Array.Empty<long>();
            }

            await ApplyPlugins(messageList).ConfigureAwait(false);
            Logger.ScheduleMessagesStart(
                Identifier,
                messageList.Count,
                scheduledEnqueueTime.ToString(CultureInfo.InvariantCulture));

            using DiagnosticScope scope = CreateDiagnosticScope(
                messages,
                DiagnosticProperty.ScheduleActivityName);
            scope.Start();

            IReadOnlyList<long> sequenceNumbers = null;
            try
            {
                foreach (ServiceBusMessage message in messageList)
                {
                    message.ScheduledEnqueueTime = scheduledEnqueueTime.UtcDateTime;
                }
                sequenceNumbers = await _innerSender.ScheduleMessagesAsync(messageList, cancellationToken).ConfigureAwait(false);
            }
            catch (Exception exception)
            {
                Logger.ScheduleMessagesException(Identifier, exception.ToString());
                scope.Failed(exception);
                throw;
            }

            cancellationToken.ThrowIfCancellationRequested<TaskCanceledException>();
            Logger.ScheduleMessagesComplete(Identifier);
            return sequenceNumbers;
        }

        ///
        /// Cancels a message that was scheduled.
        ///
        /// <param name="sequenceNumber">The <see cref="ServiceBusReceivedMessage.SequenceNumber"/> of the message to be cancelled.</param>
        /// <param name="cancellationToken">An optional <see cref="CancellationToken"/> instance to signal the request to cancel the operation.</param>
        public virtual async Task CancelScheduledMessageAsync(
            long sequenceNumber,
            CancellationToken cancellationToken = default) =>
            await CancelScheduledMessagesAsync(
                new long[] { sequenceNumber },
                cancellationToken)
            .ConfigureAwait(false);

        ///
        /// Cancels a set of messages that were scheduled.
        ///
        /// <param name="sequenceNumbers">The set of <see cref="ServiceBusReceivedMessage.SequenceNumber"/> of the messages to be cancelled.</param>
        /// <param name="cancellationToken">An optional <see cref="CancellationToken"/> instance to signal the request to cancel the operation.</param>
        public virtual async Task CancelScheduledMessagesAsync(
            IEnumerable<long> sequenceNumbers,
            CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(sequenceNumbers, nameof(sequenceNumbers));
            Argument.AssertNotDisposed(IsClosed, nameof(ServiceBusSender));
            _connection.ThrowIfClosed();
            cancellationToken.ThrowIfCancellationRequested<TaskCanceledException>();

            // the sequence numbers MUST be in array form for them to be encoded correctly
            long[] sequenceArray = sequenceNumbers switch
            {
                long[] alreadyArray => alreadyArray,
                _ => sequenceNumbers.ToArray()
            };

            if (sequenceArray.Length == 0)
            {
                return;
            }

            Logger.CancelScheduledMessagesStart(Identifier, sequenceArray);

            using DiagnosticScope scope = _scopeFactory.CreateScope(
                DiagnosticProperty.CancelActivityName,
                DiagnosticProperty.ClientKind);
            scope.Start();

            try
            {
                await _innerSender.CancelScheduledMessagesAsync(sequenceArray, cancellationToken).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                Logger.CancelScheduledMessagesException(Identifier, ex.ToString());
                throw;
            }

            cancellationToken.ThrowIfCancellationRequested<TaskCanceledException>();
            Logger.CancelScheduledMessagesComplete(Identifier);
        }

        ///
        ///   Performs the task needed to clean up resources used by the <see cref="ServiceBusSender" />.
        ///
        /// <param name="cancellationToken"> An optional<see cref="CancellationToken"/> instance to signal the
        /// request to cancel the operation.</param>
        public virtual async Task CloseAsync(
            CancellationToken cancellationToken = default)
        {
            IsClosed = true;

            Logger.ClientCloseStart(typeof(ServiceBusSender), Identifier);

            try
            {
                await _innerSender.CloseAsync(CancellationToken.None).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                Logger.ClientCloseException(typeof(ServiceBusSender), Identifier, ex);
                throw;
            }

            Logger.ClientCloseComplete(typeof(ServiceBusSender), Identifier);
        }

        ///
        ///   Performs the task needed to clean up resources used by the <see cref="ServiceBusSender" />.
        ///   This is equivalent to calling <see cref="CloseAsync"/>.
        ///
        ///
        /// <returns>A task to be resolved on when the operation has completed.</returns>
        [SuppressMessage("Usage", "AZC0002:Ensure all service methods take an optional CancellationToken parameter.", Justification = "This signature must match the IAsyncDisposable interface.")]
        public virtual async ValueTask DisposeAsync() =>
            await CloseAsync().ConfigureAwait(false);

        ///
        ///   Determines whether the specified <see cref="System.Object" /> is equal to this instance.
        ///
        ///
        /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param>
        ///
        /// <returns><c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.</returns>
        ///
        [EditorBrowsable(EditorBrowsableState.Never)]
        public override bool Equals(object obj) => base.Equals(obj);

        ///
        ///   Returns a hash code for this instance.
        ///
        ///
        /// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.</returns>
        ///
        [EditorBrowsable(EditorBrowsableState.Never)]
        public override int GetHashCode() => base.GetHashCode();

        ///
        ///   Converts the instance to string representation.
        ///
        ///
        /// <returns>A <see cref="System.String" /> that represents this instance.</returns>
        ///
        [EditorBrowsable(EditorBrowsableState.Never)]
        public override string ToString() => base.ToString();
    }
}


text:
package org.elasticsearch.xpack.ml.rest.dataframe;

import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.RestToXContentListener;
import org.elasticsearch.xpack.core.ml.action.EvaluateDataFrameAction;

import java.io.IOException;
import java.util.List;

import static org.elasticsearch.rest.RestRequest.Method.POST;
import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH;

public class RestEvaluateDataFrameAction extends BaseRestHandler {

    @Override
    public List<Route> routes() {
        return List.of(new Route(POST, BASE_PATH + "data_frame/_evaluate"));
    }

    @Override
    public String getName() {
        return "ml_evaluate_data_frame_action";
    }

    @Override
    protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException {
        EvaluateDataFrameAction.Request request = EvaluateDataFrameAction.Request.parseRequest(restRequest.contentOrSourceParamParser());
        return channel -> client.execute(EvaluateDataFrameAction.INSTANCE, request, new RestToXContentListener<>(channel));
    }
}