Skip to content
Commit f6267d3b authored by Nick Desaulniers's avatar Nick Desaulniers
Browse files

[clang][CGExprConstant] handle implicit widening/narrowing Int-to-Int casts

Consider the following statements:
    long x = 1;
    short y = 1;

With the following AST:
    |-VarDecl 0x55d289973730 <x.c:1:1, col:10> col:6 x 'long' cinit
    | `-ImplicitCastExpr 0x55d289973800 <col:10> 'long' <IntegralCast>
    |   `-IntegerLiteral 0x55d2899737e0 <col:10> 'int' 1
    `-VarDecl 0x55d289973830 <line:2:1, col:11> col:7 y 'short' cinit
      `-ImplicitCastExpr 0x55d2899738b8 <col:11> 'short' <IntegralCast>
        `-IntegerLiteral 0x55d289973898 <col:11> 'int' 1

Sign or Zero extend or truncate based on the source signedness and
destination width.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D156466
parent 1e15d791
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment