LLVM 24.0.0git
ConvertEBCDIC.h
Go to the documentation of this file.
1//===--- ConvertEBCDIC.h - UTF8/EBCDIC CharSet Conversion -------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8///
9/// \file
10/// This file provides utility functions for converting between EBCDIC-1047 and
11/// UTF-8.
12///
13///
14//===----------------------------------------------------------------------===//
15
16#ifndef LLVM_SUPPORT_CONVERTEBCDIC_H
17#define LLVM_SUPPORT_CONVERTEBCDIC_H
18
20#include "llvm/ADT/StringRef.h"
22#include <system_error>
23
24namespace llvm {
25namespace ConverterEBCDIC {
26/// Converts UTF-8 text containing only code points in the range U+0000 to
27/// U+00FF to EBCDIC-1047.
28///
29/// Returns std::errc::invalid_argument for incomplete UTF-8 input and
30/// std::errc::illegal_byte_sequence for malformed UTF-8 or code points outside
31/// that range.
32///
33/// \pre \p Result is empty. On error, it contains the successfully converted
34/// prefix.
35LLVM_ABI std::error_code convertToEBCDIC(StringRef Source,
36 SmallVectorImpl<char> &Result);
37
39
40} // namespace ConverterEBCDIC
41} // namespace llvm
42
43#endif // LLVM_SUPPORT_CONVERTEBCDIC_H
#define LLVM_ABI
Definition Compiler.h:215
This file defines the SmallVector class.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
LLVM_ABI std::error_code convertToEBCDIC(StringRef Source, SmallVectorImpl< char > &Result)
Converts UTF-8 text containing only code points in the range U+0000 to U+00FF to EBCDIC-1047.
LLVM_ABI void convertToUTF8(StringRef Source, SmallVectorImpl< char > &Result)
This is an optimization pass for GlobalISel generic memory operations.