[PATCH] D31652: [clang-format] Recognize Java logical shift assignment operator

Richard Bradfield via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 4 02:44:39 PDT 2017


bradfier created this revision.
Herald added a subscriber: klimek.

At present, clang-format mangles Java containing logical shift assignment operators ('>>>=' or '<<<='), splitting them in two, resulting in invalid code:

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

This adds the combined assignment forms for logical shifts to the lexer, so clang-format sees them as single tokens and doesn't try to insert whitespace..


Repository:
  rL LLVM

https://reviews.llvm.org/D31652

Files:
  include/clang/Basic/LangOptions.def
  include/clang/Basic/TokenKinds.def
  lib/Format/Format.cpp
  lib/Lex/Lexer.cpp
  unittests/Format/FormatTestJava.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31652.94018.patch
Type: text/x-patch
Size: 4015 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170404/ab0924d1/attachment.bin>


More information about the cfe-commits mailing list