-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[APInt] Fix APInt constructions where value does not fit bitwidth (NFCI) #80309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
9679519
665720f
2dba028
99d7e27
38e2027
796f5ef
1851f82
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3600,8 +3600,11 @@ ExprResult Sema::ActOnCharacterConstant(const Token &Tok, Scope *UDLScope) { | |
|
|
||
| ExprResult Sema::ActOnIntegerConstant(SourceLocation Loc, uint64_t Val) { | ||
| unsigned IntSize = Context.getTargetInfo().getIntWidth(); | ||
| return IntegerLiteral::Create(Context, llvm::APInt(IntSize, Val), | ||
| Context.IntTy, Loc); | ||
| // TODO: Avoid implicit trunc? | ||
| return IntegerLiteral::Create( | ||
| Context, | ||
| llvm::APInt(IntSize, Val, /*isSigned=*/false, /*implicitTrunc=*/true), | ||
|
||
| Context.IntTy, Loc); | ||
| } | ||
|
|
||
| static Expr *BuildFloatingLiteral(Sema &S, NumericLiteralParser &Literal, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
llvm::APInt(CHAR_BIT, (uint8_t)Data->BinaryData.back()), maybe?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, though I used
(unsigned char)to matchCHAR_BITmore closely.