New issue
Advanced search Search tips

Issue 695885 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Feb 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 1
Type: Bug-Regression



Sign in to add a comment

Regression (?): clang-format inserts newline before final ; on enums in files containing Obj-C method declarations in .h files

Project Member Reported by thakis@chromium.org, Feb 24 2017

Issue description

In:

enum A {};

@interface I
- (void)f;
@end


Out:

enum A {}
;

@interface I
- (void)f;
@end



I believe, but haven't verified, that this is a regression from the recent clang-format roll.
 

Comment 1 by thakis@chromium.org, Feb 24 2017

Seems to happen only in .h files. Might've happened with the old clang-format too, still trying to make a reliable repro.

Comment 2 by thakis@chromium.org, Feb 24 2017

Summary: Regression (?): clang-format inserts newline before final ; on enums in files containing Obj-C method declarations in .h files (was: Regression (?): clang-format inserts newline before final ; on enums in files containing Obj-C method declarations)
It is a regression, I think.

Only seems to happen in .h files, and only if there's a newline between the enum and the @interface.

thakis@thakis:~/src/chrome/src$ cat test.h
enum A {};
@interface I
- (void)f;
@end


thakis@thakis:~/src/chrome/src$ buildtools/linux64/clang-format --version
clang-format version 4.0.0 (trunk 282138)
thakis@thakis:~/src/chrome/src$ buildtools/linux64/clang-format test.h
enum A {};
@interface I
- (void)f;
@end


thakis@thakis:~/src/chrome/src$ buildtools/linux64/clang-format --version
clang-format version 5.0.0 (trunk 293675)
thakis@thakis:~/src/chrome/src$ buildtools/linux64/clang-format test.h
enum A {}
;
@interface I
- (void)f;
@end

Comment 4 by thakis@chromium.org, Feb 24 2017

Fixed in http://llvm.org/viewvc/llvm-project?view=revision&revision=296160 , now we need to roll that in I suppose. Let me turn on include sorting for -style=Chromium by default while at it, and land that windows tmp file patch as well.

Comment 6 by thakis@chromium.org, Feb 24 2017

And I suppose http://llvm.org/viewvc/llvm-project?view=revision&revision=296171 is nice for tidiness, even if it doesn't affect clang-format.

Comment 7 by thakis@chromium.org, Feb 24 2017

We're rolling to 296171. dbeam will build linux binaries and do the actual rolling. I uploaded mac and win binaries:

$ git diff
diff --git a/mac/clang-format.sha1 b/mac/clang-format.sha1
index 185e6d1..8679656 100644
--- a/mac/clang-format.sha1
+++ b/mac/clang-format.sha1
@@ -1 +1 @@
-5d8c350cbac89edc039f5c6f783284669f06349b
+858a454805ac1073cb19b295ec0b71381c67baf2
\ No newline at end of file

C:\src\chrome\src\buildtools>git diff
diff --git a/win/clang-format.exe.sha1 b/win/clang-format.exe.sha1
index 8280bb4..722b189 100644
--- a/win/clang-format.exe.sha1
+++ b/win/clang-format.exe.sha1
@@ -1 +1 @@
-14af12c192cc4575304b916e0fbd6adbec64183e
+bf2091a1d1dfc43551bbc5919cc2e8d2247b0dee
\ No newline at end of file

Comment 8 by dbeam@chromium.org, Feb 24 2017

Cc: -dbeam@chromium.org
Owner: dbeam@chromium.org
Status: Started (was: Untriaged)
Project Member

Comment 9 by bugdroid1@chromium.org, Feb 25 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/88bcaa73ab7e95eaa4fa3ff8c893cda7383bb26c

commit 88bcaa73ab7e95eaa4fa3ff8c893cda7383bb26c
Author: dbeam <dbeam@chromium.org>
Date: Sat Feb 25 02:29:47 2017

Roll buildtools 7e53759cf4..94cdccbebc to pick up new clang-format binaries

  94cdccbebc Update clang-format binaries and scripts for all platforms.

BUG= 695885 
TBR=brettw@chromium.org

Review-Url: https://codereview.chromium.org/2712173004
Cr-Commit-Position: refs/heads/master@{#453047}

[modify] https://crrev.com/88bcaa73ab7e95eaa4fa3ff8c893cda7383bb26c/DEPS

Comment 10 by dbeam@chromium.org, Feb 25 2017

Status: Fixed (was: Started)
let's see if this fixes
Project Member

Comment 11 by bugdroid1@chromium.org, Feb 25 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/2770ec883ce4dc5b2a56f2ea808caa483dadb7aa

commit 2770ec883ce4dc5b2a56f2ea808caa483dadb7aa
Author: dcheng <dcheng@chromium.org>
Date: Sat Feb 25 10:15:17 2017

Revert of Roll buildtools 7e53759cf4..94cdccbebc to pick up new clang-format binaries (patchset #1 id:1 of https://codereview.chromium.org/2712173004/ )

Reason for revert:
clang-format is generating bad output

Original issue's description:
> Roll buildtools 7e53759cf4..94cdccbebc to pick up new clang-format binaries
>
>   94cdccbebc Update clang-format binaries and scripts for all platforms.
>
> BUG= 695885 
> TBR=brettw@chromium.org
>
> Review-Url: https://codereview.chromium.org/2712173004
> Cr-Commit-Position: refs/heads/master@{#453047}
> Committed: https://chromium.googlesource.com/chromium/src/+/88bcaa73ab7e95eaa4fa3ff8c893cda7383bb26c

TBR=brettw@chromium.org,thakis@chromium.org,dbeam@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG= 695885 

Review-Url: https://codereview.chromium.org/2715063003
Cr-Commit-Position: refs/heads/master@{#453083}

[modify] https://crrev.com/2770ec883ce4dc5b2a56f2ea808caa483dadb7aa/DEPS

Cc: olivierrobin@chromium.org
Status: Assigned (was: Fixed)
Not fixed

A .mm file with

enum ENUM {
  ITEM_WITH_A_LONG_NAME_1,
  ITEM_WITH_A_LONG_NAME_2,
  ITEM_WITH_A_LONG_NAME_3,
  ITEM_WITH_A_LONG_NAME_4,
};

is not formatted correctly by git cl format

Comment 13 by dbeam@chromium.org, Feb 27 2017

olivierrobin@: that's because the roll was reverted ^^
Trying this again at 296408

thakis-macpro:buildtools thakis$ upload_to_google_storage.py -b chromium-clang-format mac/clang-format
Main> Calculating hash for mac/clang-format...
Main> Done calculating hash for mac/clang-format.
0> Uploading mac/clang-format...
Hashing 1 files took 0.005276 seconds
Uploading took 4.904852 seconds
Encountered error on setting metadata on gs://chromium-clang-format/8a60d832db0144283acbb6d8278dde4163472959
Setting metadata on gs://chromium-clang-format/8a60d832db0144283acbb6d8278dde4163472959...

Success!
thakis-macpro:buildtools thakis$ mac/clang-format --version
clang-format version 5.0.0 (trunk 296408)

thakis@thakis:~/src/chrome/src/buildtools$ linux64/clang-format --version
clang-format version 5.0.0 (trunk 296408)
thakis@thakis:~/src/chrome/src/buildtools$ upload_to_google_storage.py  -b chromium-clang-format linux64/clang-format
Main> Calculating hash for linux64/clang-format...
Main> Done calculating hash for linux64/clang-format.
0> Uploading linux64/clang-format...
Hashing 1 files took 0.008285 seconds
Uploading took 4.821869 seconds
Encountered error on setting metadata on gs://chromium-clang-format/416d0a9dc7ad199afd28df9e58b1b2953d33308e
Setting metadata on gs://chromium-clang-format/416d0a9dc7ad199afd28df9e58b1b2953d33308e...

Success!
thakis@thakis:~/src/chrome/src/buildtools$ git diff
diff --git a/linux64/clang-format.sha1 b/linux64/clang-format.sha1
index 8c6725d..a17404d 100644
--- a/linux64/clang-format.sha1
+++ b/linux64/clang-format.sha1
@@ -1 +1 @@
-11af9f71093d1bd01696d235ddf1c41591ebc542
+416d0a9dc7ad199afd28df9e58b1b2953d33308e
\ No newline at end of file

C:\src\chrome\src\buildtools>win\clang-format.exe --version
clang-format version 5.0.0 (trunk 296408)

C:\src\chrome\src\buildtools>python \src\depot_tools\upload_to_google_storage.py -b chromium-clang-format win\clang-form
at.exe
Main> Calculating hash for win\clang-format.exe...
Main> Done calculating hash for win\clang-format.exe.
0> Uploading win\clang-format.exe...
Hashing 1 files took 0.008000 seconds
Uploading took 7.177000 seconds
Success!

C:\src\chrome\src\buildtools>git diff
diff --git a/win/clang-format.exe.sha1 b/win/clang-format.exe.sha1
index 2101504..213343b 100644
--- a/win/clang-format.exe.sha1
+++ b/win/clang-format.exe.sha1
@@ -1 +1 @@
-bf2091a1d1dfc43551bbc5919cc2e8d2247b0dee
+6ddedd571c56b8c184f30a3c1fc36984e8c10ccd
\ No newline at end of file
Project Member

Comment 18 by bugdroid1@chromium.org, Feb 28 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/bd0fec203d70c05164f50cbc258e34bde942e470

commit bd0fec203d70c05164f50cbc258e34bde942e470
Author: Nico Weber <thakis@chromium.org>
Date: Tue Feb 28 00:44:08 2017

Roll buildtools a114b81a60..b3771b1935 to pick up new clang-format binaries

  b3771b1935 Update clang-format binaries and scripts for all platforms.

BUG= 695885 
R=dbeam@chromium.org

Review-Url: https://codereview.chromium.org/2717993003 .
Cr-Commit-Position: refs/heads/master@{#453421}

[modify] https://crrev.com/bd0fec203d70c05164f50cbc258e34bde942e470/DEPS

Owner: thakis@chromium.org
Status: Fixed (was: Assigned)

Sign in to add a comment