diff options
| author | Alp Toker <alp@nuanti.com> | 2014-01-20 20:26:09 +0000 |
|---|---|---|
| committer | Alp Toker <alp@nuanti.com> | 2014-01-20 20:26:09 +0000 |
| commit | c50bf3d128af641f9249f7d1dc37e42b9fd31b81 (patch) | |
| tree | 82cb9d4ca1cc715bbf62f39de4b4e27d8b705beb /lib/CodeGen/CGExprCXX.cpp | |
| parent | 55c1c8ac7914747a84329aab72200822b8e8b5c2 (diff) | |
| download | clang-c50bf3d128af641f9249f7d1dc37e42b9fd31b81.tar.gz clang-c50bf3d128af641f9249f7d1dc37e42b9fd31b81.tar.bz2 clang-c50bf3d128af641f9249f7d1dc37e42b9fd31b81.tar.xz | |
Rename FunctionProtoType accessors from 'arguments' to 'parameters'
Fix a perennial source of confusion in the clang type system: Declarations and
function prototypes have parameters to which arguments are supplied, so calling
these 'arguments' was a stretch even in C mode, let alone C++ where default
arguments, templates and overloading make the distinction important to get
right.
Readability win across the board, especially in the casting, ADL and
overloading implementations which make a lot more sense at a glance now.
Will keep an eye on the builders and update dependent projects shortly.
No functional change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199686 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprCXX.cpp')
| -rw-r--r-- | lib/CodeGen/CGExprCXX.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp index 69aecfdc09..12b953b333 100644 --- a/lib/CodeGen/CGExprCXX.cpp +++ b/lib/CodeGen/CGExprCXX.cpp @@ -1014,17 +1014,17 @@ namespace { void Emit(CodeGenFunction &CGF, Flags flags) { const FunctionProtoType *FPT = OperatorDelete->getType()->getAs<FunctionProtoType>(); - assert(FPT->getNumArgs() == NumPlacementArgs + 1 || - (FPT->getNumArgs() == 2 && NumPlacementArgs == 0)); + assert(FPT->getNumParams() == NumPlacementArgs + 1 || + (FPT->getNumParams() == 2 && NumPlacementArgs == 0)); CallArgList DeleteArgs; // The first argument is always a void*. - FunctionProtoType::arg_type_iterator AI = FPT->arg_type_begin(); + FunctionProtoType::param_type_iterator AI = FPT->param_type_begin(); DeleteArgs.add(RValue::get(Ptr), *AI++); // A member 'operator delete' can take an extra 'size_t' argument. - if (FPT->getNumArgs() == NumPlacementArgs + 2) + if (FPT->getNumParams() == NumPlacementArgs + 2) DeleteArgs.add(RValue::get(AllocSize), *AI++); // Pass the rest of the arguments, which must match exactly. @@ -1069,17 +1069,17 @@ namespace { void Emit(CodeGenFunction &CGF, Flags flags) { const FunctionProtoType *FPT = OperatorDelete->getType()->getAs<FunctionProtoType>(); - assert(FPT->getNumArgs() == NumPlacementArgs + 1 || - (FPT->getNumArgs() == 2 && NumPlacementArgs == 0)); + assert(FPT->getNumParams() == NumPlacementArgs + 1 || + (FPT->getNumParams() == 2 && NumPlacementArgs == 0)); CallArgList DeleteArgs; // The first argument is always a void*. - FunctionProtoType::arg_type_iterator AI = FPT->arg_type_begin(); + FunctionProtoType::param_type_iterator AI = FPT->param_type_begin(); DeleteArgs.add(Ptr.restore(CGF), *AI++); // A member 'operator delete' can take an extra 'size_t' argument. - if (FPT->getNumArgs() == NumPlacementArgs + 2) { + if (FPT->getNumParams() == NumPlacementArgs + 2) { RValue RV = AllocSize.restore(CGF); DeleteArgs.add(RV, *AI++); } @@ -1168,8 +1168,8 @@ llvm::Value *CodeGenFunction::EmitCXXNewExpr(const CXXNewExpr *E) { // We start at 1 here because the first argument (the allocation size) // has already been emitted. EmitCallArgs(allocatorArgs, allocatorType->isVariadic(), - allocatorType->arg_type_begin() + 1, - allocatorType->arg_type_end(), E->placement_arg_begin(), + allocatorType->param_type_begin() + 1, + allocatorType->param_type_end(), E->placement_arg_begin(), E->placement_arg_end()); // Emit the allocation call. If the allocator is a global placement @@ -1286,14 +1286,14 @@ void CodeGenFunction::EmitDeleteCall(const FunctionDecl *DeleteFD, // Check if we need to pass the size to the delete operator. llvm::Value *Size = 0; QualType SizeTy; - if (DeleteFTy->getNumArgs() == 2) { - SizeTy = DeleteFTy->getArgType(1); + if (DeleteFTy->getNumParams() == 2) { + SizeTy = DeleteFTy->getParamType(1); CharUnits DeleteTypeSize = getContext().getTypeSizeInChars(DeleteTy); Size = llvm::ConstantInt::get(ConvertType(SizeTy), DeleteTypeSize.getQuantity()); } - - QualType ArgTy = DeleteFTy->getArgType(0); + + QualType ArgTy = DeleteFTy->getParamType(0); llvm::Value *DeletePtr = Builder.CreateBitCast(Ptr, ConvertType(ArgTy)); DeleteArgs.add(RValue::get(DeletePtr), ArgTy); @@ -1422,19 +1422,19 @@ namespace { void Emit(CodeGenFunction &CGF, Flags flags) { const FunctionProtoType *DeleteFTy = OperatorDelete->getType()->getAs<FunctionProtoType>(); - assert(DeleteFTy->getNumArgs() == 1 || DeleteFTy->getNumArgs() == 2); + assert(DeleteFTy->getNumParams() == 1 || DeleteFTy->getNumParams() == 2); CallArgList Args; // Pass the pointer as the first argument. - QualType VoidPtrTy = DeleteFTy->getArgType(0); + QualType VoidPtrTy = DeleteFTy->getParamType(0); llvm::Value *DeletePtr = CGF.Builder.CreateBitCast(Ptr, CGF.ConvertType(VoidPtrTy)); Args.add(RValue::get(DeletePtr), VoidPtrTy); // Pass the original requested size as the second argument. - if (DeleteFTy->getNumArgs() == 2) { - QualType size_t = DeleteFTy->getArgType(1); + if (DeleteFTy->getNumParams() == 2) { + QualType size_t = DeleteFTy->getParamType(1); llvm::IntegerType *SizeTy = cast<llvm::IntegerType>(CGF.ConvertType(size_t)); |
