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
10 lines
402 B
C++
10 lines
402 B
C++
// 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.}}
|