[PATCH] D136532: [clang][Interp] Implement left and right shifts

2022-10-30 Thread Timm Bäder via Phabricator via cfe-commits
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=

[PATCH] D136532: [clang][Interp] Implement left and right shifts

2022-10-27 Thread Shafik Yaghmour via Phabricator via cfe-commits
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

[PATCH] D136532: [clang][Interp] Implement left and right shifts

2022-10-27 Thread Aaron Ballman via Phabricator via cfe-commits
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

[PATCH] D136532: [clang][Interp] Implement left and right shifts

2022-10-27 Thread Timm Bäder via Phabricator via cfe-commits
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

[PATCH] D136532: [clang][Interp] Implement left and right shifts

2022-10-27 Thread Timm Bäder via Phabricator via cfe-commits
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

[PATCH] D136532: [clang][Interp] Implement left and right shifts

2022-10-27 Thread Aaron Ballman via Phabricator via cfe-commits
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,

[PATCH] D136532: [clang][Interp] Implement left and right shifts

2022-10-27 Thread Timm Bäder via Phabricator via cfe-commits
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

[PATCH] D136532: [clang][Interp] Implement left and right shifts

2022-10-27 Thread Timm Bäder via Phabricator via cfe-commits
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

[PATCH] D136532: [clang][Interp] Implement left and right shifts

2022-10-26 Thread Aaron Ballman via Phabricator via cfe-commits
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 {{

[PATCH] D136532: [clang][Interp] Implement left and right shifts

2022-10-26 Thread Shafik Yaghmour via Phabricator via cfe-commits
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

[PATCH] D136532: [clang][Interp] Implement left and right shifts

2022-10-26 Thread Aaron Ballman via Phabricator via cfe-commits
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 {{

[PATCH] D136532: [clang][Interp] Implement left and right shifts

2022-10-25 Thread Shafik Yaghmour via Phabricator via cfe-commits
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

[PATCH] D136532: [clang][Interp] Implement left and right shifts

2022-10-25 Thread Aaron Ballman via Phabricator via cfe-commits
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 {{

[PATCH] D136532: [clang][Interp] Implement left and right shifts

2022-10-25 Thread Timm Bäder via Phabricator via cfe-commits
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

[PATCH] D136532: [clang][Interp] Implement left and right shifts

2022-10-25 Thread Timm Bäder via Phabricator via cfe-commits
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

[PATCH] D136532: [clang][Interp] Implement left and right shifts

2022-10-24 Thread Shafik Yaghmour via Phabricator via cfe-commits
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}} \ +

[PATCH] D136532: [clang][Interp] Implement left and right shifts

2022-10-24 Thread Shafik Yaghmour via Phabricator via cfe-commits
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

[PATCH] D136532: [clang][Interp] Implement left and right shifts

2022-10-24 Thread Aaron Ballman via Phabricator via cfe-commits
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

[PATCH] D136532: [clang][Interp] Implement left and right shifts

2022-10-22 Thread Timm Bäder via Phabricator via cfe-commits
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`.