loplugin:external: Check for DLLExportAttr also in VisitTagDecl
...to fix false clang-cl warnings like > C:/lo-clang/core/cppuhelper/source/compat.cxx(113,29): error: externally available entity 'ClassData' is not previously declared in an included file (if it is only used in this translation unit, put it in an unnamed namespace; otherwise, provide a declaration of it in an included file) [loplugin:external] > struct SAL_DLLPUBLIC_EXPORT ClassData { > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ Change-Id: Iacf96569e27772aa9e27221619516b1fb84dd665 Reviewed-on: https://gerrit.libreoffice.org/84514 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
@@ -121,6 +121,15 @@ bool mentions(QualType type1, QualType type2)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasSalDllpublicExportAttr(Decl const* decl)
|
||||||
|
{
|
||||||
|
if (auto const attr = decl->getAttr<VisibilityAttr>())
|
||||||
|
{
|
||||||
|
return attr->getVisibility() == VisibilityAttr::Default;
|
||||||
|
}
|
||||||
|
return decl->hasAttr<DLLExportAttr>();
|
||||||
|
}
|
||||||
|
|
||||||
class External : public loplugin::FilteringPlugin<External>
|
class External : public loplugin::FilteringPlugin<External>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -155,15 +164,12 @@ public:
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (auto const attr = d->getAttr<VisibilityAttr>())
|
if (hasSalDllpublicExportAttr(d))
|
||||||
{
|
{
|
||||||
if (attr->getVisibility() == VisibilityAttr::Default)
|
// If the class definition has explicit default visibility, then assume that it
|
||||||
{
|
// needs to be present (e.g., a backwards-compatibility stub like in
|
||||||
// If the class definition has explicit default visibility, then assume that it
|
// cppuhelper/source/compat.cxx):
|
||||||
// needs to be present (e.g., a backwards-compatibility stub like in
|
return true;
|
||||||
// cppuhelper/source/compat.cxx):
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (derivesFromTestFixture(d))
|
if (derivesFromTestFixture(d))
|
||||||
{
|
{
|
||||||
@@ -202,14 +208,7 @@ public:
|
|||||||
// If the function definition is explicit marked SAL_DLLPUBLIC_EXPORT or similar, then
|
// If the function definition is explicit marked SAL_DLLPUBLIC_EXPORT or similar, then
|
||||||
// assume that it needs to be present (e.g., only called via dlopen, or a backwards-
|
// assume that it needs to be present (e.g., only called via dlopen, or a backwards-
|
||||||
// compatibility stub like in sal/osl/all/compat.cxx):
|
// compatibility stub like in sal/osl/all/compat.cxx):
|
||||||
if (auto const attr = decl->getAttr<VisibilityAttr>())
|
if (hasSalDllpublicExportAttr(decl))
|
||||||
{
|
|
||||||
if (attr->getVisibility() == VisibilityAttr::Default)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (decl->hasAttr<DLLExportAttr>())
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user