summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/passstuffbyref.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-09-28 18:14:13 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-09-29 13:31:23 +0200
commit419d664fb7916cd529f83421e7e98e82e4a7185f (patch)
tree2762b921f36bef01d872e2f6c50839e2b4daacb7 /compilerplugins/clang/passstuffbyref.cxx
parent830db20afba8895f68a0b4198657b08735635e28 (diff)
Adapt loplugins to clang-cl's (implicit) -fdelayed-template-parsing
...which is there for MSVC compatibility, but can cause getBody() to return null even when doesThisDeclarationHaveABody() is true. And in staticmethods.cxx we need to check doesThisDeclarationHaveABody() instead of hasBody(): For some class template member functions that are only defined outside their class definition, as is the case for OSequenceIterator::hasMoreElements in include/comphelper/sequence.hxx, hasBody() may be true for the original member function declaration inside the class (as there is some later definition that does have a body), but isLateTemplateParsed() is not (it is only true for the later definition). So just skip any such declarations that are not definitions (which is sane anyway, as otherwise such functions could pointlessly be inspected multiple times). Change-Id: I724f652a8f060a931f8b5fc3e4feb5f307a922bf Reviewed-on: https://gerrit.libreoffice.org/42914 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins/clang/passstuffbyref.cxx')
-rw-r--r--compilerplugins/clang/passstuffbyref.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/compilerplugins/clang/passstuffbyref.cxx b/compilerplugins/clang/passstuffbyref.cxx
index 2fa12db827b9..268706c3a60f 100644
--- a/compilerplugins/clang/passstuffbyref.cxx
+++ b/compilerplugins/clang/passstuffbyref.cxx
@@ -216,7 +216,9 @@ void PassStuffByRef::checkReturnValue(const FunctionDecl * functionDecl, const C
if (methodDecl && (methodDecl->isVirtual() || methodDecl->hasAttr<OverrideAttr>())) {
return;
}
- if( !functionDecl->doesThisDeclarationHaveABody()) {
+ if( !functionDecl->doesThisDeclarationHaveABody()
+ || functionDecl->isLateTemplateParsed())
+ {
return;
}