CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
178 lines
9.0 KiB
C++
178 lines
9.0 KiB
C++
// RUN: %check_clang_tidy %s readability-operators-representation %t -- -config="{CheckOptions: {\
|
|
// RUN: readability-operators-representation.BinaryOperators: '&&;&=;&;|;~;!;!=;||;|=;^;^=', \
|
|
// RUN: readability-operators-representation.OverloadedOperators: '&&;&=;&;|;~;!;!=;||;|=;^;^='}}" --
|
|
|
|
void testAllTokensToAlternative(int a, int b) {
|
|
int value = 0;
|
|
|
|
value = a or b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: 'or' is an alternative token spelling, consider using a traditional token '||' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: value = a || b;
|
|
|
|
value = a and b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: 'and' is an alternative token spelling, consider using a traditional token '&&' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: value = a && b;
|
|
|
|
value = a bitor b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: 'bitor' is an alternative token spelling, consider using a traditional token '|' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: value = a | b;
|
|
|
|
value = a bitand b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: 'bitand' is an alternative token spelling, consider using a traditional token '&' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: value = a & b;
|
|
|
|
value = not a;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: 'not' is an alternative token spelling, consider using a traditional token '!' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: value = ! a;
|
|
|
|
value = a xor b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: 'xor' is an alternative token spelling, consider using a traditional token '^' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: value = a ^ b;
|
|
|
|
value = compl b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: 'compl' is an alternative token spelling, consider using a traditional token '~' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: value = ~ b;
|
|
|
|
value and_eq b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: 'and_eq' is an alternative token spelling, consider using a traditional token '&=' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: value &= b;
|
|
|
|
value or_eq b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: 'or_eq' is an alternative token spelling, consider using a traditional token '|=' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: value |= b;
|
|
|
|
value = a not_eq b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: 'not_eq' is an alternative token spelling, consider using a traditional token '!=' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: value = a != b;
|
|
|
|
value xor_eq a;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: 'xor_eq' is an alternative token spelling, consider using a traditional token '^=' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: value ^= a;
|
|
}
|
|
|
|
struct Class {
|
|
bool operator!() const;
|
|
Class operator~() const;
|
|
bool operator&&(const Class&) const;
|
|
Class operator&(const Class&) const;
|
|
bool operator||(const Class&) const;
|
|
Class operator|(const Class&) const;
|
|
Class operator^(const Class&) const;
|
|
Class& operator&=(const Class&) const;
|
|
Class& operator|=(const Class&) const;
|
|
Class& operator^=(const Class&) const;
|
|
bool operator!=(const Class&) const;
|
|
};
|
|
|
|
void testAllTokensToAlternative(Class a, Class b) {
|
|
int value = 0;
|
|
Class clval;
|
|
|
|
value = a or b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: 'or' is an alternative token spelling, consider using a traditional token '||' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: value = a || b;
|
|
|
|
value = a and b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: 'and' is an alternative token spelling, consider using a traditional token '&&' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: value = a && b;
|
|
|
|
clval = a bitor b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: 'bitor' is an alternative token spelling, consider using a traditional token '|' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: clval = a | b;
|
|
|
|
clval = a bitand b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: 'bitand' is an alternative token spelling, consider using a traditional token '&' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: clval = a & b;
|
|
|
|
value = not a;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: 'not' is an alternative token spelling, consider using a traditional token '!' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: value = ! a;
|
|
|
|
clval = a xor b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: 'xor' is an alternative token spelling, consider using a traditional token '^' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: clval = a ^ b;
|
|
|
|
clval = compl b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: 'compl' is an alternative token spelling, consider using a traditional token '~' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: clval = ~ b;
|
|
|
|
clval and_eq b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: 'and_eq' is an alternative token spelling, consider using a traditional token '&=' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: clval &= b;
|
|
|
|
clval or_eq b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: 'or_eq' is an alternative token spelling, consider using a traditional token '|=' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: clval |= b;
|
|
|
|
value = a not_eq b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: 'not_eq' is an alternative token spelling, consider using a traditional token '!=' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: value = a != b;
|
|
|
|
clval xor_eq a;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: 'xor_eq' is an alternative token spelling, consider using a traditional token '^=' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: clval ^= a;
|
|
}
|
|
|
|
struct ClassO {};
|
|
|
|
ClassO& operator&=(ClassO&, const ClassO&);
|
|
ClassO& operator|=(ClassO&, const ClassO&);
|
|
ClassO& operator^=(ClassO&, const ClassO&);
|
|
bool operator!=(const ClassO&, const ClassO&);
|
|
bool operator&&(const ClassO&, const ClassO&);
|
|
bool operator||(const ClassO&, const ClassO&);
|
|
bool operator!(const ClassO&);
|
|
ClassO operator&(const ClassO&, const ClassO&);
|
|
ClassO operator|(const ClassO&, const ClassO&);
|
|
ClassO operator^(const ClassO&, const ClassO&);
|
|
ClassO operator~(const ClassO&);
|
|
|
|
void testAllTokensToAlternative(ClassO a, ClassO b) {
|
|
int value = 0;
|
|
ClassO clval;
|
|
|
|
value = a or b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: 'or' is an alternative token spelling, consider using a traditional token '||' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: value = a || b;
|
|
|
|
value = a and b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: 'and' is an alternative token spelling, consider using a traditional token '&&' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: value = a && b;
|
|
|
|
clval = a bitor b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: 'bitor' is an alternative token spelling, consider using a traditional token '|' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: clval = a | b;
|
|
|
|
clval = a bitand b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: 'bitand' is an alternative token spelling, consider using a traditional token '&' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: clval = a & b;
|
|
|
|
value = not a;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: 'not' is an alternative token spelling, consider using a traditional token '!' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: value = ! a;
|
|
|
|
clval = a xor b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: 'xor' is an alternative token spelling, consider using a traditional token '^' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: clval = a ^ b;
|
|
|
|
clval = compl b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: 'compl' is an alternative token spelling, consider using a traditional token '~' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: clval = ~ b;
|
|
|
|
clval and_eq b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: 'and_eq' is an alternative token spelling, consider using a traditional token '&=' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: clval &= b;
|
|
|
|
clval or_eq b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: 'or_eq' is an alternative token spelling, consider using a traditional token '|=' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: clval |= b;
|
|
|
|
value = a not_eq b;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: 'not_eq' is an alternative token spelling, consider using a traditional token '!=' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: value = a != b;
|
|
|
|
clval xor_eq a;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: 'xor_eq' is an alternative token spelling, consider using a traditional token '^=' for consistency [readability-operators-representation]
|
|
// CHECK-FIXES: clval ^= a;
|
|
}
|