Further clean-up
Change-Id: Ice5fcb8f598b079afde3346f569d9619f1383506
This commit is contained in:
@@ -82,6 +82,11 @@ ContextCheck DeclCheck::Operator(clang::OverloadedOperatorKind op) const {
|
||||
? f->getDeclContext() : nullptr);
|
||||
}
|
||||
|
||||
ContextCheck DeclCheck::MemberFunction() const {
|
||||
auto m = llvm::dyn_cast_or_null<clang::CXXMethodDecl>(decl_);
|
||||
return ContextCheck(m == nullptr ? nullptr : m->getParent());
|
||||
}
|
||||
|
||||
TerminalCheck ContextCheck::GlobalNamespace() const {
|
||||
return TerminalCheck(
|
||||
context_ != nullptr
|
||||
|
@@ -73,6 +73,8 @@ public:
|
||||
|
||||
ContextCheck Operator(clang::OverloadedOperatorKind op) const;
|
||||
|
||||
ContextCheck MemberFunction() const;
|
||||
|
||||
private:
|
||||
clang::Decl const * const decl_;
|
||||
};
|
||||
|
@@ -73,10 +73,6 @@ private:
|
||||
std::vector<FDecl> functionDecls_;
|
||||
};
|
||||
|
||||
bool startswith(const std::string& rStr, const char* pSubStr) {
|
||||
return rStr.compare(0, strlen(pSubStr), pSubStr) == 0;
|
||||
}
|
||||
|
||||
bool PassStuffByRef::TraverseFunctionDecl(FunctionDecl * decl) {
|
||||
return traverseAnyFunctionDecl(
|
||||
decl, &RecursiveASTVisitor::TraverseFunctionDecl);
|
||||
@@ -207,8 +203,10 @@ void PassStuffByRef::checkParams(const FunctionDecl * functionDecl) {
|
||||
return;
|
||||
}
|
||||
// these functions are passed as parameters to another function
|
||||
std::string aFunctionName = functionDecl->getQualifiedNameAsString();
|
||||
if (startswith(aFunctionName, "slideshow::internal::ShapeAttributeLayer")) {
|
||||
if (loplugin::DeclCheck(functionDecl).MemberFunction()
|
||||
.Class("ShapeAttributeLayer").Namespace("internal")
|
||||
.Namespace("slideshow").GlobalNamespace())
|
||||
{
|
||||
return;
|
||||
}
|
||||
assert(!functionDecls_.empty());
|
||||
|
Reference in New Issue
Block a user