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/SemaCodeComplete.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/SemaCodeComplete.cpp')
-rw-r--r-- | clang/lib/Sema/SemaCodeComplete.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index fb318bc4100..daef51e7be9 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -2297,7 +2297,7 @@ static void AddFunctionParameterChunks(ASTContext &Context, if (const FunctionProtoType *Proto = Function->getType()->getAs<FunctionProtoType>()) if (Proto->isVariadic()) { - if (Proto->getNumArgs() == 0) + if (Proto->getNumParams() == 0) Result.AddPlaceholderChunk("..."); MaybeAddSentinel(Context, Function, Result); @@ -2854,7 +2854,7 @@ CodeCompleteConsumer::OverloadCandidate::CreateSignatureString( Proto->getResultType().getAsString(Policy))); Result.AddChunk(CodeCompletionString::CK_LeftParen); - unsigned NumParams = FDecl? FDecl->getNumParams() : Proto->getNumArgs(); + unsigned NumParams = FDecl ? FDecl->getNumParams() : Proto->getNumParams(); for (unsigned I = 0; I != NumParams; ++I) { if (I) Result.AddChunk(CodeCompletionString::CK_Comma); @@ -2866,7 +2866,7 @@ CodeCompleteConsumer::OverloadCandidate::CreateSignatureString( ArgString = FDecl->getParamDecl(I)->getNameAsString(); ArgType = FDecl->getParamDecl(I)->getOriginalType(); } else { - ArgType = Proto->getArgType(I); + ArgType = Proto->getParamType(I); } ArgType.getAsStringInternal(ArgString, Policy); @@ -3925,12 +3925,13 @@ void Sema::CodeCompleteCall(Scope *S, Expr *FnIn, ArrayRef<Expr *> Args) { for (unsigned I = 0, N = Results.size(); I != N; ++I) { if (const FunctionType *FType = Results[I].getFunctionType()) if (const FunctionProtoType *Proto = dyn_cast<FunctionProtoType>(FType)) - if (Args.size() < Proto->getNumArgs()) { + if (Args.size() < Proto->getNumParams()) { if (ParamType.isNull()) - ParamType = Proto->getArgType(Args.size()); + ParamType = Proto->getParamType(Args.size()); else if (!Context.hasSameUnqualifiedType( - ParamType.getNonReferenceType(), - Proto->getArgType(Args.size()).getNonReferenceType())) { + ParamType.getNonReferenceType(), + Proto->getParamType(Args.size()) + .getNonReferenceType())) { ParamType = QualType(); break; } @@ -3951,8 +3952,8 @@ void Sema::CodeCompleteCall(Scope *S, Expr *FnIn, ArrayRef<Expr *> Args) { if (const FunctionProtoType *Proto = FunctionType->getAs<FunctionProtoType>()) { - if (Args.size() < Proto->getNumArgs()) - ParamType = Proto->getArgType(Args.size()); + if (Args.size() < Proto->getNumParams()) + ParamType = Proto->getParamType(Args.size()); } } |