From 3af500580b1c82eabd60335c9ebc458a3f68850c Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 8 Dec 2017 15:58:41 +0200 Subject: 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 Reviewed-by: Noel Grandin --- compilerplugins/clang/salcall.cxx | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) (limited to 'compilerplugins') 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; } -- cgit