diff options
-rw-r--r-- | compilerplugins/clang/passstuffbyref.cxx | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compilerplugins/clang/passstuffbyref.cxx b/compilerplugins/clang/passstuffbyref.cxx index 7ad891728238..51e324a774c6 100644 --- a/compilerplugins/clang/passstuffbyref.cxx +++ b/compilerplugins/clang/passstuffbyref.cxx @@ -39,6 +39,13 @@ bool PassStuffByRef::VisitFunctionDecl(const FunctionDecl * functionDecl) { if (functionDecl->isThisDeclarationADefinition() && functionDecl->getPreviousDecl() != nullptr) { return true; } + // only consider base declarations, not overriden ones, or we warn on methods that + // are overriding stuff from external libraries + if (isa<CXXMethodDecl>(functionDecl)) { + CXXMethodDecl const * m = dyn_cast<CXXMethodDecl>(functionDecl); + if (m->size_overridden_methods() > 0) + return true; + } unsigned n = functionDecl->getNumParams(); for (unsigned i = 0; i != n; ++i) { const ParmVarDecl * pvDecl = functionDecl->getParamDecl(i); |