File tree Expand file tree Collapse file tree 7 files changed +69
-1
lines changed Expand file tree Collapse file tree 7 files changed +69
-1
lines changed Original file line number Diff line number Diff line change @@ -141,9 +141,9 @@ int main(int argc, char **argv) {
141
141
142
142
tooling::ApplyChangesSpec Spec;
143
143
Spec.Cleanup = true ;
144
- Spec.Style = FormatStyle;
145
144
Spec.Format = DoFormat ? tooling::ApplyChangesSpec::kAll
146
145
: tooling::ApplyChangesSpec::kNone ;
146
+ Spec.Style = DoFormat ? FormatStyle : format::getNoStyle ();
147
147
148
148
for (const auto &FileChange : Changes) {
149
149
FileEntryRef Entry = FileChange.first ;
Original file line number Diff line number Diff line change @@ -153,9 +153,16 @@ Changes in existing checks
153
153
Removed checks
154
154
^^^^^^^^^^^^^^
155
155
156
+ Miscellaneous
157
+ ^^^^^^^^^^^^^
158
+
156
159
- Removed `cert-dcl21-cpp `, which was deprecated since :program: `clang-tidy ` 17,
157
160
since the rule DCL21-CPP has been removed from the CERT guidelines.
158
161
162
+ - Fixed incorrect formatting in ``clang-apply-repalcements `` when no ``--format ``
163
+ option is specified. Now ``clang-apply-replacements `` applies formatting only with
164
+ the option.
165
+
159
166
Improvements to include-fixer
160
167
-----------------------------
161
168
Original file line number Diff line number Diff line change
1
+ #include < string>
2
+ // CHECK: #include <string>
3
+ // CHECK-NEXT: #include <memory>
4
+ // CHECK-NEXT: #include "bar.h"
5
+ #include < memory>
6
+ #include " foo.h"
7
+ #include " bar.h"
8
+
9
+ void foo () {
10
+ }
Original file line number Diff line number Diff line change
1
+ ---
2
+ MainSourceFile : no.cpp
3
+ Diagnostics :
4
+ - DiagnosticName : test-header-format
5
+ DiagnosticMessage :
6
+ Message : Fix
7
+ FilePath : $(path)/no.cpp
8
+ FileOffset : 36
9
+ Replacements :
10
+ - FilePath : $(path)/no.cpp
11
+ Offset : 36
12
+ Length : 17
13
+ ReplacementText : " "
14
+ ...
Original file line number Diff line number Diff line change
1
+ #include < string>
2
+ // CHECK: #include "bar.h"
3
+ // CHECK-NEXT: #include <memory>
4
+ // CHECK-NEXT: #include <string>
5
+ #include < memory>
6
+ #include " foo.h"
7
+ #include " bar.h"
8
+
9
+ void foo () {
10
+ }
Original file line number Diff line number Diff line change
1
+ ---
2
+ MainSourceFile : yes.cpp
3
+ Diagnostics :
4
+ - DiagnosticName : test-header-format
5
+ DiagnosticMessage :
6
+ Message : Fix
7
+ FilePath : $(path)/yes.cpp
8
+ FileOffset : 36
9
+ Replacements :
10
+ - FilePath : $(path)/yes.cpp
11
+ Offset : 36
12
+ Length : 17
13
+ ReplacementText : " "
14
+ ...
Original file line number Diff line number Diff line change
1
+ // RUN: mkdir -p %T/Inputs/format_header_yes
2
+ // RUN: mkdir -p %T/Inputs/format_header_no
3
+ //
4
+ //
5
+ // RUN: grep -Ev "// *[A-Z-]+:" %S/Inputs/format_header/yes.cpp > %T/Inputs/format_header_yes/yes.cpp
6
+ // RUN: grep -Ev "// *[A-Z-]+:" %S/Inputs/format_header/no.cpp > %T/Inputs/format_header_no/no.cpp
7
+ // RUN: sed "s#\$(path)#%/T/Inputs/format_header_yes#" %S/Inputs/format_header/yes.yaml > %T/Inputs/format_header_yes/yes.yaml
8
+ // RUN: sed "s#\$(path)#%/T/Inputs/format_header_no#" %S/Inputs/format_header/no.yaml > %T/Inputs/format_header_no/no.yaml
9
+ // RUN: clang-apply-replacements -format -style="{BasedOnStyle: llvm, SortIncludes: CaseSensitive}" %T/Inputs/format_header_yes
10
+ // RUN: clang-apply-replacements %T/Inputs/format_header_no
11
+ // RUN: FileCheck --strict-whitespace -input-file=%T/Inputs/format_header_yes/yes.cpp %S/Inputs/format_header/yes.cpp
12
+ // RUN: FileCheck --strict-whitespace -input-file=%T/Inputs/format_header_no/no.cpp %S/Inputs/format_header/no.cpp
13
+ //
You can’t perform that action at this time.
0 commit comments