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 | 9cacbabd33eea88e9c416e4bc8abf58eebf5589d (patch) | |
tree | 74755c65f472ae14b820aa71f77069e69a1a91c4 /clang/lib/Sema/SemaDeclCXX.cpp | |
parent | 8ff1610f06646b0f62060df06c194214bd992260 (diff) | |
download | bcm5719-llvm-9cacbabd33eea88e9c416e4bc8abf58eebf5589d.tar.gz bcm5719-llvm-9cacbabd33eea88e9c416e4bc8abf58eebf5589d.zip |
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.
llvm-svn: 199686
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 608f11ceff8..df4d66eff62 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -714,8 +714,9 @@ static bool CheckConstexprParameterTypes(Sema &SemaRef, const FunctionDecl *FD) { unsigned ArgIndex = 0; const FunctionProtoType *FT = FD->getType()->getAs<FunctionProtoType>(); - for (FunctionProtoType::arg_type_iterator i = FT->arg_type_begin(), - e = FT->arg_type_end(); i != e; ++i, ++ArgIndex) { + for (FunctionProtoType::param_type_iterator i = FT->param_type_begin(), + e = FT->param_type_end(); + i != e; ++i, ++ArgIndex) { const ParmVarDecl *PD = FD->getParamDecl(ArgIndex); SourceLocation ParamLoc = PD->getLocation(); if (!(*i)->isDependentType() && @@ -4717,7 +4718,7 @@ updateExceptionSpec(Sema &S, FunctionDecl *FD, const FunctionProtoType *FPT, FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); ExceptSpec.getEPI(EPI); FD->setType(S.Context.getFunctionType(FPT->getResultType(), - FPT->getArgTypes(), EPI)); + FPT->getParamTypes(), EPI)); } static FunctionProtoType::ExtProtoInfo getImplicitMethodEPI(Sema &S, @@ -4822,7 +4823,7 @@ void Sema::CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD) { } // Check for parameter type matching. - QualType ArgType = ExpectedParams ? Type->getArgType(0) : QualType(); + QualType ArgType = ExpectedParams ? Type->getParamType(0) : QualType(); bool HasConstParam = false; if (ExpectedParams && ArgType->isReferenceType()) { // Argument must be reference to possibly-const T. @@ -6225,8 +6226,8 @@ QualType Sema::CheckConstructorDeclarator(Declarator &D, QualType R, FunctionProtoType::ExtProtoInfo EPI = Proto->getExtProtoInfo(); EPI.TypeQuals = 0; EPI.RefQualifier = RQ_None; - - return Context.getFunctionType(Context.VoidTy, Proto->getArgTypes(), EPI); + + return Context.getFunctionType(Context.VoidTy, Proto->getParamTypes(), EPI); } /// CheckConstructor - Checks a fully-formed constructor for @@ -6454,7 +6455,7 @@ void Sema::CheckConversionDeclarator(Declarator &D, QualType &R, const FunctionProtoType *Proto = R->getAs<FunctionProtoType>(); // Make sure we don't have any parameters. - if (Proto->getNumArgs() > 0) { + if (Proto->getNumParams() > 0) { Diag(D.getIdentifierLoc(), diag::err_conv_function_with_params); // Delete the parameters. @@ -8388,7 +8389,7 @@ private: void inherit(const CXXConstructorDecl *Ctor) { const FunctionProtoType *CtorType = Ctor->getType()->castAs<FunctionProtoType>(); - ArrayRef<QualType> ArgTypes(CtorType->getArgTypes()); + ArrayRef<QualType> ArgTypes(CtorType->getParamTypes()); FunctionProtoType::ExtProtoInfo EPI = CtorType->getExtProtoInfo(); SourceLocation UsingLoc = getUsingLoc(Ctor->getParent()); @@ -8531,16 +8532,16 @@ private: EPI.ExceptionSpecType = EST_Unevaluated; EPI.ExceptionSpecDecl = DerivedCtor; DerivedCtor->setType(Context.getFunctionType(FPT->getResultType(), - FPT->getArgTypes(), EPI)); + FPT->getParamTypes(), EPI)); // Build the parameter declarations. SmallVector<ParmVarDecl *, 16> ParamDecls; - for (unsigned I = 0, N = FPT->getNumArgs(); I != N; ++I) { + for (unsigned I = 0, N = FPT->getNumParams(); I != N; ++I) { TypeSourceInfo *TInfo = - Context.getTrivialTypeSourceInfo(FPT->getArgType(I), UsingLoc); + Context.getTrivialTypeSourceInfo(FPT->getParamType(I), UsingLoc); ParmVarDecl *PD = ParmVarDecl::Create( Context, DerivedCtor, UsingLoc, UsingLoc, /*IdentifierInfo=*/0, - FPT->getArgType(I), TInfo, SC_None, /*DefaultArg=*/0); + FPT->getParamType(I), TInfo, SC_None, /*DefaultArg=*/0); PD->setScopeInfo(0, I); PD->setImplicit(); ParamDecls.push_back(PD); @@ -9237,8 +9238,9 @@ Sema::ComputeDefaultedCopyAssignmentExceptionSpec(CXXMethodDecl *MD) { return ExceptSpec; const FunctionProtoType *T = MD->getType()->castAs<FunctionProtoType>(); - assert(T->getNumArgs() == 1 && "not a copy assignment op"); - unsigned ArgQuals = T->getArgType(0).getNonReferenceType().getCVRQualifiers(); + assert(T->getNumParams() == 1 && "not a copy assignment op"); + unsigned ArgQuals = + T->getParamType(0).getNonReferenceType().getCVRQualifiers(); // C++ [except.spec]p14: // An implicitly declared special member function (Clause 12) shall have an @@ -10061,8 +10063,8 @@ Sema::ComputeDefaultedCopyCtorExceptionSpec(CXXMethodDecl *MD) { return ExceptSpec; const FunctionProtoType *T = MD->getType()->castAs<FunctionProtoType>(); - assert(T->getNumArgs() >= 1 && "not a copy ctor"); - unsigned Quals = T->getArgType(0).getNonReferenceType().getCVRQualifiers(); + assert(T->getNumParams() >= 1 && "not a copy ctor"); + unsigned Quals = T->getParamType(0).getNonReferenceType().getCVRQualifiers(); // C++ [except.spec]p14: // An implicitly declared special member function (Clause 12) shall have an @@ -10635,8 +10637,8 @@ Sema::CompleteConstructorCall(CXXConstructorDecl *Constructor, const FunctionProtoType *Proto = Constructor->getType()->getAs<FunctionProtoType>(); assert(Proto && "Constructor without a prototype?"); - unsigned NumArgsInProto = Proto->getNumArgs(); - + unsigned NumArgsInProto = Proto->getNumParams(); + // If too few arguments are available, we'll fill in the rest with defaults. if (NumArgs < NumArgsInProto) ConvertedArgs.reserve(NumArgsInProto); |