[PATCH] D19620: [libc++] Add braces, move braces, and rename variables to avoid shadowing.

Stephan T. Lavavej via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 27 14:23:12 PDT 2016


STL_MSFT created this revision.
STL_MSFT added reviewers: mclow.lists, EricWF.
STL_MSFT added a subscriber: cfe-commits.

[libc++] Add braces, move braces, and rename variables to avoid shadowing.

Fixes MSVC "warning C4456: declaration of 'meow' hides previous local declaration".

http://reviews.llvm.org/D19620

Files:
  test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
  test/std/containers/associative/multiset/iterator.pass.cpp
  test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
  test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
  test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp

Index: test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp
===================================================================
--- test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp
+++ test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp
@@ -46,10 +46,10 @@
     {
     typedef std::unique_ptr<int, D2> P;
     static_assert(std::is_same<P::pointer, int*>::value, "");
-
+    }
     {
     typedef std::unique_ptr<int, D3> P;
     static_assert(std::is_same<P::pointer, int*>::value, "");
-    }}
+    }
 #endif
 }
Index: test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
===================================================================
--- test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
+++ test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
@@ -28,6 +28,7 @@
 
 int main()
 {
+    {
     typedef int V;
     V ar[] =
     {
@@ -53,6 +54,7 @@
     assert(*m.begin() == 1);
     assert(*next(m.begin()) == 2);
     assert(*next(m.begin(), 2) == 3);
+    }
 #if _LIBCPP_STD_VER > 11
     {
     typedef int V;
Index: test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
===================================================================
--- test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
+++ test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
@@ -24,6 +24,7 @@
 
 int main()
 {
+    {
     typedef int V;
     V ar[] =
     {
@@ -55,6 +56,7 @@
     assert(*next(m.begin(), 6) == 3);
     assert(*next(m.begin(), 7) == 3);
     assert(*next(m.begin(), 8) == 3);
+    }
 #if _LIBCPP_STD_VER > 11
     {
     typedef int V;
Index: test/std/containers/associative/multiset/iterator.pass.cpp
===================================================================
--- test/std/containers/associative/multiset/iterator.pass.cpp
+++ test/std/containers/associative/multiset/iterator.pass.cpp
@@ -70,7 +70,7 @@
         std::multiset<int>::const_iterator k = i;
         assert(i == k);
         for (int j = 1; j <= 8; ++j)
-            for (int k = 0; k < 3; ++k, ++i)
+            for (int n = 0; n < 3; ++n, ++i)
                 assert(*i == j);
     }
     {
@@ -151,7 +151,7 @@
         std::multiset<int, std::less<int>, min_allocator<int>>::const_iterator k = i;
         assert(i == k);
         for (int j = 1; j <= 8; ++j)
-            for (int k = 0; k < 3; ++k, ++i)
+            for (int n = 0; n < 3; ++n, ++i)
                 assert(*i == j);
     }
     {
Index: test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
===================================================================
--- test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
+++ test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
@@ -62,6 +62,7 @@
 
 int main()
 {
+    {
     int i = 0;
     std::partial_sort(&i, &i, &i);
     assert(i == 0);
@@ -73,6 +74,7 @@
     test_larger_sorts(997);
     test_larger_sorts(1000);
     test_larger_sorts(1009);
+    }
 
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19620.55313.patch
Type: text/x-patch
Size: 3199 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160427/a797c4ad/attachment-0001.bin>


More information about the cfe-commits mailing list