<commit_before>//===- Writer.h -----------------------------------------------------------===//
//
//                             The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLD_ELF_WRITER_H
#define LLD_ELF_WRITER_H

#include "SymbolTable.h"
#include "llvm/Support/FileOutputBuffer.h"

namespace lld {
namespace elf2 {
// OutputSection represents a section in an output file. It's a
// container of chunks. OutputSection and Chunk are 1:N relationship.
// Chunks cannot belong to more than one OutputSections. The writer
// creates multiple OutputSections and assign them unique,
// non-overlapping file offsets and VAs.
class OutputSection {
public:
  OutputSection(StringRef Name) : Name(Name), Header({}) {}
  void setVA(uint64_t);
  void setFileOffset(uint64_t);
  void addChunk(Chunk *C);
  std::vector<Chunk *> &getChunks() { return Chunks; }

  // Returns the size of the section in the output file.
  uint64_t getSize() { return Header.sh_size; }

  // Set offset into the string table storing this section name.
  // Used only when the name is longer than 8 bytes.
  void setStringTableOff(uint32_t V) { StringTableOff = V; }

private:
  StringRef Name;
  llvm::ELF::Elf64_Shdr Header;
  uint32_t StringTableOff = 0;
  std::vector<Chunk *> Chunks;
};

// The writer writes a SymbolTable result to a file.
template <class ELFT> class Writer {
public:
  explicit Writer(SymbolTable<ELFT> *T);<commit_msg>ELF2: Remove dead code.<commit_after>//===- Writer.h -----------------------------------------------------------===//
//
//                             The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLD_ELF_WRITER_H
#define LLD_ELF_WRITER_H

#include "SymbolTable.h"
#include "llvm/Support/FileOutputBuffer.h"

namespace lld {
namespace elf2 {
// OutputSection represents a section in an output file. It's a
// container of chunks. OutputSection and Chunk are 1:N relationship.
// Chunks cannot belong to more than one OutputSections. The writer
// creates multiple OutputSections and assign them unique,
// non-overlapping file offsets and VAs.
class OutputSection {
public:
  OutputSection(StringRef Name) : Name(Name), Header({}) {}
  void setVA(uint64_t);
  void setFileOffset(uint64_t);
  void addChunk(Chunk *C);
  std::vector<Chunk *> &getChunks() { return Chunks; }

  // Returns the size of the section in the output file.
  uint64_t getSize() { return Header.sh_size; }

private:
  StringRef Name;
  llvm::ELF::Elf64_Shdr Header;
  std::vector<Chunk *> Chunks;
};

// The writer writes a SymbolTable result to a file.
template <class ELFT> class Writer {
public:
  explicit Writer(SymbolTable<ELFT> *T);
{'fraction_non_alphanumeric': 0.18894472361809045, 'fraction_numerical': 0.009045226130653266, 'mean_word_length': 2.537914691943128, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4385768', 'n_tokens_mistral': 875, 'n_tokens_neox': 848, 'n_words': 294}