[all-commits] [llvm/llvm-project] 9c74fb: [Sema] Improve -Wrange-loop-analysis warnings.

mordante via All-commits all-commits at lists.llvm.org
Sat Jan 11 06:34:43 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 9c74fb402e1b7aad4a509a49ab4792154b8ba2c8
      https://github.com/llvm/llvm-project/commit/9c74fb402e1b7aad4a509a49ab4792154b8ba2c8
  Author: Mark de Wever <koraq at xs4all.nl>
  Date:   2020-01-11 (Sat, 11 Jan 2020)

  Changed paths:
    M clang/lib/Sema/SemaStmt.cpp
    A clang/test/SemaCXX/warn-range-loop-analysis-trivially-copyable.cpp
    M clang/test/SemaCXX/warn-range-loop-analysis.cpp

  Log Message:
  -----------
  [Sema] Improve -Wrange-loop-analysis warnings.

No longer generate a diagnostic when a small trivially copyable type is
used without a reference. Before the test looked for a POD type and had no
size restriction. Since the range-based for loop is only available in
C++11 and POD types are trivially copyable in C++11 it's not required to
test for a POD type.

Since copying a large object will be expensive its size has been
restricted. 64 bytes is a common size of a cache line and if the object is
aligned the copy will be cheap. No performance impact testing has been
done.

Differential Revision: https://reviews.llvm.org/D72212




More information about the All-commits mailing list