[clang] 202ff42 - [clang][Interp] Rename a local variable to be more specific

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 29 03:51:33 PDT 2022


Author: Timm Bäder
Date: 2022-09-29T12:50:56+02:00
New Revision: 202ff42f8990fb0bd0236a413c30dab357fd809a

URL: https://github.com/llvm/llvm-project/commit/202ff42f8990fb0bd0236a413c30dab357fd809a
DIFF: https://github.com/llvm/llvm-project/commit/202ff42f8990fb0bd0236a413c30dab357fd809a.diff

LOG: [clang][Interp] Rename a local variable to be more specific

It's called BaseSize in the Record class as well, so call it BaseSize
when creating the Record.

Added: 
    

Modified: 
    clang/lib/AST/Interp/Program.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/Program.cpp b/clang/lib/AST/Interp/Program.cpp
index aa700a1ce9e6..e0dbdaa9a118 100644
--- a/clang/lib/AST/Interp/Program.cpp
+++ b/clang/lib/AST/Interp/Program.cpp
@@ -234,7 +234,7 @@ Record *Program::getOrCreateRecord(const RecordDecl *RD) {
   }
 
   // Number of bytes required by fields and base classes.
-  unsigned Size = 0;
+  unsigned BaseSize = 0;
   // Number of bytes required by virtual base.
   unsigned VirtSize = 0;
 
@@ -258,9 +258,9 @@ Record *Program::getOrCreateRecord(const RecordDecl *RD) {
       const RecordDecl *BD = Spec.getType()->castAs<RecordType>()->getDecl();
       Record *BR = getOrCreateRecord(BD);
       if (Descriptor *Desc = GetBaseDesc(BD, BR)) {
-        Size += align(sizeof(InlineDescriptor));
-        Bases.push_back({BD, Size, Desc, BR});
-        Size += align(BR->getSize());
+        BaseSize += align(sizeof(InlineDescriptor));
+        Bases.push_back({BD, BaseSize, Desc, BR});
+        BaseSize += align(BR->getSize());
         continue;
       }
       return nullptr;
@@ -284,7 +284,7 @@ Record *Program::getOrCreateRecord(const RecordDecl *RD) {
   Record::FieldList Fields;
   for (const FieldDecl *FD : RD->fields()) {
     // Reserve space for the field's descriptor and the offset.
-    Size += align(sizeof(InlineDescriptor));
+    BaseSize += align(sizeof(InlineDescriptor));
 
     // Classify the field and add its metadata.
     QualType FT = FD->getType();
@@ -300,12 +300,12 @@ Record *Program::getOrCreateRecord(const RecordDecl *RD) {
     }
     if (!Desc)
       return nullptr;
-    Fields.push_back({FD, Size, Desc});
-    Size += align(Desc->getAllocSize());
+    Fields.push_back({FD, BaseSize, Desc});
+    BaseSize += align(Desc->getAllocSize());
   }
 
   Record *R = new (Allocator) Record(RD, std::move(Bases), std::move(Fields),
-                                     std::move(VirtBases), VirtSize, Size);
+                                     std::move(VirtBases), VirtSize, BaseSize);
   Records.insert({RD, R});
   return R;
 }


        


More information about the cfe-commits mailing list