[PATCH] D153954: [clang][analyzer] Fix empty enum handling in EnumCastOutOfRange checker

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 3 05:47:37 PDT 2023


steakhal accepted this revision.
steakhal added a comment.

LGTM



================
Comment at: clang/test/Analysis/enum-cast-out-of-range.cpp:203
+
+enum class empty_unfixed {};
+
----------------
donat.nagy wrote:
> Consider using "specified" and "unspecified" instead of "fixed" and "unfixed", because the rest of the test file uses them and in my opinion "unfixed" looks strange in this context.  (I know that e.g. https://en.cppreference.com/w/cpp/language/enum speaks about "fixed" underlying context, but it doesn't use "unfixed".) 
How about calling it "plain" or "common"?


================
Comment at: clang/test/Analysis/enum-cast-out-of-range.cpp:212-214
+  empty_unfixed eu = static_cast<empty_unfixed>(0); //should always be OK to zero initialize any enum
+  empty_fixed ef = static_cast<empty_fixed>(0);
+  empty_fixed_unsigned efu = static_cast<empty_fixed_unsigned>(0);
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153954/new/

https://reviews.llvm.org/D153954



More information about the cfe-commits mailing list