[all-commits] [llvm/llvm-project] 769333: [clang][CGExprConstant] handle unary negation on i...

Nick Desaulniers via All-commits all-commits at lists.llvm.org
Mon Aug 7 14:51:18 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 769333aeeb4508a39ce61cde5d70d880f9abfc35
      https://github.com/llvm/llvm-project/commit/769333aeeb4508a39ce61cde5d70d880f9abfc35
  Author: Nick Desaulniers <ndesaulniers at google.com>
  Date:   2023-08-07 (Mon, 07 Aug 2023)

  Changed paths:
    M clang/lib/CodeGen/CGExprConstant.cpp

  Log Message:
  -----------
  [clang][CGExprConstant] handle unary negation on integrals

Consider the statement:
    int x = -1;
And the following AST:
    `-VarDecl 0x55c4823a7670 <x.c:2:1, col:10> col:5 x 'int' cinit
      `-UnaryOperator 0x55c4823a7740 <col:9, col:10> 'int' prefix '-'
        `-IntegerLiteral 0x55c4823a7720 <col:10> 'int' 1

Return the evaluation of the subexpression negated.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D156378




More information about the All-commits mailing list