This is an archive of the discontinued LLVM Phabricator instance.

[NFC][Clang] Remove redundant function definitions
ClosedPublic

Authored by jmmartinez on Aug 31 2023, 1:12 AM.

Details

Summary

There were 3 definitions of the mergeDefaultFunctionDefinitionAttributes
function: A private implementation, a version exposed in CodeGen, a
version exposed in CodeGenModule.

This patch removes the private and the CodeGenModule versions and keeps
a single definition in CodeGen.

Diff Detail

Event Timeline

jmmartinez created this revision.Aug 31 2023, 1:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 31 2023, 1:12 AM
jmmartinez requested review of this revision.Aug 31 2023, 1:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 31 2023, 1:12 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

@jhuber6 I was wondering if there is a reason you kept 3 versions of mergeDefaultFunctionDefinitionAttributes in https://reviews.llvm.org/D152391 ?

@jhuber6 I was wondering if there is a reason you kept 3 versions of mergeDefaultFunctionDefinitionAttributes in https://reviews.llvm.org/D152391 ?

I believe it's because one was a freestanding function, the other was a member function, and the last was a common implementation.

@jhuber6 I was wondering if there is a reason you kept 3 versions of mergeDefaultFunctionDefinitionAttributes in https://reviews.llvm.org/D152391 ?

I believe it's because one was a freestanding function, the other was a member function, and the last was a common implementation.

Would it be ok if I keep only one? It seems that the member function is not used (I was not sure if there was some external code using it).

If not, I can also keep just 2 versions (the freestanding function and the member function), move the implementation to the freestanding one, and drop the static function since it is redundant.

jhuber6 accepted this revision.Aug 31 2023, 5:12 AM

@jhuber6 I was wondering if there is a reason you kept 3 versions of mergeDefaultFunctionDefinitionAttributes in https://reviews.llvm.org/D152391 ?

I believe it's because one was a freestanding function, the other was a member function, and the last was a common implementation.

Would it be ok if I keep only one? It seems that the member function is not used (I was not sure if there was some external code using it).

If not, I can also keep just 2 versions (the freestanding function and the member function), move the implementation to the freestanding one, and drop the static function since it is redundant.

Yeah I think I noticed that when I was doing the patch but I just left it because I figured it would be less disruptive. It should be fine since I'm not aware of any other users.

This revision is now accepted and ready to land.Aug 31 2023, 5:12 AM
This revision was landed with ongoing or failed builds.Aug 31 2023, 5:48 AM
This revision was automatically updated to reflect the committed changes.

Thanks for the review!