Skip to content

Commit

Permalink
Adds -Wrange-loop-analysis to -Wall
Browse files Browse the repository at this point in the history
This makes the range loop warnings part of -Wall.

Fixes PR32823: Warn about accidental coping of data in range based for

Differential Revision: https://reviews.llvm.org/D68912
  • Loading branch information
mordante committed Jan 1, 2020
1 parent e5ab1e4 commit d811754
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/DiagnosticGroups.td
Expand Up @@ -857,11 +857,11 @@ def Most : DiagGroup<"most", [
CharSubscript,
Comment,
DeleteNonVirtualDtor,
ForLoopAnalysis,
Format,
Implicit,
InfiniteRecursion,
IntInBoolContext,
LoopAnalysis,
MismatchedTags,
MissingBraces,
Move,
Expand Down
4 changes: 3 additions & 1 deletion clang/test/Misc/warning-wall.c
Expand Up @@ -8,7 +8,6 @@ CHECK-NEXT: -Wcomment
CHECK-NEXT: -Wdelete-non-virtual-dtor
CHECK-NEXT: -Wdelete-non-abstract-non-virtual-dtor
CHECK-NEXT: -Wdelete-abstract-non-virtual-dtor
CHECK-NEXT: -Wfor-loop-analysis
CHECK-NEXT: -Wformat
CHECK-NEXT: -Wformat-extra-args
CHECK-NEXT: -Wformat-zero-length
Expand All @@ -21,6 +20,9 @@ CHECK-NEXT: -Wimplicit-function-declaration
CHECK-NEXT: -Wimplicit-int
CHECK-NEXT: -Winfinite-recursion
CHECK-NEXT: -Wint-in-bool-context
CHECK-NEXT: -Wloop-analysis
CHECK-NEXT: -Wfor-loop-analysis
CHECK-NEXT: -Wrange-loop-analysis
CHECK-NEXT: -Wmismatched-tags
CHECK-NEXT: -Wmissing-braces
CHECK-NEXT: -Wmove
Expand Down
1 change: 1 addition & 0 deletions clang/test/SemaCXX/warn-range-loop-analysis.cpp
@@ -1,3 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wall -Wno-unused -verify %s
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wloop-analysis -verify %s
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wrange-loop-analysis -verify %s
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wloop-analysis -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
Expand Down

0 comments on commit d811754

Please sign in to comment.