<commit_before>//==- raw_sha1_ostream.h - raw_ostream that compute SHA1        --*- C++ -*-==//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//  This file defines the raw_sha1_ostream class.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_SUPPORT_RAW_SHA1_OSTREAM_H
#define LLVM_SUPPORT_RAW_SHA1_OSTREAM_H

#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/SHA1.h"

namespace llvm {

/// A raw_ostream that hash the content using the sha1 algorithm.
class raw_sha1_ostream : public raw_ostream {
  SHA1 State;

  /// See raw_ostream::write_impl.
  void write_impl(const char *Ptr, size_t Size) override {
    State.update(ArrayRef<uint8_t>((uint8_t *)Ptr, Size));
  }

public:
  /// Return the current SHA1 hash for the content of the stream
  StringRef sha1() {<commit_msg>Const correctness in raw_sha1_ostream (NFC)<commit_after>//==- raw_sha1_ostream.h - raw_ostream that compute SHA1        --*- C++ -*-==//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//  This file defines the raw_sha1_ostream class.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_SUPPORT_RAW_SHA1_OSTREAM_H
#define LLVM_SUPPORT_RAW_SHA1_OSTREAM_H

#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/SHA1.h"

namespace llvm {

/// A raw_ostream that hash the content using the sha1 algorithm.
class raw_sha1_ostream : public raw_ostream {
  SHA1 State;

  /// See raw_ostream::write_impl.
  void write_impl(const char *Ptr, size_t Size) override {
    State.update(ArrayRef<uint8_t>((const uint8_t *)Ptr, Size));
  }

public:
  /// Return the current SHA1 hash for the content of the stream
  StringRef sha1() {
{'fraction_non_alphanumeric': 0.24183006535947713, 'fraction_numerical': 0.012605042016806723, 'mean_word_length': 1.976388888888889, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1773545', 'n_tokens_mistral': 617, 'n_tokens_neox': 606, 'n_words': 175}