1 | //===- NativeFormatting.h - Low level formatting helpers ---------*- C++-*-===// |
2 | // |
3 | // The LLVM Compiler Infrastructure |
4 | // |
5 | // This file is distributed under the University of Illinois Open Source |
6 | // License. See LICENSE.TXT for details. |
7 | // |
8 | //===----------------------------------------------------------------------===// |
9 | |
10 | #ifndef LLVM_SUPPORT_NATIVE_FORMATTING_H |
11 | #define LLVM_SUPPORT_NATIVE_FORMATTING_H |
12 | |
13 | #include "llvm/ADT/Optional.h" |
14 | #include "llvm/Support/raw_ostream.h" |
15 | |
16 | #include <cstdint> |
17 | |
18 | namespace llvm { |
19 | enum class FloatStyle { Exponent, ExponentUpper, Fixed, Percent }; |
20 | enum class IntegerStyle { |
21 | Integer, |
22 | Number, |
23 | }; |
24 | enum class HexPrintStyle { Upper, Lower, PrefixUpper, PrefixLower }; |
25 | |
26 | size_t getDefaultPrecision(FloatStyle Style); |
27 | |
28 | bool isPrefixedHexStyle(HexPrintStyle S); |
29 | |
30 | void write_integer(raw_ostream &S, unsigned int N, size_t MinDigits, |
31 | IntegerStyle Style); |
32 | void write_integer(raw_ostream &S, int N, size_t MinDigits, IntegerStyle Style); |
33 | void write_integer(raw_ostream &S, unsigned long N, size_t MinDigits, |
34 | IntegerStyle Style); |
35 | void write_integer(raw_ostream &S, long N, size_t MinDigits, |
36 | IntegerStyle Style); |
37 | void write_integer(raw_ostream &S, unsigned long long N, size_t MinDigits, |
38 | IntegerStyle Style); |
39 | void write_integer(raw_ostream &S, long long N, size_t MinDigits, |
40 | IntegerStyle Style); |
41 | |
42 | void write_hex(raw_ostream &S, uint64_t N, HexPrintStyle Style, |
43 | Optional<size_t> Width = None); |
44 | void write_double(raw_ostream &S, double D, FloatStyle Style, |
45 | Optional<size_t> Precision = None); |
46 | } |
47 | |
48 | #endif |
49 | |
50 | |