================ @@ -0,0 +1,112 @@ +//===------------------------- MemberPointer.h ------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_AST_INTERP_MEMBER_POINTER_H +#define LLVM_CLANG_AST_INTERP_MEMBER_POINTER_H + +#include "Pointer.h" +#include <optional> + +namespace clang { +class ASTContext; +namespace interp { + +class Context; +class FunctionPointer; + +class MemberPointer final { +private: + Pointer Base; + const Decl *Dcl = nullptr; + int32_t PtrOffset = 0; + + MemberPointer(Pointer Base, const Decl *Dcl, int32_t PtrOffset) + : Base(Base), Dcl(Dcl), PtrOffset(PtrOffset) {} + +public: + MemberPointer() = default; + MemberPointer(Pointer Base, const Decl *Dcl) : Base(Base), Dcl(Dcl) {} + MemberPointer(uint32_t Address, const Descriptor *D) { + // This should be impossible to hit, at least I've been unable + // to write a test for it. + } + + MemberPointer(const Decl *D) : Dcl(D) { + assert(isa<FieldDecl>(D) || isa<IndirectFieldDecl>(D) || + isa<CXXMethodDecl>(D)); ---------------- tbaederr wrote:
I made that change at least a few times locally, but it doesn't work: ``` /home/tbaeder/code/llvm-project/clang/lib/AST/Interp/MemberPointer.h:40:27: error: too many arguments provided to function-like macro invocation 40 | assert(isa<FieldDecl, IndirectFieldDecl, CXXMethodDecl>(D)); | ^ /usr/include/assert.h:99:11: note: macro 'assert' defined here 99 | # define assert(expr) \ | ^ ``` https://github.com/llvm/llvm-project/pull/91303 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits