This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Correctly annotate star/amp in function pointer params
ClosedPublic

Authored by rymiel on Oct 11 2022, 12:23 PM.

Details

Summary

Inside the arguments part of a function pointer declaration,
determineStarAmpUsage results in a binary operator rather than
pointers, because said parens are assumed to be an expression.

This patch correctly marks the argument parens of a function
pointer type as not an expression. Note that this fix already
existed for Objective-C blocks as part of rGf1f267b447f60528440d2c066b29ab014ae7f90f.
As Objective-C blocks and C/C++ function pointers share a lot
of the same logic, that fix also makes sense here.

Fixes https://github.com/llvm/llvm-project/issues/31659

Diff Detail

Event Timeline

rymiel created this revision.Oct 11 2022, 12:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 11 2022, 12:23 PM
rymiel requested review of this revision.Oct 11 2022, 12:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 11 2022, 12:23 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
rymiel added a project: Restricted Project.Oct 11 2022, 12:24 PM
rymiel edited the summary of this revision. (Show Details)Oct 11 2022, 3:29 PM
This revision is now accepted and ready to land.Oct 11 2022, 10:55 PM
owenpan accepted this revision.Oct 14 2022, 1:30 AM

Thanks @rymiel its great to have another active contributor, especially one who seems so focused on github issues. Really appreciate your recent contributions. Can we start including you as one of the default reviewers that we use to review our stuff?

Thanks for the kind words ❤️ (I've noticed Björn already includes me in his reviewers list); and while I am humbled, and I do look at every patch, I don't *yet* trust myself to actually perform good code review, as it's not something I've really ever done before.

Thanks for the kind words ❤️ (I've noticed Björn already includes me in his reviewers list); and while I am humbled, and I do look at every patch, I don't *yet* trust myself to actually perform good code review, as it's not something I've really ever done before.

It's actually easy. Just give it a thumbs up if everything is good, as far as you can see.

Thanks @rymiel its great to have another active contributor, especially one who seems so focused on github issues. Really appreciate your recent contributions. Can we start including you as one of the default reviewers that we use to review our stuff?

+1.

I don't *yet* trust myself to actually perform good code review, as it's not something I've really ever done before.

IMO none of us can claim to be an expert in every area of clang-format. :) Even if you don't feel that you are an "expert" yet, you are still encouraged to review code. See here for the rationale.

I learn a lot from watching the others code review. Definitely not an expert here either, just try to help where I can.

This revision was landed with ongoing or failed builds.Oct 17 2022, 10:17 PM
This revision was automatically updated to reflect the committed changes.