llvm-project/clang-tools-extra/clang-tidy/performance
Felix Berger cb4c12b611 [clang-tidy] performance-unnecessary-copy-initialization: Create option to exclude container types from triggering the check.
Add string list option of type names analagous to `AllowedTypes` which lets
users specify a list of ExcludedContainerTypes.

Types matching this list will not trigger the check when an expensive variable
is copy initialized from a const accessor method they provide, i.e.:

```
ExcludedContainerTypes = 'ExcludedType'

void foo() {
  ExcludedType<ExpensiveToCopy> Container;
  const ExpensiveToCopy NecessaryCopy = Container.get();
}
```

Even though an expensive to copy variable is copy initialized the check does not
trigger because the container type is excluded.

This is useful for container types that don't own their data, such as view types
where modification of the returned references in other places cannot be reliably
tracked, or const incorrect types.

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

Reviewed-by: ymandel
2021-07-22 16:20:20 -04:00
..
CMakeLists.txt [clang-tidy] Introduce misc No Integer To Pointer Cast check 2020-12-08 22:55:13 +03:00
FasterStringFindCheck.cpp [clang-tidy] Applied clang-tidy fixes. NFC 2021-01-29 01:01:19 +01:00
FasterStringFindCheck.h [clang-tidy] Update lang restrictions on perf module 2020-06-28 15:18:08 +01:00
ForRangeCopyCheck.cpp [clang-tidy] performance-for-range-copy: Don't trigger on implicit type conversions. 2021-03-02 20:02:48 -05:00
ForRangeCopyCheck.h [clang-tidy] Update lang restrictions on perf module 2020-06-28 15:18:08 +01:00
ImplicitConversionInLoopCheck.cpp [clang-tidy] Applied clang-tidy fixes. NFC 2021-01-29 01:01:19 +01:00
ImplicitConversionInLoopCheck.h [clang-tidy] Update lang restrictions on perf module 2020-06-28 15:18:08 +01:00
InefficientAlgorithmCheck.cpp [clang-tidy] Simplify inefficient algorithm check 2021-02-17 10:19:44 +00:00
InefficientAlgorithmCheck.h [clang-tidy] Simplify inefficient algorithm check 2021-02-17 10:19:44 +00:00
InefficientStringConcatenationCheck.cpp [clang-tidy] Applied clang-tidy fixes. NFC 2021-01-29 01:01:19 +01:00
InefficientStringConcatenationCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
InefficientVectorOperationCheck.cpp [clang-tidy] Applied clang-tidy fixes. NFC 2021-01-29 01:01:19 +01:00
InefficientVectorOperationCheck.h [clang-tidy] Update lang restrictions on perf module 2020-06-28 15:18:08 +01:00
MoveConstArgCheck.cpp [clang-tidy] Use new mapping matchers 2021-02-03 23:21:17 +00:00
MoveConstArgCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
MoveConstructorInitCheck.cpp [clang-tidy][NFC] Tweak some generation of diag messages 2021-02-26 19:10:25 +00:00
MoveConstructorInitCheck.h [clang-tidy] Remove IncludeInserter from MoveConstructorInit check. 2021-02-23 13:48:07 +00:00
NoAutomaticMoveCheck.cpp Remove references to the ast_type_traits namespace 2020-12-11 00:58:46 +01:00
NoAutomaticMoveCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
NoIntToPtrCheck.cpp [clang-tidy] Introduce misc No Integer To Pointer Cast check 2020-12-08 22:55:13 +03:00
NoIntToPtrCheck.h [clang-tidy] Introduce misc No Integer To Pointer Cast check 2020-12-08 22:55:13 +03:00
NoexceptMoveConstructorCheck.cpp [clang-tidy][NFC] Tweak some generation of diag messages 2021-02-26 19:10:25 +00:00
NoexceptMoveConstructorCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
PerformanceTidyModule.cpp [clang-tidy] Introduce misc No Integer To Pointer Cast check 2020-12-08 22:55:13 +03:00
TriviallyDestructibleCheck.cpp [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
TriviallyDestructibleCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
TypePromotionInMathFnCheck.cpp [clang-tidy] Applied clang-tidy fixes. NFC 2021-01-29 01:01:19 +01:00
TypePromotionInMathFnCheck.h [clang-tidy] Refactor IncludeInserter 2020-07-27 12:48:55 +01:00
UnnecessaryCopyInitialization.cpp [clang-tidy] performance-unnecessary-copy-initialization: Create option to exclude container types from triggering the check. 2021-07-22 16:20:20 -04:00
UnnecessaryCopyInitialization.h [clang-tidy] performance-unnecessary-copy-initialization: Create option to exclude container types from triggering the check. 2021-07-22 16:20:20 -04:00
UnnecessaryValueParamCheck.cpp [clang-tidy][NFC] Tweak some generation of diag messages 2021-02-26 19:10:25 +00:00
UnnecessaryValueParamCheck.h [clang-tidy] Refactor IncludeInserter 2020-07-27 12:48:55 +01:00