[llvm-bugs] [Bug 41187] New: clang-format moves Java import statements to the wrong location if code contains statements that start with the word import

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 21 11:04:58 PDT 2019


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

            Bug ID: 41187
           Summary: clang-format moves Java import statements to the wrong
                    location if code contains statements that start with
                    the word import
           Product: clang
           Version: 8.0
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: fhansen at nevelex.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Created attachment 21642
  --> https://bugs.llvm.org/attachment.cgi?id=21642&action=edit
Test file that reproduces the problem

Running 'clang-format -style=LLVM' on

import X;

class C {
  void m() {
    importFile();
  }
}

produces

class C {
  void m() {
    importFile();
import X;
  }
}

It appears that the fact there is a statement that starts with the word import,
in this case importFile, makes clang-format move import statements to
immediately after that statement.

This is a regression in 8.0.0.

Test file attached.

-- 
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/20190321/9111a158/attachment.html>


More information about the llvm-bugs mailing list