ClockMan created this revision. Herald added subscribers: carlosgalvezp, kbarton, xazax.hun, nemanjai. Herald added a reviewer: njames93. Herald added a project: All. ClockMan updated this revision to Diff 492167. ClockMan added a comment. ClockMan updated this revision to Diff 492169. Eugene.Zelenko added reviewers: aaron.ballman, LegalizeAdulthood, carlosgalvezp, gribozavr2. ClockMan published this revision for review. Herald added a project: clang-tools-extra. Herald added a subscriber: cfe-commits.
Corrected -std= in simd-intrinsics-ppc test ClockMan added a comment. Used same -check-suffix= in x86 and ppc tests ClockMan added a comment. Ready for review. When portability-simd-intrinsics.Suggest were set to false, produced warning were missing source location, and due to that such warning coudn't be NOLINTed. Added missing tests. Fixes issues: https://github.com/llvm/llvm-project/issues/52831 Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D142565 Files: clang-tools-extra/clang-tidy/portability/SIMDIntrinsicsCheck.cpp clang-tools-extra/test/clang-tidy/checkers/portability/simd-intrinsics-ppc.cpp clang-tools-extra/test/clang-tidy/checkers/portability/simd-intrinsics-x86.cpp Index: clang-tools-extra/test/clang-tidy/checkers/portability/simd-intrinsics-x86.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/portability/simd-intrinsics-x86.cpp +++ clang-tools-extra/test/clang-tidy/checkers/portability/simd-intrinsics-x86.cpp @@ -1,4 +1,8 @@ -// RUN: %check_clang_tidy -std=c++11,c++14,c++17 %s portability-simd-intrinsics %t -- \ +// RUN: %check_clang_tidy -std=c++11-or-later %s portability-simd-intrinsics %t -- \ +// RUN: -config='{CheckOptions: [ \ +// RUN: {key: portability-simd-intrinsics.Suggest, value: false} \ +// RUN: ]}' -- -target x86_64 +// RUN: %check_clang_tidy -std=c++11,c++14,c++17 %s portability-simd-intrinsics -check-suffix=BEFORE-CXX20 %t -- \ // RUN: -config='{CheckOptions: [ \ // RUN: {key: portability-simd-intrinsics.Suggest, value: true} \ // RUN: ]}' -- -target x86_64 @@ -21,8 +25,9 @@ __m256 d0; _mm_add_epi32(i0, i1); - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: '_mm_add_epi32' can be replaced by operator+ on std::experimental::simd objects [portability-simd-intrinsics] + // CHECK-MESSAGES-BEFORE-CXX20: :[[@LINE-1]]:3: warning: '_mm_add_epi32' can be replaced by operator+ on std::experimental::simd objects [portability-simd-intrinsics] // CHECK-MESSAGES-CXX20: :[[@LINE-2]]:3: warning: '_mm_add_epi32' can be replaced by operator+ on std::simd objects [portability-simd-intrinsics] + // CHECK-MESSAGES: :[[@LINE-3]]:3: warning: '_mm_add_epi32' is a non-portable x86_64 intrinsic function [portability-simd-intrinsics] d0 = _mm256_load_pd(0); _mm256_store_pd(0, d0); Index: clang-tools-extra/test/clang-tidy/checkers/portability/simd-intrinsics-ppc.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/portability/simd-intrinsics-ppc.cpp +++ clang-tools-extra/test/clang-tidy/checkers/portability/simd-intrinsics-ppc.cpp @@ -1,4 +1,8 @@ -// RUN: %check_clang_tidy -std=c++11,c++14,c++17 %s portability-simd-intrinsics %t -- \ +// RUN: %check_clang_tidy -std=c++11-or-later %s portability-simd-intrinsics %t -- \ +// RUN: -config='{CheckOptions: [ \ +// RUN: {key: portability-simd-intrinsics.Suggest, value: false} \ +// RUN: ]}' -- -target ppc64le -maltivec +// RUN: %check_clang_tidy -std=c++11,c++14,c++17 %s portability-simd-intrinsics -check-suffix=BEFORE-CXX20 %t -- \ // RUN: -config='{CheckOptions: [ \ // RUN: {key: portability-simd-intrinsics.Suggest, value: true} \ // RUN: ]}' -- -target ppc64le -maltivec @@ -13,6 +17,7 @@ vector int i0, i1; vec_add(i0, i1); - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'vec_add' can be replaced by operator+ on std::experimental::simd objects [portability-simd-intrinsics] + // CHECK-MESSAGES-BEFORE-CXX20: :[[@LINE-1]]:3: warning: 'vec_add' can be replaced by operator+ on std::experimental::simd objects [portability-simd-intrinsics] // CHECK-MESSAGES-CXX20: :[[@LINE-2]]:3: warning: 'vec_add' can be replaced by operator+ on std::simd objects [portability-simd-intrinsics] + // CHECK-MESSAGES: :[[@LINE-3]]:3: warning: 'vec_add' is a non-portable powerpc64le intrinsic function [portability-simd-intrinsics] } Index: clang-tools-extra/clang-tidy/portability/SIMDIntrinsicsCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/portability/SIMDIntrinsicsCheck.cpp +++ clang-tools-extra/clang-tidy/portability/SIMDIntrinsicsCheck.cpp @@ -138,7 +138,7 @@ << SimdRegex.sub(SmallString<32>({Std, "::simd"}), StdRegex.sub(Std, New)); } else { - diag("'%0' is a non-portable %1 intrinsic function") + diag(Call->getExprLoc(), "'%0' is a non-portable %1 intrinsic function") << Old << llvm::Triple::getArchTypeName(Arch); } }
Index: clang-tools-extra/test/clang-tidy/checkers/portability/simd-intrinsics-x86.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/portability/simd-intrinsics-x86.cpp +++ clang-tools-extra/test/clang-tidy/checkers/portability/simd-intrinsics-x86.cpp @@ -1,4 +1,8 @@ -// RUN: %check_clang_tidy -std=c++11,c++14,c++17 %s portability-simd-intrinsics %t -- \ +// RUN: %check_clang_tidy -std=c++11-or-later %s portability-simd-intrinsics %t -- \ +// RUN: -config='{CheckOptions: [ \ +// RUN: {key: portability-simd-intrinsics.Suggest, value: false} \ +// RUN: ]}' -- -target x86_64 +// RUN: %check_clang_tidy -std=c++11,c++14,c++17 %s portability-simd-intrinsics -check-suffix=BEFORE-CXX20 %t -- \ // RUN: -config='{CheckOptions: [ \ // RUN: {key: portability-simd-intrinsics.Suggest, value: true} \ // RUN: ]}' -- -target x86_64 @@ -21,8 +25,9 @@ __m256 d0; _mm_add_epi32(i0, i1); - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: '_mm_add_epi32' can be replaced by operator+ on std::experimental::simd objects [portability-simd-intrinsics] + // CHECK-MESSAGES-BEFORE-CXX20: :[[@LINE-1]]:3: warning: '_mm_add_epi32' can be replaced by operator+ on std::experimental::simd objects [portability-simd-intrinsics] // CHECK-MESSAGES-CXX20: :[[@LINE-2]]:3: warning: '_mm_add_epi32' can be replaced by operator+ on std::simd objects [portability-simd-intrinsics] + // CHECK-MESSAGES: :[[@LINE-3]]:3: warning: '_mm_add_epi32' is a non-portable x86_64 intrinsic function [portability-simd-intrinsics] d0 = _mm256_load_pd(0); _mm256_store_pd(0, d0); Index: clang-tools-extra/test/clang-tidy/checkers/portability/simd-intrinsics-ppc.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/portability/simd-intrinsics-ppc.cpp +++ clang-tools-extra/test/clang-tidy/checkers/portability/simd-intrinsics-ppc.cpp @@ -1,4 +1,8 @@ -// RUN: %check_clang_tidy -std=c++11,c++14,c++17 %s portability-simd-intrinsics %t -- \ +// RUN: %check_clang_tidy -std=c++11-or-later %s portability-simd-intrinsics %t -- \ +// RUN: -config='{CheckOptions: [ \ +// RUN: {key: portability-simd-intrinsics.Suggest, value: false} \ +// RUN: ]}' -- -target ppc64le -maltivec +// RUN: %check_clang_tidy -std=c++11,c++14,c++17 %s portability-simd-intrinsics -check-suffix=BEFORE-CXX20 %t -- \ // RUN: -config='{CheckOptions: [ \ // RUN: {key: portability-simd-intrinsics.Suggest, value: true} \ // RUN: ]}' -- -target ppc64le -maltivec @@ -13,6 +17,7 @@ vector int i0, i1; vec_add(i0, i1); - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'vec_add' can be replaced by operator+ on std::experimental::simd objects [portability-simd-intrinsics] + // CHECK-MESSAGES-BEFORE-CXX20: :[[@LINE-1]]:3: warning: 'vec_add' can be replaced by operator+ on std::experimental::simd objects [portability-simd-intrinsics] // CHECK-MESSAGES-CXX20: :[[@LINE-2]]:3: warning: 'vec_add' can be replaced by operator+ on std::simd objects [portability-simd-intrinsics] + // CHECK-MESSAGES: :[[@LINE-3]]:3: warning: 'vec_add' is a non-portable powerpc64le intrinsic function [portability-simd-intrinsics] } Index: clang-tools-extra/clang-tidy/portability/SIMDIntrinsicsCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/portability/SIMDIntrinsicsCheck.cpp +++ clang-tools-extra/clang-tidy/portability/SIMDIntrinsicsCheck.cpp @@ -138,7 +138,7 @@ << SimdRegex.sub(SmallString<32>({Std, "::simd"}), StdRegex.sub(Std, New)); } else { - diag("'%0' is a non-portable %1 intrinsic function") + diag(Call->getExprLoc(), "'%0' is a non-portable %1 intrinsic function") << Old << llvm::Triple::getArchTypeName(Arch); } }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits