Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang-tidy] Added -fix-errors option
Summary: Added -fix-errors option to allow applying fixes when compiler errors are present. Without this flag -fix would bail out if there are compiler errors. This is needed to avoid applying wrong fixes if Clang fails to recover from compilation errors correctly. Reviewers: djasper, klimek Reviewed By: klimek Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D6059 llvm-svn: 221152
- Loading branch information
Showing
2 changed files
with
41 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp | ||
// RUN: clang-tidy %t.cpp -checks='-*,google-explicit-constructor' -fix -- > %t.msg 2>&1 | ||
// RUN: FileCheck -input-file=%t.cpp -check-prefix=CHECK-FIX %s | ||
// RUN: FileCheck -input-file=%t.msg -check-prefix=CHECK-MESSAGES %s | ||
// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp | ||
// RUN: clang-tidy %t.cpp -checks='-*,google-explicit-constructor' -fix-errors -- > %t.msg 2>&1 | ||
// RUN: FileCheck -input-file=%t.cpp -check-prefix=CHECK-FIX2 %s | ||
// RUN: FileCheck -input-file=%t.msg -check-prefix=CHECK-MESSAGES2 %s | ||
|
||
class A { A(int i); } | ||
// CHECK-FIX: class A { A(int i); }{{$}} | ||
// CHECK-MESSAGES: Fixes have NOT been applied. | ||
// CHECK-FIX2: class A { explicit A(int i); }; | ||
// CHECK-MESSAGES2: note: FIX-IT applied suggested code changes | ||
// CHECK-MESSAGES2: clang-tidy applied 2 of 2 suggested fixes. |