[llvm-commits] [llvm] r73856 - /llvm/trunk/utils/TableGen/TGLexer.cpp

Chris Lattner sabre at nondot.org
Sun Jun 21 12:22:49 PDT 2009


Author: lattner
Date: Sun Jun 21 14:22:49 2009
New Revision: 73856

URL: http://llvm.org/viewvc/llvm-project?rev=73856&view=rev
Log:
simplify some error recovery stuff.

Modified:
    llvm/trunk/utils/TableGen/TGLexer.cpp

Modified: llvm/trunk/utils/TableGen/TGLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGLexer.cpp?rev=73856&r1=73855&r2=73856&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/TGLexer.cpp (original)
+++ llvm/trunk/utils/TableGen/TGLexer.cpp Sun Jun 21 14:22:49 2009
@@ -15,7 +15,6 @@
 #include "llvm/Support/SourceMgr.h"
 #include "llvm/Support/Streams.h"
 #include "llvm/Support/MemoryBuffer.h"
-#include <ostream>
 #include "llvm/Config/config.h"
 #include <cctype>
 #include <cstdio>
@@ -353,19 +352,19 @@
       
       // Requires at least one hex digit.
       if (CurPtr == NumStart)
-        return ReturnError(CurPtr-2, "Invalid hexadecimal number");
+        return ReturnError(TokStart, "Invalid hexadecimal number");
 
       errno = 0;
       CurIntVal = strtoll(NumStart, 0, 16);
       if (errno == EINVAL)
-        return ReturnError(CurPtr-2, "Invalid hexadecimal number");
+        return ReturnError(TokStart, "Invalid hexadecimal number");
       if (errno == ERANGE) {
         errno = 0;
         CurIntVal = (int64_t)strtoull(NumStart, 0, 16);
         if (errno == EINVAL)
-          return ReturnError(CurPtr-2, "Invalid hexadecimal number");
+          return ReturnError(TokStart, "Invalid hexadecimal number");
         if (errno == ERANGE)
-          return ReturnError(CurPtr-2, "Hexadecimal number out of range");
+          return ReturnError(TokStart, "Hexadecimal number out of range");
       }
       return tgtok::IntVal;
     } else if (CurPtr[0] == 'b') {





More information about the llvm-commits mailing list