Skip to content

Commit

Permalink
[clang][Interp][NFC] Use isArrayRoot() when comparing pointers
Browse files Browse the repository at this point in the history
The previous code was just an open-coded version of isArrayRoot().
  • Loading branch information
tbaederr committed Nov 20, 2023
1 parent cfee715 commit 9bdbb82
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clang/lib/AST/Interp/Interp.h
Original file line number Diff line number Diff line change
Expand Up @@ -770,9 +770,9 @@ inline bool CmpHelperEQ<Pointer>(InterpState &S, CodePtr OpPC, CompareFn Fn) {
// element in the same array are NOT equal. They have the same Base value,
// but a different Offset. This is a pretty rare case, so we fix this here
// by comparing pointers to the first elements.
if (LHS.inArray() && LHS.isRoot())
if (LHS.isArrayRoot())
VL = LHS.atIndex(0).getByteOffset();
if (RHS.inArray() && RHS.isRoot())
if (RHS.isArrayRoot())
VR = RHS.atIndex(0).getByteOffset();

S.Stk.push<BoolT>(BoolT::from(Fn(Compare(VL, VR))));
Expand Down

0 comments on commit 9bdbb82

Please sign in to comment.