https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/203672
>From 559178c6cc7182c32b77552f54c0df8db7abd91a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]> Date: Fri, 12 Jun 2026 15:31:19 +0200 Subject: [PATCH] func explicit flag --- clang/lib/AST/ByteCode/Function.cpp | 5 +++++ clang/lib/AST/ByteCode/Function.h | 18 ++++++------------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/clang/lib/AST/ByteCode/Function.cpp b/clang/lib/AST/ByteCode/Function.cpp index e08e2790dbd4f..cd0f7eb125230 100644 --- a/clang/lib/AST/ByteCode/Function.cpp +++ b/clang/lib/AST/ByteCode/Function.cpp @@ -29,12 +29,15 @@ Function::Function(Program &P, FunctionDeclTy Source, unsigned ArgSize, Constexpr = F->isConstexpr(); if (const auto *CD = dyn_cast<CXXConstructorDecl>(F)) { Virtual = CD->isVirtual(); + ExplicitThisPointer = CD->isExplicitObjectMemberFunction(); Kind = CD->isCopyOrMoveConstructor() ? FunctionKind::CopyOrMoveCtor : FunctionKind::Ctor; } else if (const auto *CD = dyn_cast<CXXDestructorDecl>(F)) { + ExplicitThisPointer = CD->isExplicitObjectMemberFunction(); Virtual = CD->isVirtual(); Kind = FunctionKind::Dtor; } else if (const auto *MD = dyn_cast<CXXMethodDecl>(F)) { + ExplicitThisPointer = MD->isExplicitObjectMemberFunction(); Virtual = MD->isVirtual(); if (IsLambdaStaticInvoker) Kind = FunctionKind::LambdaStaticInvoker; @@ -43,9 +46,11 @@ Function::Function(Program &P, FunctionDeclTy Source, unsigned ArgSize, else if (MD->isCopyAssignmentOperator() || MD->isMoveAssignmentOperator()) Kind = FunctionKind::CopyOrMoveOperator; } else { + ExplicitThisPointer = false; Virtual = false; } } else { + ExplicitThisPointer = false; Variadic = false; Virtual = false; Immediate = false; diff --git a/clang/lib/AST/ByteCode/Function.h b/clang/lib/AST/ByteCode/Function.h index d9a286937cadd..289bd64124004 100644 --- a/clang/lib/AST/ByteCode/Function.h +++ b/clang/lib/AST/ByteCode/Function.h @@ -224,6 +224,10 @@ class Function final { bool isFullyCompiled() const { return IsFullyCompiled; } bool hasThisPointer() const { return HasThisPointer; } + bool isThisPointerExplicit() const { return ExplicitThisPointer; } + bool hasImplicitThisParam() const { + return hasThisPointer() && !ExplicitThisPointer; + } /// Checks if the function already has a body attached. bool hasBody() const { return HasBody; } @@ -232,7 +236,6 @@ class Function final { bool isDefined() const { return Defined; } bool isVariadic() const { return Variadic; } - unsigned getNumParams() const { return ParamDescriptors.size() + hasThisPointer() + hasRVO(); } @@ -247,17 +250,6 @@ class Function final { return ArgSize - (align(primSize(PT_Ptr)) * (hasThisPointer() + hasRVO())); } - bool isThisPointerExplicit() const { - if (const auto *MD = dyn_cast_if_present<CXXMethodDecl>( - dyn_cast<const FunctionDecl *>(Source))) - return MD->isExplicitObjectMemberFunction(); - return false; - } - - bool hasImplicitThisParam() const { - return hasThisPointer() && !isThisPointerExplicit(); - } - private: /// Construct a function representing an actual function. Function(Program &P, FunctionDeclTy Source, unsigned ArgSize, @@ -315,6 +307,8 @@ class Function final { /// as the first implicit argument LLVM_PREFERRED_TYPE(bool) unsigned HasThisPointer : 1; + LLVM_PREFERRED_TYPE(bool) + unsigned ExplicitThisPointer : 1; /// Whether this function has Return Value Optimization, i.e. /// the return value is constructed in the caller's stack frame. /// This is done for functions that return non-primive values. _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
