Skip to content

Commit

Permalink
[Analyzer] Fixes -Wrange-loop-analysis warnings
Browse files Browse the repository at this point in the history
This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall.

Differential Revision: https://reviews.llvm.org/D71809
  • Loading branch information
mordante committed Dec 22, 2019
1 parent 536c9a6 commit b6d9e97
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
Expand Up @@ -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);

Expand Down
3 changes: 2 additions & 1 deletion clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp
Expand Up @@ -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();

Expand Down

0 comments on commit b6d9e97

Please sign in to comment.