[Libreoffice-commits] core.git: compilerplugins/clang

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 23 12:41:16 UTC 2019


 compilerplugins/clang/sequenceloop.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9a251699d728fa6207b71406cd91aafb7803f453
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Aug 23 09:05:46 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Aug 23 14:40:19 2019 +0200

    Improve loplugin:sequenceloop warning
    
    ...from
    
    > sfx2/source/appl/shutdowniconaqua.mm:416:13: error: use std::as_const, or make range var const, to avoid creating a copy of the Sequence [loplugin:sequenceloop]
    >             for ( auto const & newMenuProp : aNewMenu )
    >             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    to
    
    > sfx2/source/appl/shutdowniconaqua.mm:416:46: error: use std::as_const, or make range var const, to avoid creating a copy of the Sequence [loplugin:sequenceloop]
    >             for ( auto const & newMenuProp : aNewMenu )
    >             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
    
    Change-Id: I1eabe80abeed1784a246a6e3c9b7036f664ee681
    Reviewed-on: https://gerrit.libreoffice.org/77989
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/compilerplugins/clang/sequenceloop.cxx b/compilerplugins/clang/sequenceloop.cxx
index 340412a5137a..735c57d21b8e 100644
--- a/compilerplugins/clang/sequenceloop.cxx
+++ b/compilerplugins/clang/sequenceloop.cxx
@@ -64,7 +64,7 @@ bool SequenceLoop::VisitCXXForRangeStmt(CXXForRangeStmt const* forStmt)
 
     report(DiagnosticsEngine::Warning,
            "use std::as_const, or make range var const, to avoid creating a copy of the Sequence",
-           compat::getBeginLoc(forStmt))
+           compat::getBeginLoc(forStmt->getRangeInit()))
         << forStmt->getSourceRange();
     return true;
 }


More information about the Libreoffice-commits mailing list