Clang Project

clang_source_code/test/Analysis/copypaste/attributes.cpp
1// RUN: %clang_analyze_cc1 -std=c++1z -analyzer-checker=alpha.clone.CloneChecker -analyzer-config alpha.clone.CloneChecker:MinimumCloneComplexity=10 -verify %s
2
3// expected-no-diagnostics
4
5int foo1(int n) {
6  int result = 0;
7  switch (n) {
8  case 33:
9    result += 33;
10    [[clang::fallthrough]];
11  case 44:
12    result += 44;
13  }
14  return result;
15}
16
17// Identical to foo1 except the missing attribute.
18int foo2(int n) {
19  int result = 0;
20  switch (n) {
21  case 33:
22    result += 33;
23    ;
24  case 44:
25    result += 44;
26  }
27  return result;
28}
29