[all-commits] [llvm/llvm-project] aea82d: [Clang] Fix how we set the NumPositiveBits on an E...

Shafik Yaghmour via All-commits all-commits at lists.llvm.org
Mon Jul 25 16:01:30 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: aea82d4551139ded0290afab739f0b367d055628
      https://github.com/llvm/llvm-project/commit/aea82d4551139ded0290afab739f0b367d055628
  Author: Shafik Yaghmour <shafik.yaghmour at intel.com>
  Date:   2022-07-25 (Mon, 25 Jul 2022)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/SemaDecl.cpp
    M clang/test/CodeGenCXX/pr12251.cpp
    M compiler-rt/test/ubsan/TestCases/Misc/enum.cpp

  Log Message:
  -----------
  [Clang] Fix how we set the NumPositiveBits on an EnumDecl to cover the case of single enumerator with value zero or an empty enum

Currently in Sema::ActOnEnumBody(...) when calculating NumPositiveBits we miss
the case where there is only a single enumerator with value zero and the case of
an empty enum. In both cases we end up with zero positive bits when in fact we
need one bit to store the value zero.

This PR updates the calculation to account for these cases.

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




More information about the All-commits mailing list