Author: Shivam Gupta Date: 2023-01-24T11:56:06+05:30 New Revision: 40003af98456607f9b6bd1910424c5243eeb5d01
URL: https://github.com/llvm/llvm-project/commit/40003af98456607f9b6bd1910424c5243eeb5d01 DIFF: https://github.com/llvm/llvm-project/commit/40003af98456607f9b6bd1910424c5243eeb5d01.diff LOG: [Clang][NFC] Remove a redundancy check in Sema::adjustMemberFunctionCC If the current calling convection CurCC is not equal to Target calling convection ToCC and current calling convention (CurCC) is equal to the default calling convention (DefaultCC), that means DefaultCC can not be equal to ToCC so the right part of the expression DefaultCC == ToCC is not needed. revelant code - if (CurCC == ToCC) return; if (CurCC != DefaultCC || DefaultCC == ToCC) return; Found by PVS-Studio - https://pvs-studio.com/en/blog/posts/cpp/1003/, N41. Differential Revision: https://reviews.llvm.org/D142338 Added: Modified: clang/lib/Sema/SemaType.cpp Removed: ################################################################################ diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 16986f6f0d0e5..89d819a77dcbb 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -7963,7 +7963,7 @@ void Sema::adjustMemberFunctionCC(QualType &T, bool IsStatic, bool IsCtorOrDtor, CallingConv DefaultCC = Context.getDefaultCallingConvention(IsVariadic, IsStatic); - if (CurCC != DefaultCC || DefaultCC == ToCC) + if (CurCC != DefaultCC) return; if (hasExplicitCallingConv(T)) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits