"Use more ArrayRefs"

Change-Id: Ied0ab11dd9366b3f499100b2627f4919cca52c9c
This commit is contained in:
Stephan Bergmann
2016-06-24 16:46:55 +02:00
parent 2ff98b560c
commit f8a18a464e
6 changed files with 20 additions and 6 deletions

View File

@@ -128,6 +128,20 @@ inline clang::QualType getReturnType(clang::FunctionDecl const & decl) {
#endif
}
#if CLANG_VERSION >= 30900
inline clang::ArrayRef<clang::ParmVarDecl *> parameters(
clang::FunctionDecl const & decl)
{
return decl.parameters();
}
#else
inline clang::FunctionDecl::param_const_range parameters(
clang::FunctionDecl const & decl)
{
return decl.params();
}
#endif
inline clang::QualType getReturnType(clang::FunctionProtoType const & type) {
#if CLANG_VERSION >= 30500
return type.getReturnType();

View File

@@ -122,7 +122,7 @@ MyCallSiteInfo ConstantParam::niceName(const FunctionDecl* functionDecl, int par
}
aInfo.nameAndParams += functionDecl->getNameAsString() + "(";
bool bFirst = true;
for (const ParmVarDecl *pParmVarDecl : functionDecl->params()) {
for (const ParmVarDecl *pParmVarDecl : compat::parameters(*functionDecl)) {
if (bFirst)
bFirst = false;
else

View File

@@ -107,7 +107,7 @@ MyFuncInfo UnusedDefaultParams::niceName(const FunctionDecl* functionDecl)
}
aInfo.nameAndParams += functionDecl->getNameAsString() + "(";
bool bFirst = true;
for (const ParmVarDecl *pParmVarDecl : functionDecl->params()) {
for (const ParmVarDecl *pParmVarDecl : compat::parameters(*functionDecl)) {
if (bFirst)
bFirst = false;
else

View File

@@ -124,7 +124,7 @@ std::string UnusedFields::fullyQualifiedName(const FunctionDecl* functionDecl)
}
ret += functionDecl->getNameAsString() + "(";
bool bFirst = true;
for (const ParmVarDecl *pParmVarDecl : functionDecl->params()) {
for (const ParmVarDecl *pParmVarDecl : compat::parameters(*functionDecl)) {
if (bFirst)
bFirst = false;
else

View File

@@ -148,7 +148,7 @@ MyFuncInfo UnusedMethods::niceName(const FunctionDecl* functionDecl)
}
aInfo.nameAndParams += functionDecl->getNameAsString() + "(";
bool bFirst = true;
for (const ParmVarDecl *pParmVarDecl : functionDecl->params()) {
for (const ParmVarDecl *pParmVarDecl : compat::parameters(*functionDecl)) {
if (bFirst)
bFirst = false;
else
@@ -178,7 +178,7 @@ std::string UnusedMethods::fullyQualifiedName(const FunctionDecl* functionDecl)
}
ret += functionDecl->getNameAsString() + "(";
bool bFirst = true;
for (const ParmVarDecl *pParmVarDecl : functionDecl->params()) {
for (const ParmVarDecl *pParmVarDecl : compat::parameters(*functionDecl)) {
if (bFirst)
bFirst = false;
else

View File

@@ -79,7 +79,7 @@ std::string niceName(const CXXMethodDecl* functionDecl)
+ "::" + functionDecl->getNameAsString()
+ "(";
bool bFirst = true;
for (const ParmVarDecl *pParmVarDecl : functionDecl->params()) {
for (const ParmVarDecl *pParmVarDecl : compat::parameters(*functionDecl)) {
if (bFirst)
bFirst = false;
else