[llvm-bugs] [Bug 24905] New: Bad indent for java code with -style=Google

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 21 13:13:14 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24905

            Bug ID: 24905
           Summary: Bad indent for java code with -style=Google
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org
    Classification: Unclassified

Bad clang-format output:

$ bin/clang-format -style=Google test.java
class a {
  void f9() {
    {
      {
        {
         
mFakeScanner.mScanCallback.onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES,
              new FakeScanResult(new FakeBluetoothDevice(
                                     this, "01:00:00:90:1E:BE",
"FakeBluetoothDevice"),
                                                      uuids));
        }
      }
    }
  }
}


Since bugzilla is going to wrap this, here's the bad three lines at indent 0:

mFakeScanner.mScanCallback.onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES,
    new FakeScanResult(new FakeBluetoothDevice(
                           this, "01:00:00:90:1E:BE", "FakeBluetoothDevice"),
                                            uuids));


Note how uuids isn't aligned with anything. Renaming the same file th .cpp and
running clang-format produces much better output:

class a {
  void f9() {
    {
      {
        {
          mFakeScanner.mScanCallback.onScanResult(
              ScanSettings.CALLBACK_TYPE_ALL_MATCHES,
              new FakeScanResult(
                  new FakeBluetoothDevice(this, "01:00:00:90:1E:BE",
                                          "FakeBluetoothDevice"),
                  uuids));
        }
      }
    }
  }
}

(upstream bug: http://crbug.com/534538)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150921/5ee12103/attachment.html>


More information about the llvm-bugs mailing list