[PATCH] D32276: [AsmWriter/APFloat] FP constant printing: Avoid usage of locale dependent snprinf

Tim Shen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 20 02:07:58 PDT 2017


timshen added a comment.

Have you considered making llvm::write_double() not to follow the user locale?



================
Comment at: include/llvm/ADT/APFloat.h:409
   void toString(SmallVectorImpl<char> &Str, unsigned FormatPrecision = 0,
-                unsigned FormatMaxPadding = 3) const;
+                unsigned FormatMaxPadding = 3, bool TruncateZero = true) const;
 
----------------
Can you document TruncateZero?


================
Comment at: lib/IR/AsmWriter.cpp:1126
         //
         if ((StrVal[0] >= '0' && StrVal[0] <= '9') ||
             ((StrVal[0] == '-' || StrVal[0] == '+') &&
----------------
skatkov wrote:
> Do we really need this check? To me it can be safely removed. Does anyone see the reason not to do that?
Alternatively we can turn it into an assertion.


https://reviews.llvm.org/D32276





More information about the llvm-commits mailing list