llvm-project/clang-tools-extra/clang-tidy
Matthias Gehre dd117cf01d cppcoreguidelines-pro-bounds-constant-array-index: ignore implicit constructor
Summary:
The code

  struct A {
    int x[3];
  };

gets an compiler-generated copy constructor that uses ArraySubscriptExpr (see below).
Previously, the check would generate a warning on that copy constructor.
This commit disables the warning on implicitly generated code.
AST:

  |-CXXConstructorDecl 0x337b3c8 <col:8> col:8 implicit used constexpr A 'void (const struct A &) noexcept' inline
  | |-ParmVarDecl 0x337b510 <col:8> col:8 used 'const struct A &'
  | |-CXXCtorInitializer Field 0x3379238 'x' 'int [3]'
  | | `-ImplicitCastExpr 0x337e158 <col:8> 'int' <LValueToRValue>
  | |   `-ArraySubscriptExpr 0x337e130 <col:8> 'const int' lvalue
  | |     |-ImplicitCastExpr 0x337e118 <col:8> 'const int *' <ArrayToPointerDecay>
  | |     | `-MemberExpr 0x337dfc8 <col:8> 'int const[3]' lvalue .x 0x3379238
  | |     |   `-DeclRefExpr 0x337dfa0 <col:8> 'const struct A' lvalue ParmVar 0x337b510 '' 'const struct A &'
  | |     `-ImplicitCastExpr 0x337e098 <col:8> 'unsigned long' <LValueToRValue>
  | |       `-DeclRefExpr 0x337e070 <col:8> 'unsigned long' lvalue Var 0x337e010 '__i0' 'unsigned long'

Reviewers: alexfh, aaron.ballman

Subscribers: aemerson, nemanjai, cfe-commits

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

llvm-svn: 275993
2016-07-19 17:02:54 +00:00
..
boost [clang-tidy] boost-use-to-string arg expr location bugfix 2016-06-28 08:16:20 +00:00
cert [ASTMatchers] Added ignoringParenImpCasts to has matchers 2016-05-31 15:26:56 +00:00
cppcoreguidelines cppcoreguidelines-pro-bounds-constant-array-index: ignore implicit constructor 2016-07-19 17:02:54 +00:00
google Apply performance-unnecessary-value-param to clang-tidy. 2016-06-15 15:46:10 +00:00
llvm Fix clang-tidy patterns to adapt to newly added ExprWithCleanups nodes. 2016-06-21 20:11:20 +00:00
misc [clang-tidy] Fix misc-definitions-in-headers misplaced fixing to fully templated function. 2016-07-13 13:55:29 +00:00
modernize [clang-tidy] Add modernize-use-using 2016-06-25 18:37:53 +00:00
performance [clang-tidy] UnnecessaryValueParamCheck - only warn for virtual methods 2016-07-05 14:40:44 +00:00
plugin Add boost-use-to-string 2016-04-29 17:58:29 +00:00
readability clang-tidy/readability-identifier-naming: crash on DependentTemplateSpecializationType 2016-07-09 20:09:28 +00:00
tool [clang-tidy] Pass absolute path to OptionsProvider::getOptions/getRawOptions. 2016-07-11 07:47:04 +00:00
utils [clang-tidy] UnnecessaryValueParamCheck - suggest std::move() if non-const value parameter can be moved. 2016-07-01 20:12:15 +00:00
CMakeLists.txt Add boost-use-to-string 2016-04-29 17:58:29 +00:00
ClangTidy.cpp Unbreak extra tools build post r275882. 2016-07-18 19:21:22 +00:00
ClangTidy.h [clang-tidy] Fix doxygen errors. NFC. 2016-06-17 11:43:33 +00:00
ClangTidyDiagnosticConsumer.cpp [clang-tidy] Switch to a more common way of customizing check behavior. 2016-05-20 13:42:40 +00:00
ClangTidyDiagnosticConsumer.h [clang-tidy] Switch to a more common way of customizing check behavior. 2016-05-20 13:42:40 +00:00
ClangTidyModule.cpp Apply performance-unnecessary-value-param to clang-tidy. 2016-06-15 15:46:10 +00:00
ClangTidyModule.h Revert "Apply modernize-use-default to clang-tools-extra." 2015-10-20 21:45:52 +00:00
ClangTidyModuleRegistry.h [clang-tidy] Fixed header guards using clang-tidy llvm-header-guard check. NFC. 2015-03-09 16:52:33 +00:00
ClangTidyOptions.cpp [clang-tidy] Pass absolute path to OptionsProvider::getOptions/getRawOptions. 2016-07-11 07:47:04 +00:00
ClangTidyOptions.h [ClangTidy] Add an 'explain-checks' option to diagnose where each checks comes from. 2016-04-27 09:15:01 +00:00
add_new_check.py [clang-tidy] Remove redundant quote in add_new_check script 2016-05-30 15:42:08 +00:00
rename_check.py [clang-tidy] Python script for easy check rename 2015-10-11 07:58:34 +00:00