Skip to content

Commit 387dc0b

Browse files
committedSep 17, 2015
Add a test to modernize-loop-convert.
Summary: Add the test about replacements in several arguments of the same macro call, now that the problem has been fixed. Reviewers: alexfh Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D12933 llvm-svn: 247889
1 parent 67a5da6 commit 387dc0b

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed
 

Diff for: ‎clang-tools-extra/test/clang-tidy/modernize-loop-convert-extra.cpp

+9-15
Original file line numberDiff line numberDiff line change
@@ -702,21 +702,15 @@ void messing_with_macros() {
702702
printf("Value: %d\n", CONT arr[i]);
703703
}
704704

705-
// FIXME: Right now, clang-tidy does not allow to make insertions in several
706-
// arguments of the same macro call. The following code:
707-
// \code
708-
// for (int i = 0; i < N; ++i) {
709-
// TWO_PARAM(arr[i], arr[i]);
710-
// THREE_PARAM(arr[i], arr[i], arr[i]);
711-
// }
712-
// \endcode
713-
// Should be converted to this:
714-
// \code
715-
// for (auto & elem : arr) {
716-
// TWO_PARAM(elem, elem);
717-
// THREE_PARAM(elem, elem, elem);
718-
// }
719-
// \endcode
705+
// Multiple macro arguments.
706+
for (int i = 0; i < N; ++i) {
707+
TWO_PARAM(arr[i], arr[i]);
708+
THREE_PARAM(arr[i], arr[i], arr[i]);
709+
}
710+
// CHECK-MESSAGES: :[[@LINE-4]]:3: warning: use range-based for loop instead
711+
// CHECK-FIXES: for (auto & elem : arr)
712+
// CHECK-FIXES-NEXT: TWO_PARAM(elem, elem);
713+
// CHECK-FIXES-NEXT: THREE_PARAM(elem, elem, elem);
720714
}
721715

722716
} // namespace Macros

0 commit comments

Comments
 (0)
Please sign in to comment.