diff options
| author | Chandler Carruth <chandlerc@gmail.com> | 2013-09-04 17:35:07 +0000 |
|---|---|---|
| committer | Chandler Carruth <chandlerc@gmail.com> | 2013-09-04 17:35:07 +0000 |
| commit | d9063c46f59f4bec47bcbeddca8ca2f789348c03 (patch) | |
| tree | 76505542df7a05016dc71ffe44ed3ba264fb54be /clang-tools-extra/test/cpp11-migrate/LoopConvert/naming-conflict.cpp | |
| parent | 6a23d212897d5402035cfaea82260f6dae1c8f2a (diff) | |
| download | bcm5719-llvm-d9063c46f59f4bec47bcbeddca8ca2f789348c03.tar.gz bcm5719-llvm-d9063c46f59f4bec47bcbeddca8ca2f789348c03.zip | |
Rename cpp11-migrate to clang-modernize.
There is no reason to expect this tool to be limited to C++11, it seems
very likely to be of on-going interest. It seems likely to be useful for
modernizing even as new libraries come out in TSes and other formats
than a complete standard. Fundamentally, we need something a bit more
general. After some discussion on the list, going with
'clang-modernize'.
I've tried to do a reasonably comprehensive job of fixing up the names,
but I may still have missed some. Feel free to poke me if you spot any
fallout here. Things I've tried reasonably hard to find and fix:
- cpp11-migrate -> clang-modernize
- Migrator -> Modernizer
- Clean up the introductory documentation that was C++11 specific.
I'll also point out that this tool continues to delight me. =] Also,
a huge thanks to those who have so carefully, thoroughly documented the
tool. The docs here are simply phenomenal. Every tool should be this
well documented. I hope I have updated the documentation reasonably
well, but I'm not very good at documentation, so review much
appreciated.
llvm-svn: 189960
Diffstat (limited to 'clang-tools-extra/test/cpp11-migrate/LoopConvert/naming-conflict.cpp')
| -rw-r--r-- | clang-tools-extra/test/cpp11-migrate/LoopConvert/naming-conflict.cpp | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/clang-tools-extra/test/cpp11-migrate/LoopConvert/naming-conflict.cpp b/clang-tools-extra/test/cpp11-migrate/LoopConvert/naming-conflict.cpp deleted file mode 100644 index 2454d078e69..00000000000 --- a/clang-tools-extra/test/cpp11-migrate/LoopConvert/naming-conflict.cpp +++ /dev/null @@ -1,119 +0,0 @@ -// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp -// RUN: cpp11-migrate -loop-convert %t.cpp -- -I %S/Inputs -// RUN: FileCheck -input-file=%t.cpp %s - -#include "structures.h" - -#define MAX(a,b) (a > b) ? a : b -#define DEF 5 - -const int N = 10; -int nums[N]; -int sum = 0; - -namespace ns { - struct st { - int x; - }; -} - -void sameNames() { - int num = 0; - for (int i = 0; i < N; ++i) { - printf("Fibonacci number is %d\n", nums[i]); - sum += nums[i] + 2 + num; - (void) nums[i]; - } - // CHECK: for (auto & nums_i : nums) - // CHECK-NEXT: printf("Fibonacci number is %d\n", nums_i); - // CHECK-NEXT: sum += nums_i + 2 + num; - // CHECK-NOT: (void) num; -} - -void macroConflict() { - S MAXs; - for (S::iterator it = MAXs.begin(), e = MAXs.end(); it != e; ++it) { - printf("s has value %d\n", (*it).x); - printf("Max of 3 and 5: %d\n", MAX(3,5)); - } - // CHECK: for (auto & MAXs_it : MAXs) - // CHECK-NEXT: printf("s has value %d\n", (MAXs_it).x); - // CHECK-NEXT: printf("Max of 3 and 5: %d\n", MAX(3,5)); - - for (S::const_iterator it = MAXs.begin(), e = MAXs.end(); it != e; ++it) { - printf("s has value %d\n", (*it).x); - printf("Max of 3 and 5: %d\n", MAX(3,5)); - } - // CHECK: for (const auto & MAXs_it : MAXs) - // CHECK-NEXT: printf("s has value %d\n", (MAXs_it).x); - // CHECK-NEXT: printf("Max of 3 and 5: %d\n", MAX(3,5)); - - T DEFs; - for (T::iterator it = DEFs.begin(), e = DEFs.end(); it != e; ++it) { - if (*it == DEF) { - printf("I found %d\n", *it); - } - } - // CHECK: for (auto & DEFs_it : DEFs) - // CHECK-NEXT: if (DEFs_it == DEF) { - // CHECK-NEXT: printf("I found %d\n", DEFs_it); -} - -void keywordConflict() { - T ints; - for (T::iterator it = ints.begin(), e = ints.end(); it != e; ++it) { - *it = 5; - } - // CHECK: for (auto & ints_it : ints) - // CHECK-NEXT: ints_it = 5; - - U __FUNCTION__s; - for (U::iterator it = __FUNCTION__s.begin(), e = __FUNCTION__s.end(); - it != e; ++it) { - int __FUNCTION__s_it = (*it).x + 2; - } - // CHECK: for (auto & __FUNCTION__s_elem : __FUNCTION__s) - // CHECK-NEXT: int __FUNCTION__s_it = (__FUNCTION__s_elem).x + 2; -} - -void typeConflict() { - T Vals; - // Using the name "Val", although it is the name of an existing struct, is - // safe in this loop since it will only exist within this scope. - for (T::iterator it = Vals.begin(), e = Vals.end(); it != e; ++it) { - } - // CHECK: for (auto & Val : Vals) - - // We cannot use the name "Val" in this loop since there is a reference to - // it in the body of the loop. - for (T::iterator it = Vals.begin(), e = Vals.end(); it != e; ++it) { - *it = sizeof(Val); - } - // CHECK: for (auto & Vals_it : Vals) - // CHECK-NEXT: Vals_it = sizeof(Val); - - typedef struct Val TD; - U TDs; - // Naming the variable "TD" within this loop is safe because the typedef - // was never used within the loop. - for (U::iterator it = TDs.begin(), e = TDs.end(); it != e; ++it) { - } - // CHECK: for (auto & TD : TDs) - - // "TD" cannot be used in this loop since the typedef is being used. - for (U::iterator it = TDs.begin(), e = TDs.end(); it != e; ++it) { - TD V; - V.x = 5; - } - // CHECK: for (auto & TDs_it : TDs) - // CHECK-NEXT: TD V; - // CHECK-NEXT: V.x = 5; - - using ns::st; - T sts; - for (T::iterator it = sts.begin(), e = sts.end(); it != e; ++it) { - *it = sizeof(st); - } - // CHECK: for (auto & sts_it : sts) - // CHECK-NEXT: sts_it = sizeof(st); -} |

