<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>223229</bug_id>
          
          <creation_ts>2021-03-15 17:56:16 -0700</creation_ts>
          <short_desc>clang-format config file generate changes not compatible with expected webkit style.</short_desc>
          <delta_ts>2021-03-24 17:23:53 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Tools / Tests</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jean-Yves Avenard [:jya]">jean-yves.avenard</reporter>
          <assigned_to name="Cameron McCormack (:heycam)">heycam</assigned_to>
          <cc>achristensen</cc>
    
    <cc>ap</cc>
    
    <cc>darin</cc>
    
    <cc>heycam</cc>
    
    <cc>mmaxfield</cc>
    
    <cc>ross.kirsling</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1739773</commentid>
    <comment_count>0</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2021-03-15 17:56:16 -0700</bug_when>
    <thetext>Running clang-tidy will produce a style that is incompatible with what webkit-patch requires.

Examples:
---
    MediaSessionPlaybackState m_playbackState { MediaSessionPlaybackState::None };
becomes:
    MediaSessionPlaybackState m_playbackState{ MediaSessionPlaybackState::None };
---
    template&lt;class Encoder&gt; void encode(Encoder&amp;) const;
becomes:
    template &lt;class Encoder&gt;
    void encode(Encoder&amp;) const;
---
    String src;
    if (!decoder.decode(src))
        return { };
becomes:
    String src;
    if (!decoder.decode(src))
        return {};</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1739774</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-03-15 17:56:36 -0700</bug_when>
    <thetext>&lt;rdar://problem/75456758&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1739948</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2021-03-16 08:36:18 -0700</bug_when>
    <thetext>Is there any way for us to fix this? Or does this bug track the need to file a bug against clang?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1742105</commentid>
    <comment_count>3</comment_count>
    <who name="Cameron McCormack (:heycam)">heycam</who>
    <bug_when>2021-03-21 16:28:10 -0700</bug_when>
    <thetext>Looking at https://clang.llvm.org/docs/ClangFormatStyleOptions.html, we need to set SpaceBeforeCpp11BracedList to true.  And I guess update upstream clang&apos;s WebKit defaults as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1742106</commentid>
    <comment_count>4</comment_count>
      <attachid>423841</attachid>
    <who name="Cameron McCormack (:heycam)">heycam</who>
    <bug_when>2021-03-21 16:39:37 -0700</bug_when>
    <thetext>Created attachment 423841
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1742108</commentid>
    <comment_count>5</comment_count>
    <who name="Cameron McCormack (:heycam)">heycam</who>
    <bug_when>2021-03-21 16:54:12 -0700</bug_when>
    <thetext>Well that patch addresses the first issue but not the latter two.

For the last issue, it&apos;s not clear to me whether Cpp11BracedListStyle = false implies that a space should be inserted into empty braces.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1742109</commentid>
    <comment_count>6</comment_count>
    <who name="Cameron McCormack (:heycam)">heycam</who>
    <bug_when>2021-03-21 17:00:36 -0700</bug_when>
    <thetext>For line breaking after template &lt;...&gt;, I don&apos;t see any rules in https://webkit.org/code-style-guidelines/#line-breaking about it.  The .clang-format option we&apos;re currently setting that governs this is AlwaysBreakTemplateDeclarations = false, which will break if the line is too long or something.

It looks like there&apos;s a real mix in the codebase:

$ rg &apos;template ?&lt;.*&gt;$&apos; | wc -l
    2076
$ rg &apos;template ?&lt;.*&gt; [a-z]&apos; | wc -l
    2899

but tending towards not breaking.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1742111</commentid>
    <comment_count>7</comment_count>
    <who name="Cameron McCormack (:heycam)">heycam</who>
    <bug_when>2021-03-21 17:04:58 -0700</bug_when>
    <thetext>AlwaysBreakTemplateDeclarations = false will take PenaltyBreakTemplateDeclaration into consideration but even if I make that very high, clang-format wants to break there.  So that might be a clang-format problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1742113</commentid>
    <comment_count>8</comment_count>
    <who name="Cameron McCormack (:heycam)">heycam</who>
    <bug_when>2021-03-21 17:37:58 -0700</bug_when>
    <thetext>So AlwaysBreakTemplateDeclarations = false is not a valid value, really, according to https://clang.llvm.org/docs/ClangFormatStyleOptions.html.  It should be No, MultiLine, or Yes.  Choosing No gives different behavior from false.  Because .clang-format contains ColumnLimit = 0, this means that existing line breaking choices will be preserved unless they violate the rules.  If we set AlwaysBreakTemplateDeclarations = No, this will cause

  template &lt;typename T&gt; void f();
  template &lt;typename T&gt;
  void g();

to be unchanged.

But if we change ColumnLimit to something very high, then the result will be:

  template &lt;typename T&gt; void f();
  template &lt;typename T&gt; void g();

Changing ColumnLimit will probably cause a bunch of other undesirable changes, so I suggest we set AlwaysBreakTemplateDeclarations = No, and then at least we can write single line template declarations and not have clang-format change that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1742118</commentid>
    <comment_count>9</comment_count>
      <attachid>423845</attachid>
    <who name="Cameron McCormack (:heycam)">heycam</who>
    <bug_when>2021-03-21 19:31:07 -0700</bug_when>
    <thetext>Created attachment 423845
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1742432</commentid>
    <comment_count>10</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2021-03-22 13:30:04 -0700</bug_when>
    <thetext>The fix for:.

    String src;
    if (!decoder.decode(src))
        return { };

Seems to be missibg</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1742444</commentid>
    <comment_count>11</comment_count>
    <who name="Cameron McCormack (:heycam)">heycam</who>
    <bug_when>2021-03-22 13:36:55 -0700</bug_when>
    <thetext>I don&apos;t know that there&apos;s a solution for that with the current set of .clang-format options.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1742611</commentid>
    <comment_count>12</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2021-03-22 17:44:04 -0700</bug_when>
    <thetext>heycam@apple.com does not have committer permissions according to https://raw.githubusercontent.com/WebKit/WebKit/main/Tools/Scripts/webkitpy/common/config/contributors.json.

Rejecting attachment 423845 from commit queue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1742626</commentid>
    <comment_count>13</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2021-03-22 18:16:52 -0700</bug_when>
    <thetext>commit-queue failed to commit attachment 423845 to WebKit repository. To retry, please set cq+ flag again.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1743007</commentid>
    <comment_count>14</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2021-03-23 14:24:04 -0700</bug_when>
    <thetext>Committed r274901: &lt;https://commits.webkit.org/r274901&gt;

All reviewed patches have been landed. Closing bug and clearing flags on attachment 423845.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1743021</commentid>
    <comment_count>15</comment_count>
      <attachid>423845</attachid>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2021-03-23 14:54:50 -0700</bug_when>
    <thetext>Comment on attachment 423845
Patch

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

&gt; .clang-format:20
&gt; -AlwaysBreakTemplateDeclarations: false
&gt; +AlwaysBreakTemplateDeclarations: No

Are &apos;false&apos; and &apos;No&apos; different? AlwaysBreakBeforeMultilineStrings is false.

&gt; ChangeLog:17
&gt; +        Reviewed by NOBODY (OOPS!).

This should go below the bug URL (with a blank line in between).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1743024</commentid>
    <comment_count>16</comment_count>
    <who name="Cameron McCormack (:heycam)">heycam</who>
    <bug_when>2021-03-23 15:01:49 -0700</bug_when>
    <thetext>(In reply to Simon Fraser (smfr) from comment #15)
&gt; &gt; -AlwaysBreakTemplateDeclarations: false
&gt; &gt; +AlwaysBreakTemplateDeclarations: No
&gt; 
&gt; Are &apos;false&apos; and &apos;No&apos; different? AlwaysBreakBeforeMultilineStrings is false.

They are definitely different for AlwaysBreakTemplateDeclarations.  And as mentioned above, false isn&apos;t documented to be a valid value for that setting anyway.

AlwaysBreakBeforeMultilineStrings is defined to take true/false.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1743609</commentid>
    <comment_count>17</comment_count>
    <who name="Ross Kirsling">ross.kirsling</who>
    <bug_when>2021-03-24 17:06:43 -0700</bug_when>
    <thetext>(In reply to Cameron McCormack (:heycam) from comment #3)
&gt; Looking at https://clang.llvm.org/docs/ClangFormatStyleOptions.html, we need
&gt; to set SpaceBeforeCpp11BracedList to true.  And I guess update upstream
&gt; clang&apos;s WebKit defaults as well.

Upstream clang&apos;s WebKit defaults are already correct -- I added SpaceBeforeCpp11BracedList a few years ago for the purpose of supporting WebKit style. :)
https://github.com/llvm/llvm-project/blob/main/clang/lib/Format/Format.cpp#L1314</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1743614</commentid>
    <comment_count>18</comment_count>
    <who name="Cameron McCormack (:heycam)">heycam</who>
    <bug_when>2021-03-24 17:23:53 -0700</bug_when>
    <thetext>(In reply to Ross Kirsling from comment #17)
&gt; Upstream clang&apos;s WebKit defaults are already correct -- I added
&gt; SpaceBeforeCpp11BracedList a few years ago for the purpose of supporting
&gt; WebKit style. :)
&gt; https://github.com/llvm/llvm-project/blob/main/clang/lib/Format/Format.
&gt; cpp#L1314

Oh, thank you!  I should probably go through that to see if there&apos;s anything else we&apos;re incorrectly overriding.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>423841</attachid>
            <date>2021-03-21 16:39:37 -0700</date>
            <delta_ts>2021-03-21 19:31:03 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-223229-20210322103935.patch</filename>
            <type>text/plain</type>
            <size>1060</size>
            <attacher name="Cameron McCormack (:heycam)">heycam</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjc0NzQyCmRpZmYgLS1naXQgYS8uY2xhbmctZm9ybWF0IGIv
LmNsYW5nLWZvcm1hdAppbmRleCA1ZDFiYTA5MmFmMDNhYjlkODZlNmEzZDRlYTQ0M2Y2ZGQ4NTVh
ODhlLi43NzJjOTkyMDE2MjUzMmRhYzE3YWQwZGQwNmEyOWNhNjQ4MTBkODUwIDEwMDY0NAotLS0g
YS8uY2xhbmctZm9ybWF0CisrKyBiLy5jbGFuZy1mb3JtYXQKQEAgLTk0LDYgKzk0LDcgQEAgU29y
dFVzaW5nRGVjbGFyYXRpb25zOiB0cnVlCiBTcGFjZUFmdGVyQ1N0eWxlQ2FzdDogZmFsc2UKIFNw
YWNlQWZ0ZXJUZW1wbGF0ZUtleXdvcmQ6IHRydWUKIFNwYWNlQmVmb3JlQXNzaWdubWVudE9wZXJh
dG9yczogdHJ1ZQorU3BhY2VCZWZvcmVDcHAxMUJyYWNlZExpc3Q6IHRydWUKIFNwYWNlQmVmb3Jl
UGFyZW5zOiBDb250cm9sU3RhdGVtZW50cwogU3BhY2VJbkVtcHR5UGFyZW50aGVzZXM6IGZhbHNl
CiBTcGFjZXNCZWZvcmVUcmFpbGluZ0NvbW1lbnRzOiAxCmRpZmYgLS1naXQgYS9DaGFuZ2VMb2cg
Yi9DaGFuZ2VMb2cKaW5kZXggZTk3Mjc5OWU0Y2JiNzlkMDQ5OThhNTAwOWJjYmZjZDBiMTg4N2Ez
NS4uZTBmMjJhZWM3NjAwOGI1M2Y2ZjljZWViN2RkYzNhMTJjMTRmYmRlZSAxMDA2NDQKLS0tIGEv
Q2hhbmdlTG9nCisrKyBiL0NoYW5nZUxvZwpAQCAtMSwzICsxLDEyIEBACisyMDIxLTAzLTIxICBD
YW1lcm9uIE1jQ29ybWFjayAgPGhleWNhbUBhcHBsZS5jb20+CisKKyAgICAgICAgVXBkYXRlIC5j
bGFuZy1mb3JtYXQgdG8gcmVmbGVjdCBXZWJLaXQgc3R5bGUgZm9yIHNwYWNpbmcgYXJvdW5kIGJy
YWNlZCBpbml0aWFsaXplcnMuCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3df
YnVnLmNnaT9pZD0yMjMyMjkKKworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkgKE9PUFMhKS4K
KworICAgICAgICAqIC5jbGFuZy1mb3JtYXQ6CisKIDIwMjEtMDMtMTggIENhcmxvcyBHYXJjaWEg
Q2FtcG9zICA8Y2dhcmNpYUBpZ2FsaWEuY29tPgogCiAgICAgICAgIFtXUEVdIEJ1bXAgQVBJIHZl
cnNpb24gd2hlbiBidWlsZGluZyB3aXRoIGxpYnNvdXAzCg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>423845</attachid>
            <date>2021-03-21 19:31:07 -0700</date>
            <delta_ts>2021-03-23 14:24:05 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-223229-20210322133106.patch</filename>
            <type>text/plain</type>
            <size>1969</size>
            <attacher name="Cameron McCormack (:heycam)">heycam</attacher>
            
              <data encoding="base64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