Author: Timm Bäder Date: 2023-02-03T14:30:05+01:00 New Revision: f63138d44429fc04bd2d7477f2e492f180d7aab3
URL: https://github.com/llvm/llvm-project/commit/f63138d44429fc04bd2d7477f2e492f180d7aab3 DIFF: https://github.com/llvm/llvm-project/commit/f63138d44429fc04bd2d7477f2e492f180d7aab3.diff LOG: [clang][Interp] Fix Pointer::toAPValue() for expressions Differential Revision: https://reviews.llvm.org/D141858 Added: Modified: clang/lib/AST/Interp/Pointer.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/Interp/Pointer.cpp b/clang/lib/AST/Interp/Pointer.cpp index e25b4f8b58449..8f1dfa346c632 100644 --- a/clang/lib/AST/Interp/Pointer.cpp +++ b/clang/lib/AST/Interp/Pointer.cpp @@ -103,6 +103,10 @@ APValue Pointer::toAPValue() const { if (isUnknownSizeArray()) { IsOnePastEnd = false; Offset = CharUnits::Zero(); + } else if (Desc->asExpr()) { + // Pointer pointing to a an expression. + IsOnePastEnd = false; + Offset = CharUnits::Zero(); } else { // TODO: compute the offset into the object. Offset = CharUnits::Zero(); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits