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/function-try-block.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/function-try-block.cpp')
-rw-r--r-- | clang/test/Analysis/copypaste/function-try-block.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/Analysis/copypaste/function-try-block.cpp b/clang/test/Analysis/copypaste/function-try-block.cpp new file mode 100644 index 00000000000..b13096d949a --- /dev/null +++ b/clang/test/Analysis/copypaste/function-try-block.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -analyze -fcxx-exceptions -std=c++1z -analyzer-checker=alpha.clone.CloneChecker -verify %s + +// Tests if function try blocks are correctly handled. + +void nonCompoundStmt1(int& x) + try { x += 1; } catch(...) { x -= 1; } // expected-warning{{Detected code clone.}} + +void nonCompoundStmt2(int& x) + try { x += 1; } catch(...) { x -= 1; } // expected-note{{Related code clone is here.}} |