[cfe-commits] r172924 - /cfe/trunk/lib/AST/CommentLexer.cpp

Dmitri Gribenko gribozavr at gmail.com
Sat Jan 19 14:06:06 PST 2013


Author: gribozavr
Date: Sat Jan 19 16:06:05 2013
New Revision: 172924

URL: http://llvm.org/viewvc/llvm-project?rev=172924&view=rev
Log:
Use llvm::hexDigitValue in comment lexer

Modified:
    cfe/trunk/lib/AST/CommentLexer.cpp

Modified: cfe/trunk/lib/AST/CommentLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CommentLexer.cpp?rev=172924&r1=172923&r2=172924&view=diff
==============================================================================
--- cfe/trunk/lib/AST/CommentLexer.cpp (original)
+++ cfe/trunk/lib/AST/CommentLexer.cpp Sat Jan 19 16:06:05 2013
@@ -1,6 +1,7 @@
 #include "clang/AST/CommentLexer.h"
 #include "clang/AST/CommentCommandTraits.h"
 #include "clang/Basic/ConvertUTF.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/Support/ErrorHandling.h"
 
@@ -65,12 +66,7 @@
     CodePoint *= 16;
     const char C = Name[i];
     assert(isHTMLHexCharacterReferenceCharacter(C));
-    if (C >= '0' && C <= '9')
-      CodePoint += Name[i] - '0';
-    else if (C >= 'a' && C <= 'f')
-      CodePoint += Name[i] - 'a' + 10;
-    else
-      CodePoint += Name[i] - 'A' + 10;
+    CodePoint += llvm::hexDigitValue(C);
   }
 
   char *Resolved = Allocator.Allocate<char>(UNI_MAX_UTF8_BYTES_PER_CODE_POINT);





More information about the cfe-commits mailing list