This is an archive of the discontinued LLVM Phabricator instance.

[doc] Fix regex in ClangFormatStyleOptions for IncludeCategories
ClosedPublic

Authored by jhuels on Dec 16 2021, 3:26 PM.

Details

Summary

This fixes the regex in ClangFormatStyleOptions for IncludeCategories to match anything starting with < or starting with | AND followed by (gtest|gmock|isl|json) then /.

Diff Detail

Event Timeline

jhuels requested review of this revision.Dec 16 2021, 3:26 PM
jhuels created this revision.
MyDeveloperDay edited reviewers, added: MyDeveloperDay, curdeius, owenpan, HazardyKnusperkeks; removed: Restricted Project.Dec 16 2021, 11:12 PM
MyDeveloperDay added projects: Restricted Project, Restricted Project.
curdeius accepted this revision.Dec 17 2021, 12:14 AM

LGTM, but just to be clear: current regex matches everything starting with < or starting with " and followed by gtest|gmock|isl|json and followed by /. Please update the description when landing.

This revision is now accepted and ready to land.Dec 17 2021, 12:14 AM
curdeius retitled this revision from Fix regex in ClangFormatStyleOptions for IncludeCategories to [doc] Fix regex in ClangFormatStyleOptions for IncludeCategories.Dec 17 2021, 12:14 AM

is the / before the /) at the end correct ?


vs

is the / before the /) at the end correct ?

Yes, the regex tester you used needs escaping the slash as it uses sed-like expressions. But clang-format doesn't need escaping it.

just to be clear: current regex matches everything starting with < or starting with " and followed by gtest|gmock|isl|json and followed by /.

Sorry, when I mean "current", I meant the current main branch. The main branch matches everything starting with < or " (which is everything).

My patch matches everything starting with < or " and followed by gtest|gmock|isl|json and followed by /.

jhuels edited the summary of this revision. (Show Details)Dec 17 2021, 9:29 AM

just to be clear: current regex matches everything starting with < or starting with " and followed by gtest|gmock|isl|json and followed by /.

Sorry, when I mean "current", I meant the current main branch. The main branch matches everything starting with < or " (which is everything).

My patch matches everything starting with < or " and followed by gtest|gmock|isl|json and followed by /.

I did understand it this way. I just wanted to underline that, before this patch, it matched:

  • < followed by anything,

or

  • " followed by (gtest|gmock|isl|json)/

So it didn't match just " with whatever after.
Anyway, just nitpicking.
Your patch is good. Thanks!

Can you commit for me, please? No push privs.

So it didn't match just " with whatever after.

Ahh yes, you're right.

HazardyKnusperkeks requested changes to this revision.Dec 17 2021, 12:40 PM

The change has to be done in the Format.h and then run dump_format_style.py, not directly in the rst.

Also please provide the context in the diff.

This revision now requires changes to proceed.Dec 17 2021, 12:40 PM
jhuels updated this revision to Diff 395202.Dec 17 2021, 12:57 PM

Fixed the doc in the actual source, added context to diff.

Sorry, I'm not sure why I'm getting "Context not available." I'm just copying raw output from git diff --staged

jhuels updated this revision to Diff 395205.Dec 17 2021, 1:00 PM

Add context for real

Got it, sorry for spam. Need git diff --staged -U999999.

Got it, sorry for spam. Need git diff --staged -U999999.

No problem.

This revision is now accepted and ready to land.Dec 17 2021, 1:36 PM
owenpan added inline comments.Dec 17 2021, 1:41 PM
clang/docs/ClangFormatStyleOptions.rst
3239

Why is there a trailing whitespace? Did you run dump_format_style.py to generate this file?

jhuels added inline comments.Dec 17 2021, 3:42 PM
clang/docs/ClangFormatStyleOptions.rst
3239

Yeah, I ran dump_format_style.py and didn't touch anything in the generated output. Someone must have added it on accident.

Can someone with privileges push/merge this?

owenpan accepted this revision.Dec 17 2021, 5:24 PM

Can someone with privileges push/merge this?

What are the name and email address you want use for the author of the patch? See here.

Joshua Huels <jhuels20@gmail.com>

This revision was landed with ongoing or failed builds.Dec 17 2021, 6:47 PM
This revision was automatically updated to reflect the committed changes.