Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 14 | pmbaty | 1 | //===- NativeFormatting.h - Low level formatting helpers ---------*- 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 | #ifndef LLVM_SUPPORT_NATIVEFORMATTING_H |
||
| 10 | #define LLVM_SUPPORT_NATIVEFORMATTING_H |
||
| 11 | |||
| 12 | #include <cstdint> |
||
| 13 | #include <optional> |
||
| 14 | |||
| 15 | namespace llvm { |
||
| 16 | class raw_ostream; |
||
| 17 | enum class FloatStyle { Exponent, ExponentUpper, Fixed, Percent }; |
||
| 18 | enum class IntegerStyle { |
||
| 19 | Integer, |
||
| 20 | Number, |
||
| 21 | }; |
||
| 22 | enum class HexPrintStyle { Upper, Lower, PrefixUpper, PrefixLower }; |
||
| 23 | |||
| 24 | size_t getDefaultPrecision(FloatStyle Style); |
||
| 25 | |||
| 26 | bool isPrefixedHexStyle(HexPrintStyle S); |
||
| 27 | |||
| 28 | void write_integer(raw_ostream &S, unsigned int N, size_t MinDigits, |
||
| 29 | IntegerStyle Style); |
||
| 30 | void write_integer(raw_ostream &S, int N, size_t MinDigits, IntegerStyle Style); |
||
| 31 | void write_integer(raw_ostream &S, unsigned long N, size_t MinDigits, |
||
| 32 | IntegerStyle Style); |
||
| 33 | void write_integer(raw_ostream &S, long N, size_t MinDigits, |
||
| 34 | IntegerStyle Style); |
||
| 35 | void write_integer(raw_ostream &S, unsigned long long N, size_t MinDigits, |
||
| 36 | IntegerStyle Style); |
||
| 37 | void write_integer(raw_ostream &S, long long N, size_t MinDigits, |
||
| 38 | IntegerStyle Style); |
||
| 39 | |||
| 40 | void write_hex(raw_ostream &S, uint64_t N, HexPrintStyle Style, |
||
| 41 | std::optional<size_t> Width = std::nullopt); |
||
| 42 | void write_double(raw_ostream &S, double D, FloatStyle Style, |
||
| 43 | std::optional<size_t> Precision = std::nullopt); |
||
| 44 | } |
||
| 45 | |||
| 46 | #endif |
||
| 47 |