Use StringRef.getAsInteger instead of temporary string + strtol. No intended functionality change.
llvm-svn: 91118
This commit is contained in:
parent
9f13fc7d63
commit
8a4ad4adc1
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue