[clang-tools-extra] r247889 - Add a test to modernize-loop-convert.
Angel Garcia Gomez via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 17 07:25:39 PDT 2015
Author: angelgarcia
Date: Thu Sep 17 09:25:39 2015
New Revision: 247889
URL: http://llvm.org/viewvc/llvm-project?rev=247889&view=rev
Log:
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
Modified:
clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-extra.cpp
Modified: clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-extra.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-extra.cpp?rev=247889&r1=247888&r2=247889&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-extra.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-extra.cpp Thu Sep 17 09:25:39 2015
@@ -702,21 +702,15 @@ void messing_with_macros() {
printf("Value: %d\n", CONT arr[i]);
}
- // FIXME: Right now, clang-tidy does not allow to make insertions in several
- // arguments of the same macro call. The following code:
- // \code
- // for (int i = 0; i < N; ++i) {
- // TWO_PARAM(arr[i], arr[i]);
- // THREE_PARAM(arr[i], arr[i], arr[i]);
- // }
- // \endcode
- // Should be converted to this:
- // \code
- // for (auto & elem : arr) {
- // TWO_PARAM(elem, elem);
- // THREE_PARAM(elem, elem, elem);
- // }
- // \endcode
+ // Multiple macro arguments.
+ for (int i = 0; i < N; ++i) {
+ TWO_PARAM(arr[i], arr[i]);
+ THREE_PARAM(arr[i], arr[i], arr[i]);
+ }
+ // CHECK-MESSAGES: :[[@LINE-4]]:3: warning: use range-based for loop instead
+ // CHECK-FIXES: for (auto & elem : arr)
+ // CHECK-FIXES-NEXT: TWO_PARAM(elem, elem);
+ // CHECK-FIXES-NEXT: THREE_PARAM(elem, elem, elem);
}
} // namespace Macros
More information about the cfe-commits
mailing list