[PATCH] D130058: [Clang] Diagnose ill-formed constant expression when setting a non fixed enum to a value outside the range of the enumeration values

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 28 11:24:41 PDT 2022


shafik updated this revision to Diff 448390.
shafik added a comment.

- dyn_cast was not seeing through type sugar switch to `isEnumeralType()`
- `APInt` requires the bit widths to be the same when comparing and so switched to obtaining the value from `Result` from just `getInt()` to `getInt().getSExtValue()` and `getInt().getZExtValue()` which uses the `int64_t` and `uint64_t` overloads.
- Updated some more tests that were failing after fixing the other issues.


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

https://reviews.llvm.org/D130058

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/AST/Decl.h
  clang/include/clang/Basic/DiagnosticASTKinds.td
  clang/lib/AST/Decl.cpp
  clang/lib/AST/ExprConstant.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/test/Analysis/cfg.cpp
  clang/test/Sema/aarch64-sve-intrinsics/acle_sve_imm.cpp
  clang/test/SemaCXX/constant-expression-cxx11.cpp
  clang/test/SemaCXX/enum-scoped.cpp
  clang/test/SemaTemplate/temp_arg_enum_printing.cpp
  clang/www/cxx_dr_status.html
  cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130058.448390.patch
Type: text/x-patch
Size: 13483 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220728/5d5d4217/attachment-0001.bin>


More information about the cfe-commits mailing list