[PATCH] D142338: [Clang][NFC] Remove a redundancy check in Sema::adjustMemberFunctionCC

Shivam Gupta via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 23 02:22:57 PST 2023


xgupta created this revision.
Herald added a project: All.
xgupta requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142338

Files:
  clang/lib/Sema/SemaType.cpp


Index: clang/lib/Sema/SemaType.cpp
===================================================================
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -7960,7 +7960,7 @@
     CallingConv DefaultCC =
         Context.getDefaultCallingConvention(IsVariadic, IsStatic);
 
-    if (CurCC != DefaultCC || DefaultCC == ToCC)
+    if (CurCC != DefaultCC)
       return;
 
     if (hasExplicitCallingConv(T))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142338.491268.patch
Type: text/x-patch
Size: 420 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230123/37d47671/attachment.bin>


More information about the cfe-commits mailing list