Commit 1fc3a4d
Automerge: [Clang] Fix APSInt width of template argument in FinishCXXExpansionStmt() (#208859)
After merging #169680, we started getting assertions in
IntegerLiteral::Create() on some ARM systems:
```
Assertion `V.getBitWidth() == C.getIntWidth(type) &&
"Integer type is not the correct size for constant."'
```
The expansion statements patch doesn't ever create an IntegerLiteral
directly, but there is one place where we create a TemplateArgument of
type 'ptrdiff_t', but we unconditionally set the bit width of its APSInt
to 64 bits.
Presumably, the assertion is due to 'ptrdiff_t' not being a 64-bit type
on these systems, so make sure that we query its bit width and use that
as the width of the APSInt.
I don't have a way of verifying if this patch fixes the CI issue since
pre-commit CI doesn't run on the affected system and I don't have an ARM
machine, but I'm merging this anyway since this issue is breaking CI and
querying the width of 'ptrdiff_t' is something we should be doing here regardless.1 file changed
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
558 | 558 | | |
559 | 559 | | |
560 | 560 | | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
561 | 564 | | |
562 | | - | |
563 | | - | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
564 | 568 | | |
565 | 569 | | |
566 | 570 | | |
| |||
0 commit comments