-Werror,-Wrange-loop-analysis

Change-Id: I254e1b69f66b985d66c9ce3707614c3b505f2335
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101975
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2020-09-02 21:09:29 +02:00
parent 3577292de9
commit 8dcb43b430
4 changed files with 7 additions and 7 deletions

View File

@@ -46,7 +46,7 @@ bool isDerivedFrom(
bool * hidden) bool * hidden)
{ {
bool derived = false; bool derived = false;
for (auto const i: decl->bases()) { for (auto const & i: decl->bases()) {
auto const bd auto const bd
= (cast<CXXRecordDecl>(i.getType()->getAs<RecordType>()->getDecl()) = (cast<CXXRecordDecl>(i.getType()->getAs<RecordType>()->getDecl())
->getDefinition()); ->getDefinition());

View File

@@ -421,7 +421,7 @@ private:
{ {
continue; continue;
} }
for (auto const t : affected) for (auto const& t : affected)
{ {
auto const tc = t.getCanonicalType(); auto const tc = t.getCanonicalType();
for (auto p = f->param_begin(); p != f->param_end(); ++p) for (auto p = f->param_begin(); p != f->param_end(); ++p)

View File

@@ -235,7 +235,7 @@ private:
void FakeBool::run() { void FakeBool::run() {
if (compiler.getLangOpts().CPlusPlus) { if (compiler.getLangOpts().CPlusPlus) {
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
for (auto const dcl: varDecls_) { for (auto const & dcl: varDecls_) {
auto const decl = dcl.first; auto const fbk = dcl.second; auto const decl = dcl.first; auto const fbk = dcl.second;
SourceLocation loc { compat::getBeginLoc(decl) }; SourceLocation loc { compat::getBeginLoc(decl) };
TypeSourceInfo * tsi = decl->getTypeSourceInfo(); TypeSourceInfo * tsi = decl->getTypeSourceInfo();
@@ -277,7 +277,7 @@ void FakeBool::run() {
<< decl->getSourceRange(); << decl->getSourceRange();
} }
} }
for (auto const dcl: fieldDecls_) { for (auto const & dcl: fieldDecls_) {
auto const decl = dcl.first; auto const fbk = dcl.second; auto const decl = dcl.first; auto const fbk = dcl.second;
SourceLocation loc { compat::getBeginLoc(decl) }; SourceLocation loc { compat::getBeginLoc(decl) };
TypeSourceInfo * tsi = decl->getTypeSourceInfo(); TypeSourceInfo * tsi = decl->getTypeSourceInfo();
@@ -319,7 +319,7 @@ void FakeBool::run() {
} }
} }
auto const ignoredFns = getFunctionsWithAddressTaken(); auto const ignoredFns = getFunctionsWithAddressTaken();
for (auto const dcl: parmVarDecls_) { for (auto const & dcl: parmVarDecls_) {
auto const decl = dcl.first; auto const fbk = dcl.second; auto const decl = dcl.first; auto const fbk = dcl.second;
FunctionDecl const * f = cast<FunctionDecl>(decl->getDeclContext())->getCanonicalDecl(); FunctionDecl const * f = cast<FunctionDecl>(decl->getDeclContext())->getCanonicalDecl();
if (ignoredFns.find(f) != ignoredFns.end()) { if (ignoredFns.find(f) != ignoredFns.end()) {
@@ -393,7 +393,7 @@ void FakeBool::run() {
<< decl->getSourceRange(); << decl->getSourceRange();
} }
} }
for (auto const dcl: functionDecls_) { for (auto const & dcl: functionDecls_) {
auto const decl = dcl.first; auto const fbk = dcl.second; auto const decl = dcl.first; auto const fbk = dcl.second;
FunctionDecl const * f = decl->getCanonicalDecl(); FunctionDecl const * f = decl->getCanonicalDecl();
if (ignoredFns.find(f) != ignoredFns.end()) { if (ignoredFns.find(f) != ignoredFns.end()) {

View File

@@ -609,7 +609,7 @@ bool SalCall::isSalCallFunction(FunctionDecl const* functionDecl, SourceLocation
} }
ranges.emplace_back(startLoc, endLoc); ranges.emplace_back(startLoc, endLoc);
for (auto const range : ranges) for (auto const& range : ranges)
{ {
if (range.isInvalid()) if (range.isInvalid())
{ {