Use StringRef.getAsInteger instead of temporary string + strtol. No intended functionality change.

llvm-svn: 91118
This commit is contained in:
Benjamin Kramer 2009-12-11 13:26:32 +00:00
parent 9f13fc7d63
commit 8a4ad4adc1
1 changed files with 3 additions and 9 deletions

View 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;
}
}