================
Comment at: test/cpp11-migrate/UseAuto/gen_basic_std_iterator_tests.py:28-49
@@ +27,24 @@
+
+for c in containers:
+  print """
+  {{
+    std::{0}<int> C;
+    std::{0}<int>::iterator I = C.begin();
+    // CHECK: auto I = C.begin();
+  }}
+  {{
+    std::{0}<int> C;
+    std::{0}<int>::reverse_iterator I = C.rbegin();
+    // CHECK: auto I = C.rbegin();
+  }}
+  {{
+    const std::{0}<int> C;
+    std::{0}<int>::const_iterator I = C.begin();
+    // CHECK: auto I = C.begin();
+  }}
+  {{
+    const std::{0}<int> C;
+    std::{0}<int>::const_reverse_iterator I = C.rbegin();
+    // CHECK: auto I = C.rbegin();
+  }}""".format(c)
+
----------------
It is probably prettier to use `string.Template` since that uses `$foo` for the 
substitutions, which grooves better with the curly braces in the string. 
<http://docs.python.org/2/library/string.html#template-strings>.

Also, `string.Template` is compatible back to Python 2.4 which I think is 
(sadly) our baseline version for use in the test suite. The new style 
formatting was introduced in 2.6. If you want to stay with str.format, you 
should also do a `__future__` import of `print_function` so that this code will 
work with both Python2 and Python3 (`print_function` is available in 2.6+ as 
well).

It might also be interesting to commit this with the `str.format` calls and see 
if any of the buildbots blow up (to test the waters of what Python version they 
are *actually* running).

================
Comment at: test/cpp11-migrate/UseAuto/basic_std_iterator_tests.cpp:1-9
@@ +1,10 @@
+// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
+// RUN: cpp11-migrate -use-auto %t.cpp -- --std=c++11 -I %S/Inputs
+// RUN: FileCheck -input-file=%t.cpp %s
+#include "my_std.h"
+
+int main(int argc, char **argv) {
+  {
+    std::array<int> C;
+    std::array<int>::iterator I = C.begin();
+    // CHECK: auto I = C.begin();
----------------
I don't really like the idea of committing generated code to source control.

Could we wire up the build system to generate these files as part of the build?

================
Comment at: test/cpp11-migrate/UseAuto/gen_basic_std_iterator_tests.py:21-24
@@ +20,6 @@
+]
+print """// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
+// RUN: cpp11-migrate -use-auto %t.cpp -- --std=c++11 -I Inputs
+// RUN: FileCheck -input-file=%t.cpp %s
+#include "my_std.h"
+
----------------
Generated files should usually have a comment at the top saying "this is a 
generated file" so that people looking at the file are aware of the fact.


http://llvm-reviews.chandlerc.com/D392

BRANCH
  iter

ARCANIST PROJECT
  clang-tools-extra
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to