diff options
author | Paul Hoad <mydeveloperday@gmail.com> | 2019-03-30 13:05:40 +0000 |
---|---|---|
committer | Paul Hoad <mydeveloperday@gmail.com> | 2019-03-30 13:05:40 +0000 |
commit | 3801733470ece4d51745086859e466f3375ac855 (patch) | |
tree | 37cc8da92eeea8fc25a6908bfcc21704323eac2a /lib/Format | |
parent | 5ae8ac7bf165af4ea7d254c2adc4bbc8a7c7b154 (diff) |
[clang-format] [PR41187] moves Java import statements to the wrong location if code contains statements that start with the word import
Summary:
Import sorting of java file, incorrectly move import statement to after a function beginning with the word import.
Make 1 character change to regular expression to ensure there is always at least one space/tab after the word import
Previously clang-format --style="LLVM" would format
```
import X;
class C {
void m() {
importFile();
}
}
```
as
```
class C {
void m() {
importFile();
import X;
}
}
```
Reviewers: djasper, klimek, reuk, JonasToth
Reviewed By: klimek
Subscribers: cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D59684
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357345 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format')
-rw-r--r-- | lib/Format/Format.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index da85239976..119be9fae6 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -1983,7 +1983,7 @@ static void sortJavaImports(const FormatStyle &Style, namespace { const char JavaImportRegexPattern[] = - "^[\t ]*import[\t ]*(static[\t ]*)?([^\t ]*)[\t ]*;"; + "^[\t ]*import[\t ]+(static[\t ]*)?([^\t ]*)[\t ]*;"; } // anonymous namespace |