Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:32

0001 //===- NativeFormatting.h - Low level formatting helpers ---------*- C++-*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_SUPPORT_NATIVEFORMATTING_H
0010 #define LLVM_SUPPORT_NATIVEFORMATTING_H
0011 
0012 #include <cstdint>
0013 #include <optional>
0014 
0015 namespace llvm {
0016 class raw_ostream;
0017 enum class FloatStyle { Exponent, ExponentUpper, Fixed, Percent };
0018 enum class IntegerStyle {
0019   Integer,
0020   Number,
0021 };
0022 enum class HexPrintStyle { Upper, Lower, PrefixUpper, PrefixLower };
0023 
0024 size_t getDefaultPrecision(FloatStyle Style);
0025 
0026 bool isPrefixedHexStyle(HexPrintStyle S);
0027 
0028 void write_integer(raw_ostream &S, unsigned int N, size_t MinDigits,
0029                    IntegerStyle Style);
0030 void write_integer(raw_ostream &S, int N, size_t MinDigits, IntegerStyle Style);
0031 void write_integer(raw_ostream &S, unsigned long N, size_t MinDigits,
0032                    IntegerStyle Style);
0033 void write_integer(raw_ostream &S, long N, size_t MinDigits,
0034                    IntegerStyle Style);
0035 void write_integer(raw_ostream &S, unsigned long long N, size_t MinDigits,
0036                    IntegerStyle Style);
0037 void write_integer(raw_ostream &S, long long N, size_t MinDigits,
0038                    IntegerStyle Style);
0039 
0040 void write_hex(raw_ostream &S, uint64_t N, HexPrintStyle Style,
0041                std::optional<size_t> Width = std::nullopt);
0042 void write_double(raw_ostream &S, double D, FloatStyle Style,
0043                   std::optional<size_t> Precision = std::nullopt);
0044 }
0045 
0046 #endif
0047