Closed Bug 1317305 Opened 4 years ago Closed 4 years ago

Update clang format rules

Categories

(Firefox Build System :: Source Code Analysis, defect)

defect
Not set
normal

Tracking

(firefox53 fixed)

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: Sylvestre, Assigned: Sylvestre)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

No description provided.
Comment on attachment 8810380 [details]
Bug 1317305 - Update clang format rules

https://reviewboard.mozilla.org/r/92734/#review92720

I didn't check to make sure that you weren't missing any MacroBlockBegin macros which I have used (because I can't do that very well off of the top of my head).

::: .clang-format:10
(Diff revision 1)
> +
> +# Force pointers to the type for C++.
> +DerivePointerAlignment: false
> +PointerAlignment: Left
> +
> +# Prevent the lost of indentation with these macros

the loss of indentation

::: .clang-format:11
(Diff revision 1)
> +# Force pointers to the type for C++.
> +DerivePointerAlignment: false
> +PointerAlignment: Left
> +
> +# Prevent the lost of indentation with these macros
> +MacroBlockBegin: "^(NS_INTERFACE_MAP_BEGIN|NS_INTERFACE_TABLE_HEAD|NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION|NS_IMPL_CYCLE_COLLECTION_.*_BEGIN|NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED|NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED|NS_INTERFACE_TABLE_BEGIN|NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED|NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED)$"

Is there any way we could lay this out nicer in this file? I'm not sure what file formats are supported but it would be neat if it could have one macro per line, like:

    NS_INTERFACE_MAP_BEGIN |
    NS_INTERFACE_TABLE_HEAD |
    NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION |
    ...
Attachment #8810380 - Flags: review?(michael) → review+
Comment on attachment 8810380 [details]
Bug 1317305 - Update clang format rules

https://reviewboard.mozilla.org/r/92734/#review92720

> Is there any way we could lay this out nicer in this file? I'm not sure what file formats are supported but it would be neat if it could have one macro per line, like:
> 
>     NS_INTERFACE_MAP_BEGIN |
>     NS_INTERFACE_TABLE_HEAD |
>     NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION |
>     ...

Great idea, I found the syntax in this bug https://llvm.org/bugs/show_bug.cgi?id=30656
and it is indeed much better!
Pushed by sledru@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c4917d6cf776
Update clang format rules r=mystor
https://hg.mozilla.org/mozilla-central/rev/c4917d6cf776
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.