clang-format: Incorrectly splitting Java logical shift assignment [Patch]

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

clang-format: Incorrectly splitting Java logical shift assignment [Patch]

Richard Pennington via cfe-dev
Hi all,

I noticed when trying to use clang-format on a large Java codebase that
it mangles logical shift assignment operators.
(That is `>>>=` and `<<<=`)

clang-format incorrectly splits them into two operators, causing a
compile error after reformatting.

 public class Minimal {
   public void func(String args) {
     int i = 42;
-    i >>>= 1;
+    i >> >= 1;
     return i;
   }
 }

Attached is a patch which fixes this,  I'm mailing here first for
feedback, since this would be my first contribution to the LLVM project,
and I'm not completely certain of the etiquette for posting to the
commit list or Phabricator.

Does this look suitable?

Cheers,
--
Richard Bradfield

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

0001-clang-format-Recognize-Java-logical-shift-assign-oper.patch (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: clang-format: Incorrectly splitting Java logical shift assignment [Patch]

Richard Pennington via cfe-dev
Hi Richard,

  Could you submit the patch in http://reviews.llvm.org/ (http://llvm.org/docs/Phabricator.html)

  I think there it will get more attention.

Cheers, Vassil
On 03/04/17 18:12, Richard Bradfield via cfe-dev wrote:
Hi all,

I noticed when trying to use clang-format on a large Java codebase that
it mangles logical shift assignment operators.
(That is `>>>=` and `<<<=`)

clang-format incorrectly splits them into two operators, causing a
compile error after reformatting.

 public class Minimal {
   public void func(String args) {
     int i = 42;
-    i >>>= 1;
+    i >> >= 1;
     return i;
   }
 }

Attached is a patch which fixes this,  I'm mailing here first for
feedback, since this would be my first contribution to the LLVM project,
and I'm not completely certain of the etiquette for posting to the
commit list or Phabricator.

Does this look suitable?

Cheers,


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: clang-format: Incorrectly splitting Java logical shift assignment [Patch]

Richard Pennington via cfe-dev
On Tue, 4 Apr 2017, at 10:30, Vassil Vassilev wrote:
> Hi Richard,
>  
>    Could you submit the patch in http://reviews.llvm.org/ (http://llvm.org/docs/Phabricator.html)
>  
>    I think there it will get more attention.
>  
>  Cheers, Vassil
>  

And done: https://reviews.llvm.org/D31652

Thanks!
--
Richard Bradfield
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Loading...