[clang] b6d9e97 - [Analyzer] Fixes -Wrange-loop-analysis warnings
Mark de Wever via cfe-commits
cfe-commits at lists.llvm.org
Sun Dec 22 10:14:39 PST 2019
Author: Mark de Wever
Date: 2019-12-22T19:13:34+01:00
New Revision: b6d9e976629ac655e0ed2655289e90357107793f
URL: https://github.com/llvm/llvm-project/commit/b6d9e976629ac655e0ed2655289e90357107793f
DIFF: https://github.com/llvm/llvm-project/commit/b6d9e976629ac655e0ed2655289e90357107793f.diff
LOG: [Analyzer] Fixes -Wrange-loop-analysis warnings
This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall.
Differential Revision: https://reviews.llvm.org/D71809
Added:
Modified:
clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp
Removed:
################################################################################
diff --git a/clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp b/clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
index f47776c711ad..eb962a2ffd9e 100644
--- a/clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
@@ -1100,7 +1100,7 @@ void IteratorModeling::printState(raw_ostream &Out, ProgramStateRef State,
if (!ContMap.isEmpty()) {
Out << Sep << "Container Data :" << NL;
- for (const auto Cont : ContMap) {
+ for (const auto &Cont : ContMap) {
Cont.first->dumpToStream(Out);
Out << " : [ ";
const auto CData = Cont.second;
@@ -1122,7 +1122,7 @@ void IteratorModeling::printState(raw_ostream &Out, ProgramStateRef State,
if (!SymbolMap.isEmpty() || !RegionMap.isEmpty()) {
Out << Sep << "Iterator Positions :" << NL;
- for (const auto Sym : SymbolMap) {
+ for (const auto &Sym : SymbolMap) {
Sym.first->dumpToStream(Out);
Out << " : ";
const auto Pos = Sym.second;
@@ -1132,7 +1132,7 @@ void IteratorModeling::printState(raw_ostream &Out, ProgramStateRef State,
Pos.getOffset()->dumpToStream(Out);
}
- for (const auto Reg : RegionMap) {
+ for (const auto &Reg : RegionMap) {
Reg.first->dumpToStream(Out);
Out << " : ";
const auto Pos = Reg.second;
diff --git a/clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
index b7b6cab0c8e3..5997b2a07417 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
@@ -686,7 +686,7 @@ void MoveChecker::checkDeadSymbols(SymbolReaper &SymReaper,
CheckerContext &C) const {
ProgramStateRef State = C.getState();
TrackedRegionMapTy TrackedRegions = State->get<TrackedRegionMap>();
- for (TrackedRegionMapTy::value_type E : TrackedRegions) {
+ for (const auto &E : TrackedRegions) {
const MemRegion *Region = E.first;
bool IsRegDead = !SymReaper.isLiveRegion(Region);
diff --git a/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp b/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp
index e00fd976f6b8..f5c05281adab 100644
--- a/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp
+++ b/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp
@@ -591,7 +591,8 @@ void CheckerRegistry::printCheckerOptionList(raw_ostream &Out) const {
/*MinLineWidth*/ 90);
Out << "\n\n";
};
- for (const std::pair<StringRef, const CmdLineOption &> &Entry : OptionMap) {
+ for (const std::pair<const StringRef, const CmdLineOption &> &Entry :
+ OptionMap) {
const CmdLineOption &Option = Entry.second;
std::string FullOption = (Entry.first + ":" + Option.OptionName).str();
More information about the cfe-commits
mailing list