summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-12-08 15:58:41 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-12-11 12:13:46 +0100
commit3af500580b1c82eabd60335c9ebc458a3f68850c (patch)
treee0ad105be694cfb46221d16e9ce987879794fa04 /compilerplugins
parent0f9a596aa853b4f2beeff25c131246a7b31492a4 (diff)
loplugin:salcall fix functions
since cdecl is the default calling convention on Windows for such functions, the annotation is redundant. Change-Id: I1a85fa27e5ac65ce0e04a19bde74c90800ffaa2d Reviewed-on: https://gerrit.libreoffice.org/46164 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/salcall.cxx25
1 files changed, 3 insertions, 22 deletions
diff --git a/compilerplugins/clang/salcall.cxx b/compilerplugins/clang/salcall.cxx
index 250994c07f5e..16657e848d5a 100644
--- a/compilerplugins/clang/salcall.cxx
+++ b/compilerplugins/clang/salcall.cxx
@@ -222,32 +222,13 @@ bool SalCall::VisitFunctionDecl(FunctionDecl const* decl)
if (!bCanonicalDeclIsSalCall)
return true;
- // @TODO For now, I am ignore free functions, since those are most likely to have their address taken.
- // I'll do them later. They are harder to verify since MSVC does not verify when assigning to function pointers
- // that the calling convention of the function matches the calling convention of the function pointer!
- if (!methodDecl)
+ if (!decl->isThisDeclarationADefinition() && !(methodDecl && methodDecl->isPure()))
return true;
-
// can only check when we have a definition since this is the most likely time
// when the address of the method will be taken
- if (!(methodDecl && methodDecl->isPure()) && !decl->isThisDeclarationADefinition())
- return true;
- if (m_addressOfSet.find(decl->getCanonicalDecl()) != m_addressOfSet.end())
- return true;
-
- // ignore extern "C" UNO factory constructor functions
- if (decl->isExternC())
+ if (methodDecl)
{
- if (loplugin::TypeCheck(decl->getReturnType())
- .Pointer()
- .Class("XInterface")
- .Namespace("uno")
- .Namespace("star")
- .Namespace("sun")
- .Namespace("com")
- .GlobalNamespace())
- return true;
- if (loplugin::TypeCheck(decl->getReturnType()).Pointer().Void())
+ if (m_addressOfSet.find(decl->getCanonicalDecl()) != m_addressOfSet.end())
return true;
}