Author: Timm Baeder Date: 2026-09-01T06:18:48+02:00 New Revision: d770d1ee93075afb93b7b41705daf37144cd3bd6
URL: https://github.com/llvm/llvm-project/commit/d770d1ee93075afb93b7b41705daf37144cd3bd6 DIFF: https://github.com/llvm/llvm-project/commit/d770d1ee93075afb93b7b41705daf37144cd3bd6.diff LOG: [clang][bytecode][NFC] Reorder Function members (#220001) Order them by size to save a few bytes and clarify some comments. Added: Modified: clang/lib/AST/ByteCode/Function.cpp clang/lib/AST/ByteCode/Function.h Removed: ################################################################################ diff --git a/clang/lib/AST/ByteCode/Function.cpp b/clang/lib/AST/ByteCode/Function.cpp index a609af5828d92..38b0ab7dfc7d6 100644 --- a/clang/lib/AST/ByteCode/Function.cpp +++ b/clang/lib/AST/ByteCode/Function.cpp @@ -18,8 +18,8 @@ using namespace clang::interp; Function::Function(FunctionDeclTy Source, unsigned ArgSize, llvm::SmallVectorImpl<ParamDescriptor> &&ParamDescriptors, bool HasThisPointer, bool HasRVO, bool IsLambdaStaticInvoker) - : Kind(FunctionKind::Normal), Source(Source), ArgSize(ArgSize), - ParamDescriptors(std::move(ParamDescriptors)), IsValid(false), + : Source(Source), ParamDescriptors(std::move(ParamDescriptors)), + ArgSize(ArgSize), Kind(FunctionKind::Normal), IsValid(false), IsFullyCompiled(false), HasThisPointer(HasThisPointer), HasRVO(HasRVO), HasBody(false), Defined(false) { diff --git a/clang/lib/AST/ByteCode/Function.h b/clang/lib/AST/ByteCode/Function.h index c9060c99a83d8..6215e1d684004 100644 --- a/clang/lib/AST/ByteCode/Function.h +++ b/clang/lib/AST/ByteCode/Function.h @@ -237,6 +237,8 @@ class Function final { bool isDefined() const { return Defined; } bool isVariadic() const { return Variadic; } + /// Returs the full number of parameters, including implicit instance and RVO + /// pointers. unsigned getNumParams() const { return ParamDescriptors.size() + hasThisPointer() + hasRVO(); } @@ -279,22 +281,22 @@ class Function final { friend class ByteCodeEmitter; friend class Context; - /// Function Kind. - FunctionKind Kind; /// Declaration this function was compiled from. FunctionDeclTy Source; - /// Local area size: storage + metadata. - unsigned FrameSize = 0; - /// Size of the argument stack. - unsigned ArgSize; /// Program code. llvm::SmallVector<std::byte> Code; /// Opcode-to-expression mapping. SourceMap SrcMap; /// List of block descriptors. llvm::SmallVector<Scope, 2> Scopes; - /// List of all parameters, including RVO and instance pointer. + /// List of all parameters, excluding RVO and instance pointer. llvm::SmallVector<ParamDescriptor> ParamDescriptors; + /// Local area size: storage + metadata. + unsigned FrameSize = 0; + /// Size of the argument stack. + unsigned ArgSize; + /// Function Kind. + FunctionKind Kind; /// Flag to indicate if the function is valid. LLVM_PREFERRED_TYPE(bool) unsigned IsValid : 1; _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
