[PATCH] D71857: Fixes -Wrange-loop-analysis warnings

Aaron Ballman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 31 06:43:13 PST 2019


aaron.ballman added a comment.

It seems like some of the deductions are not spelling out the qualifiers or pointer/references explicitly in some cases, at least from my spot-checking. Can you go back through this patch to make sure we're getting those correct?



================
Comment at: clang-tools-extra/clang-tidy/cppcoreguidelines/SlicingCheck.cpp:78
     return;
-  for (const auto &Method : DerivedDecl.methods()) {
+  for (auto Method : DerivedDecl.methods()) {
     // Virtual destructors are OK. We're ignoring constructors since they are
----------------
Shouldn't this deduce to `const auto *`?


================
Comment at: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp:795
   if (const auto *Decl = Result.Nodes.getNodeAs<UsingDecl>("using")) {
-    for (const auto &Shadow : Decl->shadows()) {
+    for (auto Shadow : Decl->shadows()) {
       addUsage(NamingCheckFailures, Shadow->getTargetDecl(),
----------------
Same here.


================
Comment at: lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp:75
     return false;
-  for (const auto &param : call_inst->operand_values())
+  for (auto param : call_inst->operand_values())
     if (isRSAllocationPtrTy(param->getType()))
----------------
`auto *`?


================
Comment at: llvm/lib/Support/CommandLine.cpp:246
     if (SC == &*AllSubCommands) {
-      for (const auto &Sub : RegisteredSubCommands) {
+      for (auto Sub : RegisteredSubCommands) {
         if (SC == Sub)
----------------
`auto *`?


================
Comment at: llvm/lib/Support/CommandLine.cpp:2115
                 SmallVectorImpl<std::pair<const char *, SubCommand *>> &Subs) {
-  for (const auto &S : SubMap) {
+  for (auto S : SubMap) {
     if (S->getName().empty())
----------------
`auto *`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71857/new/

https://reviews.llvm.org/D71857





More information about the llvm-commits mailing list