[all-commits] [llvm/llvm-project] 9a440f: [analyzer] Ignore [[clang::flag_enum]] enums in th...

Balazs Benics via All-commits all-commits at lists.llvm.org
Sun May 25 03:00:12 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9a440f84773c56d3803f330774acb2b4f471d5b4
      https://github.com/llvm/llvm-project/commit/9a440f84773c56d3803f330774acb2b4f471d5b4
  Author: Balazs Benics <benicsbalazs at gmail.com>
  Date:   2025-05-25 (Sun, 25 May 2025)

  Changed paths:
    M clang/docs/analyzer/checkers.rst
    M clang/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp
    M clang/test/Analysis/enum-cast-out-of-range.c
    M clang/test/Analysis/enum-cast-out-of-range.cpp

  Log Message:
  -----------
  [analyzer] Ignore [[clang::flag_enum]] enums in the EnumCastOutOfRange checker (#141232)

Resolves
https://github.com/llvm/llvm-project/issues/76208#issuecomment-2830854351

Quoting the docs of `[[clang::flag_enum]]`:
https://clang.llvm.org/docs/AttributeReference.html#flag-enum

> This attribute can be added to an enumerator to signal to the compiler that it
> is intended to be used as a flag type. This will cause the compiler to assume
> that the range of the type includes all of the values that you can get by
> manipulating bits of the enumerator when issuing warnings.

Ideally, we should still check the upper bounds but for simplicity let's not bother for now.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list