[all-commits] [llvm/llvm-project] 3adaa9: Fix ForRangeCopyCheck not triggering on iterators ...

Dmitri Gribenko via All-commits all-commits at lists.llvm.org
Wed May 6 00:44:40 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 3adaa97f0157e9d274c4d4e69b733db75b963574
      https://github.com/llvm/llvm-project/commit/3adaa97f0157e9d274c4d4e69b733db75b963574
  Author: Dmitri Gribenko <gribozavr at gmail.com>
  Date:   2020-05-06 (Wed, 06 May 2020)

  Changed paths:
    M clang-tools-extra/clang-tidy/performance/ForRangeCopyCheck.cpp
    M clang-tools-extra/test/clang-tidy/checkers/performance-for-range-copy.cpp

  Log Message:
  -----------
  Fix ForRangeCopyCheck not triggering on iterators returning elements by value in C++17.

Summary:
The AST is different in C++17 in that there is no MaterializeTemporaryExpr for in the AST for a loop variable that is initialized from an iterator that returns its elements by value.

Account for this by checking that the variable is not initialized by an operator* call that returns a value type.

Reviewers: gribozavr2

Reviewed By: gribozavr2

Subscribers: cfe-commits

Tags: #clang

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




More information about the All-commits mailing list