This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by xgupta on Jan 23 2023, 2:22 AM.

Details

Summary

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.

Diff Detail

Event Timeline

xgupta created this revision.Jan 23 2023, 2:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 23 2023, 2:22 AM
xgupta requested review of this revision.Jan 23 2023, 2:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 23 2023, 2:22 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

LGTM, assuming the pre-commit CI failures are unrelated.

LGTM, assuming the pre-commit CI failures are unrelated.

Yeah, those 3 test cases should be unrelated, this is an nfc change.

This revision was not accepted when it landed; it landed in state Needs Review.Jan 23 2023, 10:26 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.