================ @@ -0,0 +1,772 @@ +// RUN: clang-tidy %s -checks="-*,bugprone-branch-clone" -- 2>&1 | FileCheck %s --check-prefix=CHECK-MESSAGES-BUGPRONEBRANCH + +/* Only one expected warning per function allowed at the very end. */ + +int func(void) +{ + return 0; +} + +int func2(void) +{ + return 0; +} + +int funcParam(int a) +{ + return 0; +} + +/* '!=' operator*/ + + +/* '!=' with int pointer */ + +int checkNotEqualIntPointerLiteralCompare1(void) { + int* p = 0; + return (p != 0); // no warning +} + +int checkNotEqualIntPointerLiteralCompare2(void) { + return (6 != 7); // no warning +} + +int checkNotEqualIntPointerDeclCompare1(void) { + int k = 3; + int* f = &k; + int* g = &k; + return (f != g); // no warning +} + +int checkNotEqualCastIntPointerDeclCompare11(void) { + int k = 7; + int* f = &k; + return ((int*)f != (int*)f); +// CHECK-MESSAGES-IDENTEXPR: :[[@LINE-1]]:19: warning: both sides of operator are equivalent [misc-redundant-expression] ---------------- 5chmidti wrote:
You left-in `IDENTEXPR`-suffix checks, which are confusing when this file is not for testing the redundant expression check. https://github.com/llvm/llvm-project/pull/119543 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits