summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/copypaste/false-positives.cpp
blob: 4c6275949dab78243e29cca26646beb0dc9cba28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// RUN: %clang_cc1 -analyze -std=c++11 -analyzer-checker=alpha.clone.CloneChecker -verify %s

// This test contains false-positive reports from the CloneChecker that need to
// be fixed.

void log();

int max(int a, int b) { // expected-warning{{Detected code clone.}}
  log();
  if (a > b)
    return a;
  return b;
}

// FIXME: Detect different variable patterns.
int min2(int a, int b) { // expected-note{{Related code clone is here.}}
  log();
  if (b > a)
    return a;
  return b;
}
OpenPOWER on IntegriCloud