Commit Graph

11 Commits

Author SHA1 Message Date
Mike Klein
d6ab77a2e2 restore .clang-format
Cq-Include-Trybots: skia.primary:Housekeeper-PerCommit-CheckGeneratedFiles
Change-Id: I93f928c35b2369c9e496d4e887e8500970bea2ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202359
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-03-21 15:52:32 +00:00
Mike Klein
a2a5cc0a3c regen from .fp files after .clang-format change
and SortUsingDeclarations is too new to use

Cq-Include-Trybots: skia.primary:Housekeeper-PerCommit-CheckGeneratedFiles
Change-Id: Id785aa76c58ff354cdb820f1c74b8b2be399c341
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202115
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-03-19 17:29:12 +00:00
Mike Klein
e8bc1935a0 tweak .clang-format
I just spent a bunch of time manually formatting SkScan_AAAPath.cpp so
that I could read it, a bunch of really frustrating time.  So I decided
to see how clang-format would do, and with a couple of tweaks I think
I'm happy to let the tool take the wheel.  It actually fixed up a few
places I missed.

Most controversial stuff is proably parameter/argument packing?  I find
packing these makes it hard to distinguish which and even how many
arguments you're passing to a function... it all becomes a bit of a sea
of letters and you need to hunt for commas.  This way you always see
them distinctly, and if things start to look ridiculously tall, it's
probably because the _function_ is ridiculous.

I'd have even gone as far to set AllowAllArgumentsOnNextLine: false, but
it doesn't exist yet.

Change-Id: I504dedb50f99d0d935d59e252d30f59eca451a0c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202000
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-03-19 15:25:22 +00:00
Brian Salomon
02cb969e13 .clang-format: Don't force break after > in template declarations
Change-Id: I3c8997cb475a54ffa465175dc8250021bf769f80
Reviewed-on: https://skia-review.googlesource.com/c/179734
Auto-Submit: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-12-21 14:20:57 +00:00
Mike Klein
12956725cc clean up flattenable macro cruft
I'm finding it easier to reason about the code without most of these
macros, but SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY still looks useful.

Adding flattenable:: to CreateProc helps enforce that we pass the
correct type name.  The name is not currently used, but I'd like to.

Change-Id: I87c77eb6020fb3ae4696d8f73d09de62fd814875
Reviewed-on: https://skia-review.googlesource.com/c/163840
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-10-19 16:18:32 +00:00
Brian Salomon
2183142fea Update .clang-format to handle Objective-C files
Change-Id: I8686681ee9b96f0447f03a26e5568964ec5be6d9
Reviewed-on: https://skia-review.googlesource.com/144121
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-07-27 21:33:30 +00:00
Mike Klein
8f45138eef Revert "Update clang-format matching more of Chromium"
This reverts commit 4fa5824fa2.

Reason for revert:

This is an area of Chromium's style guide that is actively error-prone, and I don't want anyone writing Skia code to think it's desirable.  `goto fail`, etc.

If we cannot automatically add braces, it is less error prone to keep these short statements on the same line as the condition.

On the other hand, I believe clang-tidy can automate adding braces (readability-braces-around-statements).  If we get that working I don't think it matters where the blocks go.

Original change's description:
> Update clang-format matching more of Chromium
> 
> This CL does one thing: disallow short if/loop becoming a single
> line.
> 
> Skia style guide prefers to always have braces. Though always
> have braces isn't achievable by clang-format, always breaking into
> multiple lines can be set.
> 
> 
> 
> 
> Bug: skia:
> Change-Id: I70b504dea01b4c916901ea2247ac0e052d468051
> Reviewed-on: https://skia-review.googlesource.com/128688
> Commit-Queue: Weiliang Chen <weiliangc@chromium.org>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,weiliangc@chromium.org

Change-Id: I264e0a38934aaf8059f503a64e204fd66da54769
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/129940
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2018-05-24 13:27:25 +00:00
Weiliang Chen
4fa5824fa2 Update clang-format matching more of Chromium
This CL does one thing: disallow short if/loop becoming a single
line.

Skia style guide prefers to always have braces. Though always
have braces isn't achievable by clang-format, always breaking into
multiple lines can be set.




Bug: skia:
Change-Id: I70b504dea01b4c916901ea2247ac0e052d468051
Reviewed-on: https://skia-review.googlesource.com/128688
Commit-Queue: Weiliang Chen <weiliangc@chromium.org>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-05-23 18:04:41 +00:00
Brian Salomon
c083e4f586 Mark flatennable macros as block beginning/ending in .clang-format
Change-Id: I08e907cd5051d9f8cd97cdd773f9ff326cc6a0d8
Reviewed-on: https://skia-review.googlesource.com/6739
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-01-09 15:31:36 +00:00
Brian Salomon
544851b59b Change ConstructorInitializerWidth in .clang-format from 4 to 8
We aren't consistent about this but having it at 4 seems to be causing style churn in code I've been editting recently. Also I prefer something other than 4 so that initalizers don't align with the constructor body.

BUG=skia:

Change-Id: I6ae850c34324e792dfd717f449634abcc7be010b
Reviewed-on: https://skia-review.googlesource.com/6030
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2016-12-14 15:00:48 +00:00
Brian Salomon
b4a24e57c0 Add .clang-format file to include/gpu src/gpu
Change-Id: Ie686f043f4b3a0a2bbd7ab38cf6bab53bb825a79
Reviewed-on: https://skia-review.googlesource.com/5651
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2016-12-08 15:19:15 +00:00