mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() and
zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method trunc(), to be const and to return a new value instead of modifying the object in place. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121120 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -682,7 +682,7 @@ lltok::Kind LLLexer::LexIdentifier() {
|
||||
APInt Tmp(bits, StringRef(TokStart+3, len), 16);
|
||||
uint32_t activeBits = Tmp.getActiveBits();
|
||||
if (activeBits > 0 && activeBits < bits)
|
||||
Tmp.trunc(activeBits);
|
||||
Tmp = Tmp.trunc(activeBits);
|
||||
APSIntVal = APSInt(Tmp, TokStart[0] == 'u');
|
||||
return lltok::APSInt;
|
||||
}
|
||||
@@ -809,12 +809,12 @@ lltok::Kind LLLexer::LexDigitOrNegative() {
|
||||
if (TokStart[0] == '-') {
|
||||
uint32_t minBits = Tmp.getMinSignedBits();
|
||||
if (minBits > 0 && minBits < numBits)
|
||||
Tmp.trunc(minBits);
|
||||
Tmp = Tmp.trunc(minBits);
|
||||
APSIntVal = APSInt(Tmp, false);
|
||||
} else {
|
||||
uint32_t activeBits = Tmp.getActiveBits();
|
||||
if (activeBits > 0 && activeBits < numBits)
|
||||
Tmp.trunc(activeBits);
|
||||
Tmp = Tmp.trunc(activeBits);
|
||||
APSIntVal = APSInt(Tmp, true);
|
||||
}
|
||||
return lltok::APSInt;
|
||||
|
@@ -2575,7 +2575,7 @@ bool LLParser::ConvertValIDToValue(const Type *Ty, ValID &ID, Value *&V,
|
||||
case ValID::t_APSInt:
|
||||
if (!Ty->isIntegerTy())
|
||||
return Error(ID.Loc, "integer constant must have integer type");
|
||||
ID.APSIntVal.extOrTrunc(Ty->getPrimitiveSizeInBits());
|
||||
ID.APSIntVal = ID.APSIntVal.extOrTrunc(Ty->getPrimitiveSizeInBits());
|
||||
V = ConstantInt::get(Context, ID.APSIntVal);
|
||||
return false;
|
||||
case ValID::t_APFloat:
|
||||
|
Reference in New Issue
Block a user