[PATCH] D152788: [Clang] Show type in enum out of range diagnostic
Dimitry Andric via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 13 02:02:53 PDT 2023
dim created this revision.
dim added reviewers: aaron.ballman, erichkeane, shafik, thakis.
Herald added a project: All.
dim requested review of this revision.
Herald added a project: clang.
When the diagnostic for an out of range enum value is printed, it
currently does not show the actual enum type in question, for example:
v8/src/base/bit-field.h:43:29: error: integer value 7 is outside the valid range of values [0, 3] for this enumeration type [-Wenum-constexpr-conversion]
static constexpr T kMax = static_cast<T>(kNumValues - 1);
^
This can make it cumbersome to find the cause for the problem. Add the
enum type to the diagnostic message, to make it easier.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D152788
Files:
clang/include/clang/Basic/DiagnosticASTKinds.td
clang/lib/AST/ExprConstant.cpp
clang/test/SemaCXX/constant-expression-cxx11.cpp
clang/test/SemaCXX/cxx2a-consteval.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152788.530823.patch
Type: text/x-patch
Size: 6241 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230613/062b5d74/attachment-0001.bin>
More information about the cfe-commits
mailing list