[PATCH] D15375: Fix PR #25788: parsing of floating-point constants on non-C locales

Antoine Pitrou via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 16 10:28:28 PST 2015


pitrou updated this revision to Diff 43028.
pitrou added a comment.

Here is an updated patch without the locale-changing test.


http://reviews.llvm.org/D15375

Files:
  lib/AsmParser/LLLexer.cpp

Index: lib/AsmParser/LLLexer.cpp
===================================================================
--- lib/AsmParser/LLLexer.cpp
+++ lib/AsmParser/LLLexer.cpp
@@ -937,7 +937,8 @@
     }
   }
 
-  APFloatVal = APFloat(std::atof(TokStart));
+  APFloatVal = APFloat(APFloat::IEEEdouble,
+                       StringRef(TokStart, CurPtr - TokStart));
   return lltok::APFloat;
 }
 
@@ -973,6 +974,7 @@
     }
   }
 
-  APFloatVal = APFloat(std::atof(TokStart));
+  APFloatVal = APFloat(APFloat::IEEEdouble,
+                       StringRef(TokStart, CurPtr - TokStart));
   return lltok::APFloat;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15375.43028.patch
Type: text/x-patch
Size: 601 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151216/fb61a101/attachment.bin>


More information about the llvm-commits mailing list