Kaydet (Commit) a31267be authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Fix isSalCallFunction so it also works on Windows

...where FunctionDecl::getReturnTypeSourceRange returns an invalid range because
it fails to take AttributedTypeLoc (as caused by SAL_CALL -> __cdecl) into
account.

Change-Id: I7835dfca7b890ba1bfdb99adaad78a627b6e0e17
Reviewed-on: https://gerrit.libreoffice.org/45909Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst bde22bd6
...@@ -9,9 +9,21 @@ ...@@ -9,9 +9,21 @@
#include <sal/types.h> #include <sal/types.h>
#define VOID void
class Class1 class Class1
{ {
SAL_CALL Class1() {} // expected-error {{SAL_CALL unnecessary here [loplugin:salcall]}}
SAL_CALL ~Class1() {} // expected-error {{SAL_CALL unnecessary here [loplugin:salcall]}}
SAL_CALL operator int() // expected-error {{SAL_CALL unnecessary here [loplugin:salcall]}}
{
return 0;
}
void SAL_CALL method1(); // expected-error {{SAL_CALL unnecessary here [loplugin:salcall]}} void SAL_CALL method1(); // expected-error {{SAL_CALL unnecessary here [loplugin:salcall]}}
VOID method2() {}
// no SAL_CALL for above method2, even though "SAL_CALL" appears between definition of VOID and
// the declaration's name, "method2"
}; };
void SAL_CALL Class1::method1() void SAL_CALL Class1::method1()
{ // expected-error@-1 {{SAL_CALL unnecessary here [loplugin:salcall]}} { // expected-error@-1 {{SAL_CALL unnecessary here [loplugin:salcall]}}
...@@ -105,4 +117,21 @@ class Class8_3 : public Class8_1, public Class8_2 ...@@ -105,4 +117,21 @@ class Class8_3 : public Class8_1, public Class8_2
virtual ~Class8_3(); virtual ~Class8_3();
}; };
#if 0 //TODO
template<typename> struct S {
virtual ~S();
virtual void f();
};
template<typename T> S<T>::~S() {}
template<typename T> void S<T>::f() {}
struct S2: S<int> {
~S2();
void f() {}
};
int main() {
S2 s2;
s2->f();
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
...@@ -292,7 +292,7 @@ protected: ...@@ -292,7 +292,7 @@ protected:
ListenerType _eType ListenerType _eType
); );
SAL_CALL operator css::uno::Reference< css::uno::XInterface > () const operator css::uno::Reference< css::uno::XInterface > () const
{ {
return const_cast< XContainer* >( static_cast< const XContainer* >( this ) ); return const_cast< XContainer* >( static_cast< const XContainer* >( this ) );
} }
......
...@@ -61,7 +61,7 @@ class UpdateCheck : ...@@ -61,7 +61,7 @@ class UpdateCheck :
virtual ~UpdateCheck() override; virtual ~UpdateCheck() override;
public: public:
SAL_CALL operator rtl::Reference< UpdateCheckConfigListener > () operator rtl::Reference< UpdateCheckConfigListener > ()
{ return static_cast< UpdateCheckConfigListener * > (this); } { return static_cast< UpdateCheckConfigListener * > (this); }
void initialize(const css::uno::Sequence<css::beans::NamedValue>& rValues, void initialize(const css::uno::Sequence<css::beans::NamedValue>& rValues,
......
...@@ -178,7 +178,7 @@ public: ...@@ -178,7 +178,7 @@ public:
bool showOverwriteWarning() const; bool showOverwriteWarning() const;
// Allows runtime exceptions to be thrown by const methods // Allows runtime exceptions to be thrown by const methods
SAL_CALL operator css::uno::Reference< css::uno::XInterface > () const operator css::uno::Reference< css::uno::XInterface > () const
{ return const_cast< cppu::OWeakObject * > (static_cast< cppu::OWeakObject const * > (this)); }; { return const_cast< cppu::OWeakObject * > (static_cast< cppu::OWeakObject const * > (this)); };
// XActionListener // XActionListener
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment