[all-commits] [llvm/llvm-project] cf4810: [clang-tidy] implement utility-function to add 'co...

JonasToth via All-commits all-commits at lists.llvm.org
Fri Jan 3 11:38:13 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: cf48101200ee192dd82e6ed0512ae42e7b3162a9
      https://github.com/llvm/llvm-project/commit/cf48101200ee192dd82e6ed0512ae42e7b3162a9
  Author: Jonas Toth <development at jonas-toth.eu>
  Date:   2020-01-03 (Fri, 03 Jan 2020)

  Changed paths:
    M clang-tools-extra/clang-tidy/performance/ForRangeCopyCheck.cpp
    M clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp
    M clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
    M clang-tools-extra/clang-tidy/utils/FixItHintUtils.cpp
    M clang-tools-extra/clang-tidy/utils/FixItHintUtils.h
    M clang-tools-extra/clang-tidy/utils/LexerUtils.cpp
    M clang-tools-extra/clang-tidy/utils/LexerUtils.h
    A clang-tools-extra/unittests/clang-tidy/AddConstTest.cpp
    M clang-tools-extra/unittests/clang-tidy/CMakeLists.txt

  Log Message:
  -----------
  [clang-tidy] implement utility-function to add 'const' to variables

Summary:
This patch extends the already existing facility to add 'const' to variables
to be more flexible and correct. The previous version did not consider pointers
as value AND pointee. For future automatic introduction for const-correctness
this shortcoming needs to be fixed.
It always allows configuration where the 'const' token is inserted, either on
the left side (if possible) or the right side.
It adds many unit-tests to the utility-function that did not exist before, as
the function was implicitly tested through clang-tidy checks. These
tests were not changed, as the API is still compatible.

Reviewers: aaron.ballman, hokein, alexfh, shuaiwang, lebedev.ri

Reviewed By: aaron.ballman

Subscribers: jdoerfert, mgorny, xazax.hun, cfe-commits

Tags: #clang

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




More information about the All-commits mailing list