This is an archive of the discontinued LLVM Phabricator instance.

[clang] NFC: Remove forced type merging in multiversion function checks.
ClosedPublic

Authored by tahonermann on Mar 17 2022, 2:26 PM.

Details

Summary

Checking of multiversion function declarations performed by various functions
in clang/lib/Sema/SemaDecl.cpp previously forced the valus of a passed in
'MergeTypeWithPrevious' reference argument in several scenarios. This was
unnecessary and possibly incorrect in the one case that the value
was forced to 'true' (though seemingly unobservably so).

Diff Detail

Event Timeline

tahonermann created this revision.Mar 17 2022, 2:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 17 2022, 2:26 PM
tahonermann published this revision for review.Mar 17 2022, 2:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 17 2022, 2:47 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

You should fix the clang-format issues (I leave @erichkeane to sign off on this one, but it looks reasonable to me).

Hmm... my understanding is "MergeTypeWithPrevious" is important for cases where we decide that this is a redeclaration, right? We need to set it to 'false' when we "know" that this is a different declaration, right? So at least the '=false' was correct?

Hmm... my understanding is "MergeTypeWithPrevious" is important for cases where we decide that this is a redeclaration, right? We need to set it to 'false' when we "know" that this is a different declaration, right? So at least the '=false' was correct?

As best as I can tell, MergeTypeWithPrevious is only true when 1) compiling as C, 2) the previous declaration (if any) is not shadowed, and 3) there is no visible previous declaration and there is a conflicting non-visible declaration. When already set to true, setting it to false would likely defeat some later diagnostics.

I spent a while trying to intuit a test that demonstrated different behavior before and after this change and wasn't able to identify one.

erichkeane accepted this revision.Mar 18 2022, 1:10 PM

Ok then, I seem to then just not understand its purpose, but you seem to understand it well enough. I'm ok with this patch now (after the format fixes!).

This revision is now accepted and ready to land.Mar 18 2022, 1:10 PM

Updates to address clang-format complaints.

Fix bad merge conflict resolution that I failed to even test compiling.

erichkeane accepted this revision.Mar 21 2022, 6:05 AM

Still OK to me.