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

Richard Bradfield via cfe-dev cfe-dev at lists.llvm.org
Mon Apr 3 09:12:58 PDT 2017


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-clang-format-Recognize-Java-logical-shift-assign-oper.patch
Type: text/x-patch
Size: 4911 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170403/208a7bd6/attachment.bin>


More information about the cfe-dev mailing list