Files
archived-llvm/include/llvm/Support/NativeFormatting.h
Zachary Turner b53c2b0d14 Resubmit "Add support for advanced number formatting."
This resubmits r284436 and r284437, which were reverted in
r284462 as they were breaking the AArch64 buildbot.

The breakage on AArch64 turned out to be a miscompile which is
still not fixed, but is actively tracked at llvm.org/pr30748.

This resubmission re-writes the code in a way so as to make the
miscompile not happen.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285483 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-29 00:27:22 +00:00

41 lines
1.4 KiB
C++

//===- NativeFormatting.h - Low level formatting helpers ---------*- C++-*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_SUPPORT_NATIVE_FORMATTING_H
#define LLVM_SUPPORT_NATIVE_FORMATTING_H
#include "llvm/ADT/Optional.h"
#include "llvm/Support/raw_ostream.h"
#include <cstdint>
namespace llvm {
enum class FloatStyle { Exponent, ExponentUpper, Fixed, Percent };
enum class IntegerStyle {
Integer,
Number,
};
enum class HexPrintStyle { Upper, Lower, PrefixUpper, PrefixLower };
size_t getDefaultPrecision(FloatStyle Style);
void write_integer(raw_ostream &S, unsigned int N, IntegerStyle Style);
void write_integer(raw_ostream &S, int N, IntegerStyle Style);
void write_integer(raw_ostream &S, unsigned long N, IntegerStyle Style);
void write_integer(raw_ostream &S, long N, IntegerStyle Style);
void write_integer(raw_ostream &S, unsigned long long N, IntegerStyle Style);
void write_integer(raw_ostream &S, long long N, IntegerStyle Style);
void write_hex(raw_ostream &S, uint64_t N, HexPrintStyle Style,
Optional<size_t> Width = None);
void write_double(raw_ostream &S, double D, FloatStyle Style,
Optional<size_t> Precision = None);
}
#endif