diff options
-rw-r--r-- | compilerplugins/clang/sequenceloop.cxx | 3 | ||||
-rw-r--r-- | compilerplugins/clang/test/sequenceloop.cxx | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/compilerplugins/clang/sequenceloop.cxx b/compilerplugins/clang/sequenceloop.cxx index 0e6b23893298..7f14d6c4d951 100644 --- a/compilerplugins/clang/sequenceloop.cxx +++ b/compilerplugins/clang/sequenceloop.cxx @@ -64,7 +64,8 @@ bool SequenceLoop::VisitCXXForRangeStmt(CXXForRangeStmt const* forStmt) return true; report(DiagnosticsEngine::Warning, - "use std::as_const, or make range var const, to avoid creating a copy of the Sequence", + ("use std::as_const, or otherwise make the for-range-initializer expression const, to" + " avoid creating a copy of the Sequence"), compat::getBeginLoc(forStmt->getRangeInit())) << forStmt->getSourceRange(); return true; diff --git a/compilerplugins/clang/test/sequenceloop.cxx b/compilerplugins/clang/test/sequenceloop.cxx index 113e8fd588fe..e124fda27093 100644 --- a/compilerplugins/clang/test/sequenceloop.cxx +++ b/compilerplugins/clang/test/sequenceloop.cxx @@ -15,7 +15,7 @@ namespace test1 { void foo(css::uno::Sequence<css::uno::Reference<css::uno::XInterface>>& aSeq) { - // expected-error@+1 {{use std::as_const, or make range var const, to avoid creating a copy of the Sequence [loplugin:sequenceloop]}} + // expected-error@+1 {{use std::as_const, or otherwise make the for-range-initializer expression const, to avoid creating a copy of the Sequence [loplugin:sequenceloop]}} for (const auto& x : aSeq) x.get(); // no warning expected |