[PATCH] D156604: [clang][ExprConst] Use call source range for 'in call to' diags
Timm Bäder via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Jul 29 21:04:00 PDT 2023
tbaeder created this revision.
tbaeder added reviewers: cjdb, aaron.ballman, hazohelet.
Herald added a project: All.
tbaeder requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Before:
array.cpp:74:15: error: static assertion expression is not an integral constant expression
74 | static_assert(ints(1, div(true, false), 2, div(false, true)) == 1, "");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
array.cpp:68:12: note: division by zero
68 | return 1 / (int)b;
| ^
array.cpp:74:23: note: in call to 'div(true, false)'
74 | static_assert(ints(1, div(true, false), 2, div(false, true)) == 1, "");
| ^
1 error generated.
After:
array.cpp:74:15: error: static assertion expression is not an integral constant expression
74 | static_assert(ints(1, div(true, false), 2, div(false, true)) == 1, "");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
array.cpp:68:12: note: division by zero
68 | return 1 / (int)b;
| ^
array.cpp:74:23: note: in call to 'div(true, false)'
74 | static_assert(ints(1, div(true, false), 2, div(false, true)) == 1, "");
| ^~~~~~~~~~~~~~~~
As you can see I have a test case, but I didn't attach it in `test/Misc/constexpr-source-ranges.cpp` because I can't get `-fdiagnostics-print-source-range-info` to actually print anything for them.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D156604
Files:
clang/lib/AST/ExprConstant.cpp
clang/lib/AST/Interp/Frame.h
clang/lib/AST/Interp/InterpFrame.cpp
clang/lib/AST/Interp/InterpFrame.h
clang/lib/AST/Interp/State.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156604.545400.patch
Type: text/x-patch
Size: 8013 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230730/0478f489/attachment-0001.bin>
More information about the cfe-commits
mailing list