diff options
author | Alexander Kornienko <alexfh@google.com> | 2015-12-30 11:35:50 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2015-12-30 11:35:50 +0000 |
commit | 8d228dda413a3c4b40cf0480f06b0edb232ba2c4 (patch) | |
tree | d81c05af7697122cd3f2e81d9e6afa3aa2adea93 /clang-tools-extra/test/clang-tidy/performance-unnecessary-copy-initialization.cpp | |
parent | 72a96c66b275a27c5d7975d3a3435c1ffcd98c9d (diff) | |
download | bcm5719-llvm-8d228dda413a3c4b40cf0480f06b0edb232ba2c4.tar.gz bcm5719-llvm-8d228dda413a3c4b40cf0480f06b0edb232ba2c4.zip |
[clang-tidy] Use hasLocalStorage() to identify unnecessary copy initializations to exclude static local variables.
Summary: Since local static variables can outlive other local variables exclude them from the unnecessary copy initialization check.
Reviewers: alexfh
Patch by Felix Berger!
Differential Revision: http://reviews.llvm.org/D15822
llvm-svn: 256636
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/performance-unnecessary-copy-initialization.cpp')
-rw-r--r-- | clang-tools-extra/test/clang-tidy/performance-unnecessary-copy-initialization.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/performance-unnecessary-copy-initialization.cpp b/clang-tools-extra/test/clang-tidy/performance-unnecessary-copy-initialization.cpp index 7eb7d2fef67..aaaeffd652a 100644 --- a/clang-tools-extra/test/clang-tidy/performance-unnecessary-copy-initialization.cpp +++ b/clang-tools-extra/test/clang-tidy/performance-unnecessary-copy-initialization.cpp @@ -110,6 +110,10 @@ void NegativeFunctionCallTrivialType() { const TrivialToCopyType VarCopyConstructed(TrivialTypeReference()); } +void NegativeStaticLocalVar(const ExpensiveToCopyType &Obj) { + static const auto StaticVar = Obj.reference(); +} + void NegativeFunctionCallExpensiveTypeNonConstVariable() { auto AutoAssigned = ExpensiveTypeReference(); auto AutoCopyConstructed(ExpensiveTypeReference()); |