xref: /llvm-project/clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone-unknown-expr.cpp (revision a65a3bffd31f57243929b0f50abbd90bd626faee)
1*a65a3bffSIshaan Gandhi // RUN: %check_clang_tidy -expect-clang-tidy-error %s bugprone-branch-clone %t
2*a65a3bffSIshaan Gandhi 
test_unknown_expression()3*a65a3bffSIshaan Gandhi int test_unknown_expression() {
4*a65a3bffSIshaan Gandhi   if (unknown_expression_1) {        // CHECK-MESSAGES: :[[@LINE]]:7: error: use of undeclared identifier 'unknown_expression_1' [clang-diagnostic-error]
5*a65a3bffSIshaan Gandhi     function1(unknown_expression_2); // CHECK-MESSAGES: :[[@LINE]]:15: error: use of undeclared identifier 'unknown_expression_2' [clang-diagnostic-error]
6*a65a3bffSIshaan Gandhi   } else {
7*a65a3bffSIshaan Gandhi     function2(unknown_expression_3); // CHECK-MESSAGES: :[[@LINE]]:15: error: use of undeclared identifier 'unknown_expression_3' [clang-diagnostic-error]
8*a65a3bffSIshaan Gandhi   }
9*a65a3bffSIshaan Gandhi }
10