diff options
author | Artem Dergachev <artem.dergachev@gmail.com> | 2016-08-02 12:21:09 +0000 |
---|---|---|
committer | Artem Dergachev <artem.dergachev@gmail.com> | 2016-08-02 12:21:09 +0000 |
commit | 78692ea590046c7c9a66e58a14165ff6b16b5ae5 (patch) | |
tree | ed55724a4d77ce1d14a17f2ca2a36090990381af /clang/test/Analysis/copypaste/lambda.cpp | |
parent | 3f704497fa409aba387a75770e1be9198b5796e4 (diff) | |
download | bcm5719-llvm-78692ea590046c7c9a66e58a14165ff6b16b5ae5.tar.gz bcm5719-llvm-78692ea590046c7c9a66e58a14165ff6b16b5ae5.zip |
[analyzer] Respect statement-specific data in CloneDetection.
So far the CloneDetector only respected the kind of each statement when
searching for clones. This patch refines the way the CloneDetector collects data
from each statement by providing methods for each statement kind,
that will read the kind-specific attributes.
For example, statements 'a < b' and 'a > b' are no longer considered to be
clones, because they are different in operation code, which is an attribute
specific to the BinaryOperator statement kind.
Patch by Raphael Isemann!
Differential Revision: https://reviews.llvm.org/D22514
llvm-svn: 277449
Diffstat (limited to 'clang/test/Analysis/copypaste/lambda.cpp')
-rw-r--r-- | clang/test/Analysis/copypaste/lambda.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/test/Analysis/copypaste/lambda.cpp b/clang/test/Analysis/copypaste/lambda.cpp new file mode 100644 index 00000000000..c13c56f6671 --- /dev/null +++ b/clang/test/Analysis/copypaste/lambda.cpp @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -analyze -std=c++11 -analyzer-checker=alpha.clone.CloneChecker -verify %s + +// expected-no-diagnostics + +void foo1(int a, long b) { + auto l = [a, b](){}; +} + +void foo2(int a, long b) { + auto l = [&a, b](){}; +} + +void foo3(int a, long b) { + auto l = [a](){}; +} + +void foo4(int a, long b) { + auto l = [=](){}; +} + +void foo5(int a, long b) { + auto l = [&](){}; +} + |