This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6d965c94ba58: [clang][Interp] Implement left and right
shifts (authored by tbaeder).
Changed prior to commit:
https://reviews.llvm.org/D136532?vs=
shafik accepted this revision.
shafik added a comment.
LGTM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136532/new/
https://reviews.llvm.org/D136532
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mail
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.
LGTM!
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136532/new/
https://reviews.llvm.org/D136532
___
cfe-commits mailing lis
tbaeder added inline comments.
Comment at: clang/lib/AST/Interp/Interp.h:1291-1305
+ if (RHS.isNegative()) {
const SourceInfo &Loc = S.Current->getSource(OpPC);
S.CCEDiag(Loc, diag::note_constexpr_negative_shift) << RHS.toAPSInt();
-return ShiftLeft(S, OpPC, LHS, T
tbaeder updated this revision to Diff 471138.
tbaeder marked 5 inline comments as done.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136532/new/
https://reviews.llvm.org/D136532
Files:
clang/lib/AST/Interp/ByteCodeExprGen.cpp
clang/lib/AST/Interp/Interp.h
clang/lib/AST/Interp/Opco
aaron.ballman added inline comments.
Comment at: clang/lib/AST/Interp/Interp.h:1291-1305
+ if (RHS.isNegative()) {
const SourceInfo &Loc = S.Current->getSource(OpPC);
S.CCEDiag(Loc, diag::note_constexpr_negative_shift) << RHS.toAPSInt();
-return ShiftLeft(S, OpPC,
tbaeder added inline comments.
Comment at: clang/test/AST/Interp/shifts.cpp:57
+//c >>= 99; // expected-warning {{shift count >= width of type}}
+//c <<= CHAR_BIT; // expected-warning {{shift count >= width of type}}
+//c >>= CHAR_BIT; // expected-warning {{shift
tbaeder updated this revision to Diff 471113.
tbaeder marked 3 inline comments as done.
tbaeder added a comment.
Added suport for `>>=` and `<<=` as well so the test cases for those can be
enabled.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136532/new/
https://reviews.llvm.org/D1365
aaron.ballman added inline comments.
Comment at: clang/test/AST/Interp/shifts.cpp:57
+//c >>= 99; // expected-warning {{shift count >= width of type}}
+//c <<= CHAR_BIT; // expected-warning {{shift count >= width of type}}
+//c >>= CHAR_BIT; // expected-warning {{
shafik added inline comments.
Comment at: clang/test/AST/Interp/shifts.cpp:57
+//c >>= 99; // expected-warning {{shift count >= width of type}}
+//c <<= CHAR_BIT; // expected-warning {{shift count >= width of type}}
+//c >>= CHAR_BIT; // expected-warning {{shift c
aaron.ballman added inline comments.
Comment at: clang/test/AST/Interp/shifts.cpp:57
+//c >>= 99; // expected-warning {{shift count >= width of type}}
+//c <<= CHAR_BIT; // expected-warning {{shift count >= width of type}}
+//c >>= CHAR_BIT; // expected-warning {{
shafik added inline comments.
Comment at: clang/test/AST/Interp/shifts.cpp:57
+//c >>= 99; // expected-warning {{shift count >= width of type}}
+//c <<= CHAR_BIT; // expected-warning {{shift count >= width of type}}
+//c >>= CHAR_BIT; // expected-warning {{shift c
aaron.ballman added inline comments.
Comment at: clang/test/AST/Interp/shifts.cpp:57
+//c >>= 99; // expected-warning {{shift count >= width of type}}
+//c <<= CHAR_BIT; // expected-warning {{shift count >= width of type}}
+//c >>= CHAR_BIT; // expected-warning {{
tbaeder updated this revision to Diff 470391.
tbaeder added a comment.
Excuse the code duplication here, I'll get rid of it as soon as we all agree
that the functionality is correct.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136532/new/
https://reviews.llvm.org/D136532
Files:
cl
tbaeder added inline comments.
Comment at: clang/lib/AST/Interp/Interp.h:1246-1256
if (V.isSigned() && !S.getLangOpts().CPlusPlus20) {
// C++11 [expr.shift]p2: A signed left shift must have a non-negative
// operand, and must not overflow the corresponding unsigned t
shafik added inline comments.
Comment at: clang/test/AST/Interp/shifts.cpp:70
+i = 1 << (WORD_BIT - 1); // cxx17-warning-not {{sets the sign bit of the
shift expression}}
+i = -1 << (WORD_BIT - 1); // cxx17-warning {{shifting a negative signed
value is undefined}} \
+
shafik added inline comments.
Comment at: clang/test/AST/Interp/shifts.cpp:57
+//c >>= 99; // expected-warning {{shift count >= width of type}}
+//c <<= CHAR_BIT; // expected-warning {{shift count >= width of type}}
+//c >>= CHAR_BIT; // expected-warning {{shift c
aaron.ballman added inline comments.
Comment at: clang/lib/AST/Interp/Interp.h:1236-1237
inline bool ShiftRight(InterpState &S, CodePtr OpPC, const T &V, unsigned RHS)
{
if (RHS >= V.bitWidth()) {
S.Stk.push(T::from(0, V.bitWidth()));
} else {
This d
tbaeder created this revision.
tbaeder added reviewers: aaron.ballman, erichkeane, tahonermann, shafik.
Herald added a project: All.
tbaeder requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Add a test case based on `test/SemaCXX/shift.cpp`.
19 matches
Mail list logo