Disable -Wrange-loop-analysis.

This warning was originally a stand alone clang warning, not part of
'all' or 'extra', which had false positives. These false positives were
particularly accute when a container's iterators are proxy iterators.
Unfortunately the warning was moved into 'all' before being fixed.

After this became apparent, the warning was modified and split up, but
not before it was shipped in Clang 10 and XCode 11. It appears the fixed
version of the warning is in Clang 12 and XCode 12. Until the older
compilers are no longer supported, disable the warning.

This explicitly keeps the useful range-loop-construct warning which is
part of the range-loop-analysis. The range-loop-bind-reference part is
disabled.

Change-Id: I4023613bc14ac90989e699989b49582fbd4793d7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372816
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
diff --git a/gn/BUILD.gn b/gn/BUILD.gn
index b36852a..7a7063a 100644
--- a/gn/BUILD.gn
+++ b/gn/BUILD.gn
@@ -475,6 +475,13 @@
       "-Wno-old-style-cast",
       "-Wno-padded",
       "-Wno-newline-eof",
+
+      # https://quuxplusone.github.io/blog/2020/08/26/wrange-loop-analysis/
+      # https://bugzilla.mozilla.org/show_bug.cgi?id=1683213
+      # https://reviews.llvm.org/D73007
+      # May be re-enabled once clang > 12 or XCode > 12 are required.
+      # When this line is removed the -Wrange-loop-construct line below can also be removed.
+      "-Wno-range-loop-analysis",
     ]
     cflags_cc += [
       "-Wno-c++98-compat",
@@ -490,6 +497,11 @@
       "-Wno-objcc-interface-ivars",
     ]
 
+    # Wno-range-loop-analysis turns off the whole group, but this warning was later split into
+    # range-loop-construct and range-loop-bind-reference. We want the former but not the latter.
+    # Created from clang/include/clang/Basic/DiagnosticGroups.td
+    cflags += [ "-Wrange-loop-construct" ]
+
     # Wno-deprecated turns off the whole group, but also has its own warnings like
     # out-of-line definition of constexpr static data member is redundant in C++17 and is deprecated [-Werror,-Wdeprecated]
     # but we would like others. Created from clang/include/clang/Basic/DiagnosticGroups.td