Skip to content

Commit

Permalink
[Clang][NFC] Remove a redundancy check in Sema::adjustMemberFunctionCC
Browse files Browse the repository at this point in the history
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
  • Loading branch information
xgupta committed Jan 24, 2023
1 parent 0f5099c commit 40003af
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaType.cpp
Expand Up @@ -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))
Expand Down

0 comments on commit 40003af

Please sign in to comment.