You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support inline fixers for fix and warn plugin #221
void g() {
// CHECK-NOTES: [[@LINE+4]]:5: warning: argument name 'y' in comment does not match parameter name 'x'
// CHECK-NOTES: [[@LINE-3]]:12: note: 'x' declared here
// CHECK-NOTES: [[@LINE+2]]:14: warning: argument name 'z' in comment does not match parameter name 'y'
// CHECK-NOTES: [[@LINE-5]]:19: note: 'y' declared here
f(/*y=*/0, /*z=*/0);
// CHECK-FIXES: {{^}} f(/*y=*/0, /*z=*/0);
f(/*x=*/1, /*y=*/1);
ffff(0 /*aaaa=*/, /*bbbb*/ 0); // Unsupported formats.
}
And how the following multi-line fixes are working:
int VeryVeryVeryVeryLongVariableName;
absl::Time SomeTime;
if (some_condition && very_very_very_very_long_variable_name
< absl::ToUnixSeconds(SomeTime)) {
// CHECK-MESSAGES: [[@LINE-2]]:25: warning: perform comparison in the time domain [abseil-time-comparison]
// CHECK-FIXES: if (some_condition && absl::FromUnixSeconds(very_very_very_very_long_variable_name) < SomeTime) {
return;
}
The check_clang_tidy.py script provides an easy way to test both diagnostic messages and fix-its. It filters out CHECK lines from the test file, runs clang-tidy and verifies messages and fixes with two separate FileCheck invocations: once with FileCheck’s directive prefix set to CHECK-MESSAGES, validating the diagnostic messages, and once with the directive prefix set to CHECK-FIXES, running against the fixed code (i.e., the code after generated fix-its are applied). In particular, CHECK-FIXES: can be used to check that code was not modified by fix-its, by checking that it is present unchanged in the fixed code. The full set of FileCheck directives is available (e.g., CHECK-MESSAGES-SAME:, CHECK-MESSAGES-NOT:), though typically the basic CHECK forms (CHECK-MESSAGES and CHECK-FIXES) are sufficient for clang-tidy tests. Note that the FileCheck documentation mostly assumes the default prefix (CHECK), and hence describes the directive as CHECK:, CHECK-SAME:, CHECK-NOT:, etc. Replace CHECK by either CHECK-FIXES or CHECK-MESSAGES for clang-tidy tests.
Activity
Support inline fixers for fix and warn plugin
orchestr7 commentedon Sep 1, 2021
Bad news are the following:
orchestr7 commentedon Sep 1, 2021
The check_clang_tidy.py script provides an easy way to test both diagnostic messages and fix-its. It filters out CHECK lines from the test file, runs clang-tidy and verifies messages and fixes with two separate FileCheck invocations: once with FileCheck’s directive prefix set to CHECK-MESSAGES, validating the diagnostic messages, and once with the directive prefix set to CHECK-FIXES, running against the fixed code (i.e., the code after generated fix-its are applied). In particular, CHECK-FIXES: can be used to check that code was not modified by fix-its, by checking that it is present unchanged in the fixed code. The full set of FileCheck directives is available (e.g., CHECK-MESSAGES-SAME:, CHECK-MESSAGES-NOT:), though typically the basic CHECK forms (CHECK-MESSAGES and CHECK-FIXES) are sufficient for clang-tidy tests. Note that the FileCheck documentation mostly assumes the default prefix (CHECK), and hence describes the directive as CHECK:, CHECK-SAME:, CHECK-NOT:, etc. Replace CHECK by either CHECK-FIXES or CHECK-MESSAGES for clang-tidy tests.
Support inline fixers for fix and warn plugin
Support inline fixers for fix and warn plugin
Support inline fixers for fix and warn plugin
Support inline fixers for fix and warn plugin
Change test storage from List to class in Fix plugin
Change test storage from List to class in Fix plugin
Change test storage from List to class in Fix plugin
Change test storage from List to class in Fix plugin
Change test storage from List to class in Fix plugin
Change test storage from List to class in Fix plugin
Change test storage from List to class in Fix plugin
kgevorkyan commentedon Feb 17, 2023
@akuleshov7 btw, why it still pinned? I think we can drop it for now