This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Fix bugs in annotating r_paren as C-style cast
ClosedPublic

Authored by owenpan on Jun 26 2023, 12:53 AM.

Details

Summary

Don't annotate r_paren as TT_CastRParen if it's followed by an amp/star and either the line is in a macro definition or a numeric_constant follows the amp/star.

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

Diff Detail

Event Timeline

owenpan created this revision.Jun 26 2023, 12:53 AM
Herald added projects: Restricted Project, Restricted Project, Restricted Project. · View Herald TranscriptJun 26 2023, 12:53 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
owenpan requested review of this revision.Jun 26 2023, 12:53 AM
owenpan edited the summary of this revision. (Show Details)Jun 26 2023, 1:03 AM
MyDeveloperDay accepted this revision.Jun 26 2023, 1:42 AM
This revision is now accepted and ready to land.Jun 26 2023, 1:42 AM
rymiel accepted this revision.Jun 26 2023, 2:25 AM

It appears other operators aren't affected, after D153641 I would have not been surprised if && had become unary :)

It appears other operators aren't affected, after D153641 I would have not been surprised if && had become unary :)

&& doesn't become unary because of isUnaryOperator on line 2432 in the annotator.