[clang] 9bdbb82 - [clang][Interp][NFC] Use isArrayRoot() when comparing pointers
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 20 04:17:59 PST 2023
Author: Timm Bäder
Date: 2023-11-20T13:17:47+01:00
New Revision: 9bdbb8226e70fb248b40a4b5002699ee9eeeda93
URL: https://github.com/llvm/llvm-project/commit/9bdbb8226e70fb248b40a4b5002699ee9eeeda93
DIFF: https://github.com/llvm/llvm-project/commit/9bdbb8226e70fb248b40a4b5002699ee9eeeda93.diff
LOG: [clang][Interp][NFC] Use isArrayRoot() when comparing pointers
The previous code was just an open-coded version of isArrayRoot().
Added:
Modified:
clang/lib/AST/Interp/Interp.h
Removed:
################################################################################
diff --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h
index 026a95d65488da9..64b376e101c8720 100644
--- a/clang/lib/AST/Interp/Interp.h
+++ b/clang/lib/AST/Interp/Interp.h
@@ -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
diff erent 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))));
More information about the cfe-commits
mailing list