================
@@ -1536,97 +1536,55 @@ static void writeOptimizationInfo(raw_ostream &Out,
const User *U) {
}
}
-static void writeAPFloatInternal(raw_ostream &Out, const APFloat &APF) {
- if (&APF.getSemantics() == &APFloat::IEEEsingle() ||
- &APF.getSemantics() == &APFloat::IEEEdouble()) {
- // We would like to output the FP constant value in exponential notation,
- // but we cannot do this if doing so will lose precision. Check here to
- // make sure that we only output it in exponential format if we can parse
- // the value back and get the same value.
- //
- bool ignored;
- bool isDouble = &APF.getSemantics() == &APFloat::IEEEdouble();
- bool isInf = APF.isInfinity();
- bool isNaN = APF.isNaN();
-
- if (!isInf && !isNaN) {
- double Val = APF.convertToDouble();
- SmallString<128> StrVal;
- APF.toString(StrVal, 6, 0, false);
- // Check to make sure that the stringized number is not some string like
- // "Inf" or NaN, that atof will accept, but the lexer will not. Check
- // that the string matches the "[-+]?[0-9]" regex.
- //
- assert((isDigit(StrVal[0]) ||
- ((StrVal[0] == '-' || StrVal[0] == '+') && isDigit(StrVal[1])))
&&
- "[-+]?[0-9] regex does not match!");
- // Reparse stringized version!
- if (APFloat(APFloat::IEEEdouble(), StrVal).convertToDouble() == Val) {
- Out << StrVal;
- return;
- }
- }
+static void WriteFullHexAPInt(raw_ostream &Out, const APInt &Val) {
+ SmallVector<char, 32> Bits;
+ Val.toStringUnsigned(Bits, 16);
+ unsigned NumDigits = std::max((Val.getBitWidth() + 3) / 4, 1U);
+ Out << "0x";
+ for (unsigned i = 0; i < NumDigits - Bits.size(); i++)
+ Out << "0";
----------------
arsenm wrote:
```suggestion
Out << '0';
```
https://github.com/llvm/llvm-project/pull/190649
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits