diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-27 09:51:21 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-27 10:31:42 +0200 |
commit | 5585bc2fbbe8b6072cfdd5cdaaf326f5124632ce (patch) | |
tree | a7f6570cd2c0df4f379e1e7a88f9067f04bb5ce0 | |
parent | 13c26e565bd8b633e4748c63103c3801b017217b (diff) |
rename loplugin::Plugin::parentStmt
to getParentStmt and rename parentFunctionDecl to getParentFunctionDecl,
so I don't keep using accidentally naming my variables the same as the
functions.
Change-Id: I66f9452458c8b439e5132191ac5219fb6d420708
-rw-r--r-- | compilerplugins/clang/checkunusedparams.cxx | 2 | ||||
-rw-r--r-- | compilerplugins/clang/constparams.cxx | 2 | ||||
-rw-r--r-- | compilerplugins/clang/dodgyswitch.cxx | 4 | ||||
-rw-r--r-- | compilerplugins/clang/expandablemethods.cxx | 2 | ||||
-rw-r--r-- | compilerplugins/clang/inlinefields.cxx | 4 | ||||
-rw-r--r-- | compilerplugins/clang/memoryvar.cxx | 2 | ||||
-rw-r--r-- | compilerplugins/clang/plugin.cxx | 6 | ||||
-rw-r--r-- | compilerplugins/clang/plugin.hxx | 6 | ||||
-rw-r--r-- | compilerplugins/clang/singlevalfields.cxx | 10 | ||||
-rw-r--r-- | compilerplugins/clang/unusedenumconstants.cxx | 2 | ||||
-rw-r--r-- | compilerplugins/clang/unusedfields.cxx | 2 | ||||
-rw-r--r-- | compilerplugins/clang/unusedmethods.cxx | 6 |
12 files changed, 24 insertions, 24 deletions
diff --git a/compilerplugins/clang/checkunusedparams.cxx b/compilerplugins/clang/checkunusedparams.cxx index 40f47191a5c6..1de5e5669738 100644 --- a/compilerplugins/clang/checkunusedparams.cxx +++ b/compilerplugins/clang/checkunusedparams.cxx @@ -132,7 +132,7 @@ void CheckUnusedParams::checkForFunctionDecl(Expr const * expr, bool bCheckOnly) if (!functionDecl) return; if (bCheckOnly) - parentStmt(expr)->dump(); + getParentStmt(expr)->dump(); else m_addressOfSet.insert(functionDecl->getCanonicalDecl()); } diff --git a/compilerplugins/clang/constparams.cxx b/compilerplugins/clang/constparams.cxx index ca30048f9b1c..bf715d16e91a 100644 --- a/compilerplugins/clang/constparams.cxx +++ b/compilerplugins/clang/constparams.cxx @@ -289,7 +289,7 @@ bool ConstParams::VisitDeclRefExpr( const DeclRefExpr* declRefExpr ) // related ParamVarDecl can be const. bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVarDecl) { - const Stmt* parent = parentStmt( stmt ); + const Stmt* parent = getParentStmt( stmt ); if (!parent) { // check if we're inside a CXXCtorInitializer diff --git a/compilerplugins/clang/dodgyswitch.cxx b/compilerplugins/clang/dodgyswitch.cxx index b731e30419f9..171707c8106a 100644 --- a/compilerplugins/clang/dodgyswitch.cxx +++ b/compilerplugins/clang/dodgyswitch.cxx @@ -62,13 +62,13 @@ bool DodgySwitch::VisitCaseStmt(CaseStmt const * caseStmt) bool DodgySwitch::IsParentSwitch(Stmt const * stmt) { - auto parent = parentStmt(stmt); + auto parent = getParentStmt(stmt); if (isa<CaseStmt>(parent) || isa<DefaultStmt>(parent)) // daisy chain return true; auto compoundStmt = dyn_cast<CompoundStmt>(parent); if (!compoundStmt) return false; - return isa<SwitchStmt>(parentStmt(compoundStmt)); + return isa<SwitchStmt>(getParentStmt(compoundStmt)); } loplugin::Plugin::Registration< DodgySwitch > X("dodgyswitch", false); diff --git a/compilerplugins/clang/expandablemethods.cxx b/compilerplugins/clang/expandablemethods.cxx index 958d563d0adb..c286711037ed 100644 --- a/compilerplugins/clang/expandablemethods.cxx +++ b/compilerplugins/clang/expandablemethods.cxx @@ -272,7 +272,7 @@ void ExpandableMethods::functionTouchedFromExpr( const FunctionDecl* calleeFunct calledFromSet.emplace(toString(expr->getLocStart()), niceName(canonicalFunctionDecl)); - if (const UnaryOperator* unaryOp = dyn_cast_or_null<UnaryOperator>(parentStmt(expr))) { + if (const UnaryOperator* unaryOp = dyn_cast_or_null<UnaryOperator>(getParentStmt(expr))) { if (unaryOp->getOpcode() == UO_AddrOf) { addressOfSet.insert(niceName(canonicalFunctionDecl)); } diff --git a/compilerplugins/clang/inlinefields.cxx b/compilerplugins/clang/inlinefields.cxx index 5ffb93080e3e..42551dc61660 100644 --- a/compilerplugins/clang/inlinefields.cxx +++ b/compilerplugins/clang/inlinefields.cxx @@ -184,7 +184,7 @@ bool InlineFields::VisitBinAssign(const BinaryOperator * binaryOp) if (!fieldDecl || !fieldDecl->getType()->isPointerType()) { return true; } - const FunctionDecl* parentFunction = parentFunctionDecl(binaryOp); + const FunctionDecl* parentFunction = getParentFunctionDecl(binaryOp); if (!parentFunction) { return true; } @@ -227,7 +227,7 @@ bool InlineFields::VisitCXXDeleteExpr(const CXXDeleteExpr * deleteExpr) } // TODO for some reason, this part is not working properly, it doesn't find the parent // function for delete statements properly - const FunctionDecl* parentFunction = parentFunctionDecl(deleteExpr); + const FunctionDecl* parentFunction = getParentFunctionDecl(deleteExpr); if (!parentFunction) { return true; } diff --git a/compilerplugins/clang/memoryvar.cxx b/compilerplugins/clang/memoryvar.cxx index 3b480660ed3f..2fecf86eba40 100644 --- a/compilerplugins/clang/memoryvar.cxx +++ b/compilerplugins/clang/memoryvar.cxx @@ -145,7 +145,7 @@ bool MemoryVar::VisitCXXNewExpr(const CXXNewExpr *newExpr) if (ignoreLocation(newExpr)) { return true; } - const Stmt* stmt = parentStmt(newExpr); + const Stmt* stmt = getParentStmt(newExpr); const DeclStmt* declStmt = dyn_cast<DeclStmt>(stmt); if (declStmt) { diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx index c9415ab13f03..d7ab4ad3e63e 100644 --- a/compilerplugins/clang/plugin.cxx +++ b/compilerplugins/clang/plugin.cxx @@ -118,7 +118,7 @@ void Plugin::registerPlugin( Plugin* (*create)( const InstantiationData& ), cons std::unordered_map< const Stmt*, const Stmt* > Plugin::parents; -const Stmt* Plugin::parentStmt( const Stmt* stmt ) +const Stmt* Plugin::getParentStmt( const Stmt* stmt ) { if( parents.empty()) buildParents( compiler ); @@ -127,7 +127,7 @@ const Stmt* Plugin::parentStmt( const Stmt* stmt ) return parents[ stmt ]; } -Stmt* Plugin::parentStmt( Stmt* stmt ) +Stmt* Plugin::getParentStmt( Stmt* stmt ) { if( parents.empty()) buildParents( compiler ); @@ -153,7 +153,7 @@ static const Decl* getDeclContext(ASTContext& context, const Stmt* stmt) return nullptr; } -const FunctionDecl* Plugin::parentFunctionDecl( const Stmt* stmt ) +const FunctionDecl* Plugin::getParentFunctionDecl( const Stmt* stmt ) { const Decl *decl = getDeclContext(compiler.getASTContext(), stmt); if (decl) diff --git a/compilerplugins/clang/plugin.hxx b/compilerplugins/clang/plugin.hxx index f480e8374bc1..39c1c18b14d1 100644 --- a/compilerplugins/clang/plugin.hxx +++ b/compilerplugins/clang/plugin.hxx @@ -67,9 +67,9 @@ protected: Returns the parent of the given AST node. Clang's internal AST representation doesn't provide this information, it can only provide children, but getting the parent is often useful for inspecting a part of the AST. */ - const Stmt* parentStmt( const Stmt* stmt ); - Stmt* parentStmt( Stmt* stmt ); - const FunctionDecl* parentFunctionDecl( const Stmt* stmt ); + const Stmt* getParentStmt( const Stmt* stmt ); + Stmt* getParentStmt( Stmt* stmt ); + const FunctionDecl* getParentFunctionDecl( const Stmt* stmt ); /** Checks if the location is inside an UNO file, more specifically, if it forms part of the URE stable interface, which is not allowed to be changed. diff --git a/compilerplugins/clang/singlevalfields.cxx b/compilerplugins/clang/singlevalfields.cxx index 5ccadf55a6b1..6e158ea872f6 100644 --- a/compilerplugins/clang/singlevalfields.cxx +++ b/compilerplugins/clang/singlevalfields.cxx @@ -245,21 +245,21 @@ bool SingleValFields::VisitMemberExpr( const MemberExpr* memberExpr ) if (ignoreLocation(memberExpr) || !isInterestingType(fieldDecl->getType())) return true; - const FunctionDecl* parentFunction = parentFunctionDecl(memberExpr); + const FunctionDecl* parentFunction = getParentFunctionDecl(memberExpr); const CXXMethodDecl* methodDecl = dyn_cast_or_null<CXXMethodDecl>(parentFunction); if (methodDecl && (methodDecl->isCopyAssignmentOperator() || methodDecl->isMoveAssignmentOperator())) return true; // walk up the tree until we find something interesting const Stmt* child = memberExpr; - const Stmt* parent = parentStmt(memberExpr); + const Stmt* parent = getParentStmt(memberExpr); bool bPotentiallyAssignedTo = false; bool bDump = false; std::string assignValue; // check for field being returned by non-const ref eg. Foo& getFoo() { return f; } if (parentFunction && parent && isa<ReturnStmt>(parent)) { - const Stmt* parent2 = parentStmt(parent); + const Stmt* parent2 = getParentStmt(parent); if (parent2 && isa<CompoundStmt>(parent2)) { QualType qt = compat::getReturnType(*parentFunction).getDesugaredType(compiler.getASTContext()); if (!qt.isConstQualified() && qt->isReferenceType()) { @@ -292,7 +292,7 @@ bool SingleValFields::VisitMemberExpr( const MemberExpr* memberExpr ) || isa<ExprWithCleanups>(parent)) { child = parent; - parent = parentStmt(parent); + parent = getParentStmt(parent); } else if (isa<UnaryOperator>(parent)) { @@ -304,7 +304,7 @@ bool SingleValFields::VisitMemberExpr( const MemberExpr* memberExpr ) break; } child = parent; - parent = parentStmt(parent); + parent = getParentStmt(parent); } else if (isa<CXXOperatorCallExpr>(parent)) { diff --git a/compilerplugins/clang/unusedenumconstants.cxx b/compilerplugins/clang/unusedenumconstants.cxx index a2f052339e84..88461c1075fd 100644 --- a/compilerplugins/clang/unusedenumconstants.cxx +++ b/compilerplugins/clang/unusedenumconstants.cxx @@ -144,7 +144,7 @@ bool UnusedEnumConstants::VisitDeclRefExpr( const DeclRefExpr* declRefExpr ) const Stmt * parent = declRefExpr; try_again: - parent = parentStmt(parent); + parent = getParentStmt(parent); bool bWrite = false; bool bRead = false; bool bDump = false; diff --git a/compilerplugins/clang/unusedfields.cxx b/compilerplugins/clang/unusedfields.cxx index 48cbb864d1d0..1f15404cb697 100644 --- a/compilerplugins/clang/unusedfields.cxx +++ b/compilerplugins/clang/unusedfields.cxx @@ -930,7 +930,7 @@ bool UnusedFields::VisitDeclRefExpr( const DeclRefExpr* declRefExpr ) } void UnusedFields::checkTouchedFromOutside(const FieldDecl* fieldDecl, const Expr* memberExpr) { - const FunctionDecl* memberExprParentFunction = parentFunctionDecl(memberExpr); + const FunctionDecl* memberExprParentFunction = getParentFunctionDecl(memberExpr); const CXXMethodDecl* methodDecl = dyn_cast_or_null<CXXMethodDecl>(memberExprParentFunction); MyFieldInfo fieldInfo = niceName(fieldDecl); diff --git a/compilerplugins/clang/unusedmethods.cxx b/compilerplugins/clang/unusedmethods.cxx index 881427fcfd9b..73bc1ac5d66a 100644 --- a/compilerplugins/clang/unusedmethods.cxx +++ b/compilerplugins/clang/unusedmethods.cxx @@ -230,13 +230,13 @@ bool UnusedMethods::VisitCallExpr(CallExpr* expr) gotfunc: logCallToRootMethods(calleeFunctionDecl, callSet); - const Stmt* parent = parentStmt(expr); + const Stmt* parent = getParentStmt(expr); // Now do the checks necessary for the "can be private" analysis CXXMethodDecl* calleeMethodDecl = dyn_cast<CXXMethodDecl>(calleeFunctionDecl); if (calleeMethodDecl && calleeMethodDecl->getAccess() != AS_private) { - const FunctionDecl* parentFunctionOfCallSite = parentFunctionDecl(expr); + const FunctionDecl* parentFunctionOfCallSite = getParentFunctionDecl(expr); if (parentFunctionOfCallSite != calleeFunctionDecl) { if (!parentFunctionOfCallSite || !ignoreLocation(parentFunctionOfCallSite)) { calledFromOutsideSet.insert(niceName(calleeFunctionDecl)); @@ -333,7 +333,7 @@ bool UnusedMethods::VisitDeclRefExpr( const DeclRefExpr* declRefExpr ) const CXXMethodDecl* methodDecl = dyn_cast<CXXMethodDecl>(functionDecl); if (methodDecl && methodDecl->getAccess() != AS_private) { - const FunctionDecl* parentFunctionOfCallSite = parentFunctionDecl(declRefExpr); + const FunctionDecl* parentFunctionOfCallSite = getParentFunctionDecl(declRefExpr); if (parentFunctionOfCallSite != functionDecl) { if (!parentFunctionOfCallSite || !ignoreLocation(parentFunctionOfCallSite)) { calledFromOutsideSet.insert(niceName(functionDecl)); |