aboutsummaryrefslogtreecommitdiff
path: root/clang-tidy/utils
diff options
context:
space:
mode:
authorAdam Balogh <adam.balogh@ericsson.com>2018-10-12 13:05:21 +0000
committerAdam Balogh <adam.balogh@ericsson.com>2018-10-12 13:05:21 +0000
commit083ebf67ecae791a74f88713acbab5217ee8163f (patch)
tree9b3cd8ce023b58fd5bd17a4b7ed1cd8b55516210 /clang-tidy/utils
parentfc24838208eaba7ea03f353704ca0e32977c8cde (diff)
[clang-tidy] White List Option for performance-unnecessary-value-param, performance-unnecessary-copy-initialization and performance-for-range-copy
New option added to these three checks to be able to silence false positives on types that are intentionally passed by value or copied. Such types are e.g. intrusive reference counting pointer types like llvm::IntrusiveRefCntPtr. The new option is named WhiteListTypes and can contain a semicolon-separated list of names of these types. Regular expressions are allowed. Default is empty. Differential Revision: https://reviews.llvm.org/D52727 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@344340 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'clang-tidy/utils')
-rw-r--r--clang-tidy/utils/Matchers.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang-tidy/utils/Matchers.h b/clang-tidy/utils/Matchers.h
index aeb639fa..849b36fb 100644
--- a/clang-tidy/utils/Matchers.h
+++ b/clang-tidy/utils/Matchers.h
@@ -48,6 +48,13 @@ AST_MATCHER_FUNCTION(ast_matchers::TypeMatcher, isReferenceToConst) {
return referenceType(pointee(qualType(isConstQualified())));
}
+AST_MATCHER_P(NamedDecl, matchesAnyListedName, std::vector<std::string>,
+ NameList) {
+ return llvm::any_of(NameList, [&Node](const std::string &Name) {
+ return llvm::Regex(Name).match(Node.getName());
+ });
+}
+
} // namespace matchers
} // namespace tidy
} // namespace clang