summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compilerplugins/clang/unusedfields.cxx54
-rw-r--r--drawinglayer/qa/unit/vclmetafileprocessor2d.cxx15
-rw-r--r--sc/source/core/data/table2.cxx4
-rw-r--r--sfx2/inc/commandpopup/CommandPopup.hxx1
-rw-r--r--sfx2/inc/sidebar/TitleBar.hxx1
-rw-r--r--sw/inc/calc.hxx1
-rw-r--r--sw/inc/tox.hxx8
-rw-r--r--sw/source/core/crsr/crstrvl.cxx2
-rw-r--r--xmlscript/qa/cppunit/test.cxx10
9 files changed, 51 insertions, 45 deletions
diff --git a/compilerplugins/clang/unusedfields.cxx b/compilerplugins/clang/unusedfields.cxx
index 7a8df9939d02..0c2bdbc77410 100644
--- a/compilerplugins/clang/unusedfields.cxx
+++ b/compilerplugins/clang/unusedfields.cxx
@@ -165,6 +165,8 @@ public:
private:
MyFieldInfo niceName(const FieldDecl*);
+ bool ignoreLocation(SourceLocation loc);
+ bool checkIgnoreLocation(SourceLocation loc);
void checkTouchedFromOutside(const FieldDecl* fieldDecl, const Expr* memberExpr);
void checkIfReadFrom(const FieldDecl* fieldDecl, const Expr* memberExpr);
void checkIfWrittenTo(const FieldDecl* fieldDecl, const Expr* memberExpr);
@@ -281,10 +283,46 @@ MyFieldInfo UnusedFields::niceName(const FieldDecl* fieldDecl)
return aInfo;
}
+/**
+ * Our need to see everything conflicts with the PCH code in pluginhandler::ignoreLocation,
+ * so we have to do this ourselves.
+ */
+bool UnusedFields::ignoreLocation(SourceLocation loc)
+{
+ static std::unordered_map<SourceLocation, bool> checkedMap;
+ auto it = checkedMap.find(loc);
+ if (it != checkedMap.end())
+ return it->second;
+ bool ignore = checkIgnoreLocation(loc);
+ checkedMap.emplace(loc, ignore);
+ return ignore;
+}
+
+bool UnusedFields::checkIgnoreLocation(SourceLocation loc)
+{
+ // simplified form of the code in PluginHandler::checkIgnoreLocation
+ SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc( loc );
+ if( compiler.getSourceManager().isInSystemHeader( expansionLoc ))
+ return true;
+ PresumedLoc presumedLoc = compiler.getSourceManager().getPresumedLoc( expansionLoc );
+ if( presumedLoc.isInvalid())
+ return true;
+ const char* bufferName = presumedLoc.getFilename();
+ if (bufferName == NULL
+ || loplugin::hasPathnamePrefix(bufferName, SRCDIR "/external/")
+ || loplugin::hasPathnamePrefix(bufferName, WORKDIR "/"))
+ return true;
+ if( loplugin::hasPathnamePrefix(bufferName, BUILDDIR "/")
+ || loplugin::hasPathnamePrefix(bufferName, SRCDIR "/") )
+ return false; // ok
+ return true;
+}
+
+
bool UnusedFields::VisitFieldDecl( const FieldDecl* fieldDecl )
{
fieldDecl = fieldDecl->getCanonicalDecl();
- if (ignoreLocation( fieldDecl )) {
+ if (ignoreLocation( compat::getBeginLoc(fieldDecl) )) {
return true;
}
// ignore stuff that forms part of the stable URE interface
@@ -392,7 +430,7 @@ bool startswith(const std::string& rStr, const char* pSubStr)
bool UnusedFields::TraverseCXXConstructorDecl(CXXConstructorDecl* cxxConstructorDecl)
{
auto copy = insideMoveOrCopyOrCloneDeclParent;
- if (!ignoreLocation(cxxConstructorDecl) && cxxConstructorDecl->isThisDeclarationADefinition())
+ if (!ignoreLocation(compat::getBeginLoc(cxxConstructorDecl)) && cxxConstructorDecl->isThisDeclarationADefinition())
{
if (cxxConstructorDecl->isCopyOrMoveConstructor())
insideMoveOrCopyOrCloneDeclParent = cxxConstructorDecl->getParent();
@@ -406,7 +444,7 @@ bool UnusedFields::TraverseCXXMethodDecl(CXXMethodDecl* cxxMethodDecl)
{
auto copy1 = insideMoveOrCopyOrCloneDeclParent;
auto copy2 = insideFunctionDecl;
- if (!ignoreLocation(cxxMethodDecl) && cxxMethodDecl->isThisDeclarationADefinition())
+ if (!ignoreLocation(compat::getBeginLoc(cxxMethodDecl)) && cxxMethodDecl->isThisDeclarationADefinition())
{
if (cxxMethodDecl->isCopyAssignmentOperator()
|| cxxMethodDecl->isMoveAssignmentOperator()
@@ -433,7 +471,7 @@ bool UnusedFields::TraverseFunctionDecl(FunctionDecl* functionDecl)
auto copy1 = insideStreamOutputOperator;
auto copy2 = insideFunctionDecl;
auto copy3 = insideMoveOrCopyOrCloneDeclParent;
- if (functionDecl->getLocation().isValid() && !ignoreLocation(functionDecl) && functionDecl->isThisDeclarationADefinition())
+ if (functionDecl->getLocation().isValid() && !ignoreLocation(compat::getBeginLoc(functionDecl)) && functionDecl->isThisDeclarationADefinition())
{
auto op = functionDecl->getOverloadedOperator();
if (op == OO_LessLess
@@ -500,7 +538,7 @@ bool UnusedFields::VisitMemberExpr( const MemberExpr* memberExpr )
return true;
}
fieldDecl = fieldDecl->getCanonicalDecl();
- if (ignoreLocation(fieldDecl)) {
+ if (ignoreLocation(compat::getBeginLoc(fieldDecl))) {
return true;
}
// ignore stuff that forms part of the stable URE interface
@@ -1074,7 +1112,7 @@ bool UnusedFields::IsPassedByNonConst(const FieldDecl* fieldDecl, const Stmt * c
// have to do it here
bool UnusedFields::VisitCXXConstructorDecl( const CXXConstructorDecl* cxxConstructorDecl )
{
- if (ignoreLocation( cxxConstructorDecl )) {
+ if (ignoreLocation( compat::getBeginLoc(cxxConstructorDecl) )) {
return true;
}
// ignore stuff that forms part of the stable URE interface
@@ -1107,7 +1145,7 @@ bool UnusedFields::VisitCXXConstructorDecl( const CXXConstructorDecl* cxxConstru
// have to do it here.
bool UnusedFields::VisitInitListExpr( const InitListExpr* initListExpr)
{
- if (ignoreLocation( initListExpr ))
+ if (ignoreLocation( compat::getBeginLoc(initListExpr) ))
return true;
QualType varType = initListExpr->getType().getDesugaredType(compiler.getASTContext());
@@ -1133,7 +1171,7 @@ bool UnusedFields::VisitDeclRefExpr( const DeclRefExpr* declRefExpr )
return true;
}
fieldDecl = fieldDecl->getCanonicalDecl();
- if (ignoreLocation(fieldDecl)) {
+ if (ignoreLocation(compat::getBeginLoc(fieldDecl))) {
return true;
}
// ignore stuff that forms part of the stable URE interface
diff --git a/drawinglayer/qa/unit/vclmetafileprocessor2d.cxx b/drawinglayer/qa/unit/vclmetafileprocessor2d.cxx
index a8088bf99560..28112e61647b 100644
--- a/drawinglayer/qa/unit/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/qa/unit/vclmetafileprocessor2d.cxx
@@ -35,9 +35,6 @@ class VclMetaFileProcessor2DTest : public test::BootstrapFixture
{
VclPtr<VirtualDevice> mVclDevice;
uno::Reference<rendering::XCanvas> mCanvas;
- rendering::ViewState mViewState;
- rendering::RenderState mRenderState;
- uno::Sequence<double> mColorBlack;
// if enabled - check the result images with:
// "xdg-open ./workdir/CppunitTest/drawinglayer_processors.test.core/"
@@ -59,18 +56,6 @@ public:
{
}
- virtual void setUp() override
- {
- BootstrapFixture::setUp();
- mColorBlack = vcl::unotools::colorToStdColorSpaceSequence(COL_BLACK);
- // Geometry init
- com::sun::star::geometry::AffineMatrix2D aUnit(1, 0, 0, 0, 1, 0);
- mViewState.AffineTransform = aUnit;
- mRenderState.AffineTransform = aUnit;
- mRenderState.DeviceColor = mColorBlack;
- mRenderState.CompositeOperation = rendering::CompositeOperation::OVER;
- }
-
virtual void tearDown() override
{
mVclDevice.clear();
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index af21428fde22..47afc5886ab1 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -808,7 +808,6 @@ class TransClipHandler
bool mbWasCut;
bool mbIncludeFiltered;
InsertDeleteFlags mnFlags;
- std::vector<SCROW>& mrFilteredRows;
ScAddress getDestPos(size_t nRow) const
{
@@ -851,7 +850,6 @@ public:
, mbWasCut(bWasCut)
, mbIncludeFiltered(bIncludeFiltered)
, mnFlags(nFlags)
- , mrFilteredRows(rFilteredRows)
{
// Create list of filtered rows.
if (!mbIncludeFiltered)
@@ -861,7 +859,7 @@ public:
// maybe this loop could be optimized
bool bFiltered = mrSrcTab.RowFiltered(curRow, nullptr, nullptr);
if (bFiltered)
- mrFilteredRows.push_back(curRow);
+ rFilteredRows.push_back(curRow);
}
}
}
diff --git a/sfx2/inc/commandpopup/CommandPopup.hxx b/sfx2/inc/commandpopup/CommandPopup.hxx
index 6ec23caf0de9..85208e37608e 100644
--- a/sfx2/inc/commandpopup/CommandPopup.hxx
+++ b/sfx2/inc/commandpopup/CommandPopup.hxx
@@ -72,7 +72,6 @@ private:
std::unique_ptr<weld::TreeView> mpCommandTreeView;
std::vector<CurrentEntry> maCommandList;
- OUString m_PreviousText;
std::unique_ptr<MenuContentHandler> mpMenuContentHandler;
DECL_LINK(QueryTooltip, const weld::TreeIter&, OUString);
diff --git a/sfx2/inc/sidebar/TitleBar.hxx b/sfx2/inc/sidebar/TitleBar.hxx
index 4672342ffec5..590cf549571e 100644
--- a/sfx2/inc/sidebar/TitleBar.hxx
+++ b/sfx2/inc/sidebar/TitleBar.hxx
@@ -56,7 +56,6 @@ protected:
std::unique_ptr<weld::Container> mxTitlebar;
std::unique_ptr<weld::Image> mxAddonImage;
std::unique_ptr<weld::Toolbar> mxToolBox;
- std::unique_ptr<ToolbarUnoDispatcher> mxToolBoxController;
Theme::ThemeItem meThemeItem;
virtual void HandleToolBoxItemClick() = 0;
diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx
index 3b585da69fcb..7590680d72c5 100644
--- a/sw/inc/calc.hxx
+++ b/sw/inc/calc.hxx
@@ -201,7 +201,6 @@ class SwCalc
sal_Int32 m_nCommandPos;
SwDoc& m_rDoc;
- SvtSysLocale m_aSysLocale;
std::unique_ptr<LocaleDataWrapper> m_xLocaleDataWrapper;
CharClass* m_pCharClass;
diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index 4555335e44ae..e16882e87afa 100644
--- a/sw/inc/tox.hxx
+++ b/sw/inc/tox.hxx
@@ -57,12 +57,10 @@ namespace sw {
SwContentFrame*& m_rpContentFrame;
const SwDoc& m_rDoc;
const SwRootFrame& m_rLayout;
- const bool m_isReadOnlyAvailable;
- FindContentFrameHint(SwContentFrame*& rpContentFrame, const SwDoc& rDoc, const SwRootFrame& rLayout, const bool isReadOnlyAvailable)
+ FindContentFrameHint(SwContentFrame*& rpContentFrame, const SwDoc& rDoc, const SwRootFrame& rLayout)
: m_rpContentFrame(rpContentFrame)
, m_rDoc(rDoc)
, m_rLayout(rLayout)
- , m_isReadOnlyAvailable(isReadOnlyAvailable)
{}
};
struct CollectTextTOXMarksForLayoutHint final : SfxHint {
@@ -188,10 +186,10 @@ public:
SwDoc& GetDoc() const { return m_rDoc; }
void CollectTextMarks(SwTOXMarks& rMarks) const
{ const_cast<SwTOXType*>(this)->GetNotifier().Broadcast(sw::CollectTextMarksHint(rMarks)); }
- SwContentFrame* FindContentFrame(const SwDoc& rDoc, const SwRootFrame& rLayout, const bool isReadOnlyAvailable) const
+ SwContentFrame* FindContentFrame(const SwDoc& rDoc, const SwRootFrame& rLayout) const
{
SwContentFrame* pContentFrame = nullptr;
- const_cast<SwTOXType*>(this)->GetNotifier().Broadcast(sw::FindContentFrameHint(pContentFrame, rDoc, rLayout, isReadOnlyAvailable));
+ const_cast<SwTOXType*>(this)->GetNotifier().Broadcast(sw::FindContentFrameHint(pContentFrame, rDoc, rLayout));
return pContentFrame;
}
void CollectTextTOXMarksForLayout(std::vector<std::reference_wrapper<SwTextTOXMark>>& rMarks, const SwRootFrame* pLayout) const
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 58bf0b4f9626..3ce07a3cb577 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -375,7 +375,7 @@ void SwCursorShell::GotoTOXMarkBase()
return;
// Take the 1. and get the index type. Ask it for the actual index.
const SwTOXType* pType = aMarks[0]->GetTOXType();
- auto pContentFrame = pType->FindContentFrame(*GetDoc(), *GetLayout(), IsReadOnlyAvailable());
+ auto pContentFrame = pType->FindContentFrame(*GetDoc(), *GetLayout());
SwCallLink aLk(*this); // watch Cursor-Moves
SwCursorSaveState aSaveState(*m_pCurrentCursor);
assert(pContentFrame->IsTextFrame());
diff --git a/xmlscript/qa/cppunit/test.cxx b/xmlscript/qa/cppunit/test.cxx
index fd5137db90d1..62f0bb1885c7 100644
--- a/xmlscript/qa/cppunit/test.cxx
+++ b/xmlscript/qa/cppunit/test.cxx
@@ -41,7 +41,6 @@ using namespace ::com::sun::star;
/// Sample tests for import
class XmlScriptTest : public test::BootstrapFixture, public unotest::MacrosTest, public XmlTestTools
{
- uno::Reference<lang::XComponent> mxComponent;
OUString maDataPath;
void testBasicElements();
@@ -53,7 +52,6 @@ class XmlScriptTest : public test::BootstrapFixture, public unotest::MacrosTest,
public:
virtual void setUp() override;
- virtual void tearDown() override;
virtual void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) override
{
@@ -76,14 +74,6 @@ void XmlScriptTest::setUp()
mxDesktop.set(frame::Desktop::create(mxComponentContext));
}
-void XmlScriptTest::tearDown()
-{
- if (mxComponent.is())
- mxComponent->dispose();
-
- test::BootstrapFixture::tearDown();
-}
-
Reference<container::XNameContainer> XmlScriptTest::importFile(std::u16string_view sFileName)
{
OUString sFullName = m_directories.getURLFromSrc(maDataPath) + sFileName;