[clang] 5a07490 - [ABI][NFC] Fix the confusion of ByVal and ByRef argument names

Anatoly Trosinenko via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 6 05:25:47 PDT 2020


Author: Anatoly Trosinenko
Date: 2020-08-06T15:20:18+03:00
New Revision: 5a07490d7611088277dca4c1c06c2002403b7039

URL: https://github.com/llvm/llvm-project/commit/5a07490d7611088277dca4c1c06c2002403b7039
DIFF: https://github.com/llvm/llvm-project/commit/5a07490d7611088277dca4c1c06c2002403b7039.diff

LOG: [ABI][NFC] Fix the confusion of ByVal and ByRef argument names

The second argument of getNaturalAlignIndirect() was `bool ByRef`, but
the implementation was just delegating to getIndirect() with `ByRef`
passed unchanged to `bool ByVal` parameter of getIndirect().

Fix a couple of /*ByRef=*/ comments as well.

Reviewed By: rjmccall

Differential Revision: https://reviews.llvm.org/D85113

Added: 
    

Modified: 
    clang/lib/CodeGen/ABIInfo.h
    clang/lib/CodeGen/TargetInfo.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/ABIInfo.h b/clang/lib/CodeGen/ABIInfo.h
index bb40dace8a84..56f0dd4322d2 100644
--- a/clang/lib/CodeGen/ABIInfo.h
+++ b/clang/lib/CodeGen/ABIInfo.h
@@ -111,7 +111,7 @@ namespace swiftcall {
     /// A convenience method to return an indirect ABIArgInfo with an
     /// expected alignment equal to the ABI alignment of the given type.
     CodeGen::ABIArgInfo
-    getNaturalAlignIndirect(QualType Ty, bool ByRef = true,
+    getNaturalAlignIndirect(QualType Ty, bool ByVal = true,
                             bool Realign = false,
                             llvm::Type *Padding = nullptr) const;
 

diff  --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp
index e011cfa81167..8c89e6bc2a64 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -80,17 +80,17 @@ static bool isAggregateTypeForABI(QualType T) {
          T->isMemberFunctionPointerType();
 }
 
-ABIArgInfo
-ABIInfo::getNaturalAlignIndirect(QualType Ty, bool ByRef, bool Realign,
-                                 llvm::Type *Padding) const {
-  return ABIArgInfo::getIndirect(getContext().getTypeAlignInChars(Ty),
-                                 ByRef, Realign, Padding);
+ABIArgInfo ABIInfo::getNaturalAlignIndirect(QualType Ty, bool ByVal,
+                                            bool Realign,
+                                            llvm::Type *Padding) const {
+  return ABIArgInfo::getIndirect(getContext().getTypeAlignInChars(Ty), ByVal,
+                                 Realign, Padding);
 }
 
 ABIArgInfo
 ABIInfo::getNaturalAlignIndirectInReg(QualType Ty, bool Realign) const {
   return ABIArgInfo::getIndirectInReg(getContext().getTypeAlignInChars(Ty),
-                                      /*ByRef*/ false, Realign);
+                                      /*ByVal*/ false, Realign);
 }
 
 Address ABIInfo::EmitMSVAArg(CodeGenFunction &CGF, Address VAListAddr,
@@ -8555,7 +8555,7 @@ ABIArgInfo LanaiABIInfo::classifyArgumentType(QualType Ty,
     if (RAA == CGCXXABI::RAA_Indirect) {
       return getIndirectResult(Ty, /*ByVal=*/false, State);
     } else if (RAA == CGCXXABI::RAA_DirectInMemory) {
-      return getNaturalAlignIndirect(Ty, /*ByRef=*/true);
+      return getNaturalAlignIndirect(Ty, /*ByVal=*/true);
     }
   }
 


        


More information about the cfe-commits mailing list