[PATCH] D71529: [Sema] Fixes -Wrange-loop-analysis warnings

Mark de Wever via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 15 10:05:04 PST 2019


Mordante created this revision.
Mordante added reviewers: rsmith, aaron.ballman, xbolva00.
Mordante added a project: clang.

This avoids new warnings due to D68912 <https://reviews.llvm.org/D68912> adds -Wrange-loop-analysis to -Wall.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71529

Files:
  clang/lib/Sema/AnalysisBasedWarnings.cpp
  clang/lib/Sema/SemaCodeComplete.cpp


Index: clang/lib/Sema/SemaCodeComplete.cpp
===================================================================
--- clang/lib/Sema/SemaCodeComplete.cpp
+++ clang/lib/Sema/SemaCodeComplete.cpp
@@ -1309,7 +1309,7 @@
         /// Motivating case is const_iterator begin() const vs iterator begin().
         auto &OverloadSet = OverloadMap[std::make_pair(
             CurContext, Method->getDeclName().getAsOpaqueInteger())];
-        for (const DeclIndexPair& Entry : OverloadSet) {
+        for (const DeclIndexPair Entry : OverloadSet) {
           Result &Incumbent = Results[Entry.second];
           switch (compareOverloads(*Method,
                                    *cast<CXXMethodDecl>(Incumbent.Declaration),
Index: clang/lib/Sema/AnalysisBasedWarnings.cpp
===================================================================
--- clang/lib/Sema/AnalysisBasedWarnings.cpp
+++ clang/lib/Sema/AnalysisBasedWarnings.cpp
@@ -1174,7 +1174,7 @@
     // We analyze lambda bodies separately. Skip them here.
     bool TraverseLambdaExpr(LambdaExpr *LE) {
       // Traverse the captures, but not the body.
-      for (const auto &C : zip(LE->captures(), LE->capture_inits()))
+      for (const auto C : zip(LE->captures(), LE->capture_inits()))
         TraverseLambdaCapture(LE, &std::get<0>(C), std::get<1>(C));
       return true;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71529.233977.patch
Type: text/x-patch
Size: 1340 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191215/87709387/attachment.bin>


More information about the cfe-commits mailing list