Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(718)

Unified Diff: testing/gtest-support.h

Issue 851243002: Migrate TRACED_FOREACH to C++11. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) \
Sven Panne 2015/01/16 08:30:38 I know that this is the literal translation (more
+ 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|
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698