[clang] [Clang] fix range calculation for conditionals with throw expressions (PR #112081)
Oleksandr T. via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 17 13:34:36 PDT 2024
================
@@ -9827,6 +9827,9 @@ static IntRange GetExprRange(ASTContext &C, const Expr *E, unsigned MaxWidth,
return IntRange(BitField->getBitWidthValue(C),
BitField->getType()->isUnsignedIntegerOrEnumerationType());
----------------
a-tarasyuk wrote:
At this point, we get
```
ConditionalOperator 0x1108658e0 'int'
|-CXXBoolLiteralExpr 0x110865878 '_Bool' true
|-CXXThrowExpr 0x1108658a8 'void'
| `-IntegerLiteral 0x110865888 'int' 0
`-IntegerLiteral 0x1108658c0 'int' 0
```
nd as a result, `GetExprRange` proceeds with the throw expression (`CO->getTrueExpr()`)
https://github.com/llvm/llvm-project/blob/ed3d05178274890fb804f43ae1bcdfd33b5fd8f0/clang/lib/Sema/SemaChecking.cpp#L9628-L9631
https://github.com/llvm/llvm-project/pull/112081
More information about the cfe-commits
mailing list