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/AST/Decl.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/AST/Decl.cpp')
-rw-r--r-- | clang/lib/AST/Decl.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 7a1cd71c262..4d864f2128c 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -2308,7 +2308,8 @@ bool FunctionDecl::isReservedGlobalPlacementOperator() const { return false; const FunctionProtoType *proto = getType()->castAs<FunctionProtoType>(); - if (proto->getNumArgs() != 2 || proto->isVariadic()) return false; + if (proto->getNumParams() != 2 || proto->isVariadic()) + return false; ASTContext &Context = cast<TranslationUnitDecl>(getDeclContext()->getRedeclContext()) @@ -2316,7 +2317,7 @@ bool FunctionDecl::isReservedGlobalPlacementOperator() const { // The result type and first argument type are constant across all // these operators. The second argument must be exactly void*. - return (proto->getArgType(1).getCanonicalType() == Context.VoidPtrTy); + return (proto->getParamType(1).getCanonicalType() == Context.VoidPtrTy); } static bool isNamespaceStd(const DeclContext *DC) { @@ -2342,17 +2343,17 @@ bool FunctionDecl::isReplaceableGlobalAllocationFunction() const { return false; const FunctionProtoType *FPT = getType()->castAs<FunctionProtoType>(); - if (FPT->getNumArgs() > 2 || FPT->isVariadic()) + if (FPT->getNumParams() > 2 || FPT->isVariadic()) return false; // If this is a single-parameter function, it must be a replaceable global // allocation or deallocation function. - if (FPT->getNumArgs() == 1) + if (FPT->getNumParams() == 1) return true; // Otherwise, we're looking for a second parameter whose type is // 'const std::nothrow_t &', or, in C++1y, 'std::size_t'. - QualType Ty = FPT->getArgType(1); + QualType Ty = FPT->getParamType(1); ASTContext &Ctx = getASTContext(); if (Ctx.getLangOpts().SizedDeallocation && Ctx.hasSameType(Ty, Ctx.getSizeType())) @@ -2385,7 +2386,7 @@ FunctionDecl::getCorrespondingUnsizedGlobalDeallocationFunction() const { return 0; if (getNumParams() != 2 || isVariadic() || - !Ctx.hasSameType(getType()->castAs<FunctionProtoType>()->getArgType(1), + !Ctx.hasSameType(getType()->castAs<FunctionProtoType>()->getParamType(1), Ctx.getSizeType())) return 0; @@ -2517,7 +2518,7 @@ unsigned FunctionDecl::getBuiltinID() const { /// after it has been created. unsigned FunctionDecl::getNumParams() const { const FunctionProtoType *FPT = getType()->getAs<FunctionProtoType>(); - return FPT ? FPT->getNumArgs() : 0; + return FPT ? FPT->getNumParams() : 0; } void FunctionDecl::setParams(ASTContext &C, |