Bug 183302 - Add clang-format configuration
Summary: Add clang-format configuration
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Don Olmstead
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-03-02 13:51 PST by Don Olmstead
Modified: 2021-12-23 16:41 PST (History)
9 users (show)

See Also:


Attachments
Patch (3.76 KB, patch)
2018-03-02 13:52 PST, Don Olmstead
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Don Olmstead 2018-03-02 13:51:08 PST
Clang format has a WebKit style available which seems to be mostly correct. I'm proposing we add a root .clang-format so it can be integrated into a developer's workflow.

Any bugs we encounter we should open up issues on the LLVM tools repo until we're at a point where its a 100% correct.
Comment 1 Don Olmstead 2018-03-02 13:52:02 PST
Created attachment 334924 [details]
Patch
Comment 2 Don Olmstead 2018-03-02 13:53:44 PST
Comment on attachment 334924 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=334924&action=review

This file was created by running the following

clang-format --dump-config -style=WebKit > .clang-format

> .clang-format:68
> +IncludeCategories:
> +  - Regex:           '^"config\.h"'
> +    Priority:        -1
> +  # The main header for a source file automatically gets category 0
> +  - Regex:           '.*'
> +    Priority:        1
> +  - Regex:           '^<.*\.h>'
> +    Priority:        2

This is the only part modified from the stock WebKit configuration. If its not present then clang-format won't keep "config.h" configs at the top.
Comment 3 Ryosuke Niwa 2018-03-02 14:05:40 PST
Comment on attachment 334924 [details]
Patch

rs=me
Comment 4 WebKit Commit Bot 2018-03-02 14:13:16 PST
Comment on attachment 334924 [details]
Patch

Clearing flags on attachment: 334924

Committed r229189: <https://trac.webkit.org/changeset/229189>
Comment 5 WebKit Commit Bot 2018-03-02 14:13:17 PST
All reviewed patches have been landed.  Closing bug.
Comment 6 Radar WebKit Bug Importer 2018-03-02 14:14:23 PST
<rdar://problem/38081690>