This is an archive of the discontinued LLVM Phabricator instance.

[clang][Interp] Implement bitwise Not operations
ClosedPublic

Authored by tbaeder on Sep 28 2022, 5:32 AM.

Diff Detail

Event Timeline

tbaeder created this revision.Sep 28 2022, 5:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 28 2022, 5:32 AM
tbaeder requested review of this revision.Sep 28 2022, 5:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 28 2022, 5:32 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
tbaeder updated this revision to Diff 463515.Sep 28 2022, 5:40 AM
shafik added inline comments.Sep 28 2022, 10:21 AM
clang/test/AST/Interp/literals.cpp
76

Some more tests covering ~INT_MIN == INT_MAX and vice versa and unscoped enum case as well e.g.

enum E {};
E e = static_cast<E>(0);
static_assert(~e == -1, "");
shafik accepted this revision.Sep 28 2022, 10:22 AM

Otherwise LGTM

This revision is now accepted and ready to land.Sep 28 2022, 10:22 AM
tbaeder updated this revision to Diff 463791.Sep 29 2022, 1:19 AM
tbaeder marked an inline comment as done.

LGTM aside from a question about naming.

clang/lib/AST/Interp/Integral.h
215–218

Can we name this one complement instead of not -- when I hear not I think ! and not ~.

clang/lib/AST/Interp/Interp.h
187
189

Same naming request here.

clang/lib/AST/Interp/Opcodes.td
415

Here too.

tbaeder updated this revision to Diff 464155.Sep 30 2022, 12:02 AM
tbaeder marked 4 inline comments as done.
This revision was landed with ongoing or failed builds.Oct 14 2022, 4:01 AM
This revision was automatically updated to reflect the committed changes.