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:
parent
55eddbecb3
commit
c9a6d4bee7
@ -121,6 +121,15 @@ bool mentions(QualType type1, QualType type2)
|
||||
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>
|
||||
{
|
||||
public:
|
||||
@ -155,15 +164,12 @@ public:
|
||||
{
|
||||
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
|
||||
// cppuhelper/source/compat.cxx):
|
||||
return true;
|
||||
}
|
||||
// If the class definition has explicit default visibility, then assume that it
|
||||
// needs to be present (e.g., a backwards-compatibility stub like in
|
||||
// cppuhelper/source/compat.cxx):
|
||||
return true;
|
||||
}
|
||||
if (derivesFromTestFixture(d))
|
||||
{
|
||||
@ -202,14 +208,7 @@ public:
|
||||
// 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-
|
||||
// compatibility stub like in sal/osl/all/compat.cxx):
|
||||
if (auto const attr = decl->getAttr<VisibilityAttr>())
|
||||
{
|
||||
if (attr->getVisibility() == VisibilityAttr::Default)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (decl->hasAttr<DLLExportAttr>())
|
||||
if (hasSalDllpublicExportAttr(decl))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user