[all-commits] [llvm/llvm-project] 211761: [clang-tidy] Allow opt-in or out of some commonly ...

funwith4 via All-commits all-commits at lists.llvm.org
Wed May 12 11:51:53 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 211761332e4381c37edd91be7c59fc048014ff4e
      https://github.com/llvm/llvm-project/commit/211761332e4381c37edd91be7c59fc048014ff4e
  Author: Stephen Concannon <stephen.concannon at gmail.com>
  Date:   2021-05-12 (Wed, 12 May 2021)

  Changed paths:
    M clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp
    M clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.h
    M clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-narrowing-conversions.rst
    A clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-equivalentbitwidth-option.cpp
    A clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-ignoreconversionfromtypes-option.cpp
    A clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-intemplates-option.cpp

  Log Message:
  -----------
  [clang-tidy] Allow opt-in or out of some commonly occuring patterns in NarrowingConversionsCheck.

Within clang-tidy's NarrowingConversionsCheck.
* Allow opt-out of some common occurring patterns, such as:
  - Implicit casts between types of equivalent bit widths.
  - Implicit casts occurring from the return of a ::size() method.
  - Implicit casts on size_type and difference_type.
* Allow opt-in of errors within template instantiations.

This will help projects adopt these guidelines iteratively.
Developed in conjunction with Yitzhak Mandelbaum (ymandel).

Patch by Stephen Concannon!

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




More information about the All-commits mailing list