]> granicus.if.org Git - clang/commitdiff
Use StringRef.getAsInteger instead of temporary string + strtol. No intended function...
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 11 Dec 2009 13:26:32 +0000 (13:26 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 11 Dec 2009 13:26:32 +0000 (13:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91118 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ExprConstant.cpp

index ea30b193094a1aa241e10721fb45b5bbbc8b8a8d..13831dc1f52cdb78d5a1ac8c0107b3fdbf9df631 100644 (file)
@@ -1548,16 +1548,10 @@ bool FloatExprEvaluator::VisitCallExpr(const CallExpr *E) {
       if (!S->isWide()) {
         const llvm::fltSemantics &Sem =
           Info.Ctx.getFloatTypeSemantics(E->getType());
-        llvm::SmallString<16> s;
-        s.append(S->getStrData(), S->getStrData() + S->getByteLength());
-        s += '\0';
-        long l;
-        char *endp;
-        l = strtol(&s[0], &endp, 0);
-        if (endp != s.end()-1)
+        unsigned Type = 0;
+        if (!S->getString().empty() && S->getString().getAsInteger(0, Type))
           return false;
-        unsigned type = (unsigned int)l;;
-        Result = llvm::APFloat::getNaN(Sem, false, type);
+        Result = llvm::APFloat::getNaN(Sem, false, Type);
         return true;
       }
     }