llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>

Order them by size to save a few bytes and clarify some comments.

---
Full diff: https://github.com/llvm/llvm-project/pull/220001.diff


2 Files Affected:

- (modified) clang/lib/AST/ByteCode/Function.cpp (+2-2) 
- (modified) clang/lib/AST/ByteCode/Function.h (+9-7) 


``````````diff
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;

``````````

</details>


https://github.com/llvm/llvm-project/pull/220001
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to