[llvm-commits] CVS: llvm/lib/Support/FileUtilities.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Mar 16 20:49:17 PST 2005



Changes in directory llvm/lib/Support:

FileUtilities.cpp updated: 1.43 -> 1.44
---
Log message:

Fix a bug where we would consider " .99" and "1.0" different because of the
leading whitespace.


---
Diffs of the changes:  (+9 -0)

 FileUtilities.cpp |    9 +++++++++
 1 files changed, 9 insertions(+)


Index: llvm/lib/Support/FileUtilities.cpp
diff -u llvm/lib/Support/FileUtilities.cpp:1.43 llvm/lib/Support/FileUtilities.cpp:1.44
--- llvm/lib/Support/FileUtilities.cpp:1.43	Tue Feb 15 16:12:10 2005
+++ llvm/lib/Support/FileUtilities.cpp	Wed Mar 16 22:49:04 2005
@@ -18,6 +18,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include <cmath>
 #include <cstring>
+#include <cctype>
 using namespace llvm;
 
 static bool isNumberChar(char C) {
@@ -47,6 +48,14 @@
                            std::string *ErrorMsg) {
   char *F1NumEnd, *F2NumEnd;
   double V1 = 0.0, V2 = 0.0; 
+
+  // If one of the positions is at a space and the other isn't, chomp up 'til
+  // the end of the space.
+  while (isspace(*F1P) && F1P != F1End)
+    ++F1P;
+  while (isspace(*F2P) && F2P != F2End)
+    ++F2P;
+
   // If we stop on numbers, compare their difference.
   if (isNumberChar(*F1P) && isNumberChar(*F2P)) {
     V1 = strtod(F1P, &F1NumEnd);






More information about the llvm-commits mailing list