Reviewers: Sven Panne,

Description:
Migrate TRACED_FOREACH to C++11.

[email protected]

Please review this at https://codereview.chromium.org/851243002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+8, -11 lines):
  M testing/gtest-support.h


Index: testing/gtest-support.h
diff --git a/testing/gtest-support.h b/testing/gtest-support.h
index 04daa55edcf211dbba01a6e01aef03ee6e8d773f..ba0e2f41f993bd1873d15460226e8f527f9fa1a2 100644
--- a/testing/gtest-support.h
+++ b/testing/gtest-support.h
@@ -5,7 +5,6 @@
 #ifndef V8_TESTING_GTEST_SUPPORT_H_
 #define V8_TESTING_GTEST_SUPPORT_H_

-#include <stddef.h>
 #include "testing/gtest/include/gtest/gtest.h"

 namespace testing {
@@ -32,16 +31,14 @@ GET_TYPE_NAME(double)
 #undef GET_TYPE_NAME


-// TRACED_FOREACH(type, var, array) expands to a loop that assigns |var| every -// item in the |array| and adds a SCOPED_TRACE() message for the |var| while
-// inside the loop body.
-// TODO(bmeurer): Migrate to C++11 once we're ready.
-#define TRACED_FOREACH(_type, _var, _array) \ - for (size_t _i = 0; _i < arraysize(_array); ++_i) \ - for (bool _done = false; !_done;) \ - for (_type const _var = _array[_i]; !_done;) \ - for (SCOPED_TRACE(::testing::Message() << #_var << " = " << _var); \
-             !_done; _done = true)
+// TRACED_FOREACH(type, var, container) expands to a loop that assigns | var|
+// every item in the |container| and adds a SCOPED_TRACE() message for the
+// |var| while inside the loop body.
+#define TRACED_FOREACH(_type, _var, _container)                          \
+  for (_type const _var : _container)                                    \
+    for (bool _done = false; !_done;)                                    \
+      for (SCOPED_TRACE(::testing::Message() << #_var << " = " << _var); \
+           !_done; _done = true)


// TRACED_FORRANGE(type, var, low, high) expands to a loop that assigns | var|


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to