Files
clang-p2996/clang-tools-extra/test/loop-convert/negative-multi-end-call.cpp
David Blaikie efae14e96c Fix tests to be more robust (to older versions of grep, lesser lit-like test runners, etc)
Seems I had a problem with my version of grep, when run by lit, not supporting
the \s escape. This seems to fix it for me & I'll be getting the buildbots to
run these tests too to keep an eye on them (actually loop-convert tests still
fail when run via a make build, so that'll be addressed in a future commit). I
could use [[:space:]] to generalize over other whitespace but that seemed
unnecessarily verbose when the flexibility wasn't actually required by the
current text of the tests.

Also I just simplified a lot of the loop-convert tests (removing the
unecessary temp file deletion at the start, removing the unnecessary && for
FileCheck, etc).

The remove-cstr-calls/basic.cpp changes were necessitated by an out of tree
lit-like test runner that's a bit less fantastic about escaping. They were
modeled on existing tooling test cases in Clang, with thanks to Manuel Klimek
for the pointers.

llvm-svn: 163009
2012-08-31 17:49:33 +00:00

65 lines
1.3 KiB
C++

// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
// RUN: loop-convert -A0 . %t.cpp -- -I %S/Inputs
// RUN: FileCheck -input-file=%t.cpp %s
#include "structures.h"
// Single FileCheck line to make sure that no loops are converted.
// CHECK-NOT: for ({{.*[^:]:[^:].*}})
S s;
T t;
U u;
void multipleEnd() {
for (S::iterator i = s.begin(); i != s.end(); ++i)
MutableVal k = *i;
for (T::iterator i = t.begin(); i != t.end(); ++i)
int k = *i;
for (U::iterator i = u.begin(); i != u.end(); ++i)
Val k = *i;
}
void f(X);
void f(S);
void f(T);
void complexContainer() {
X x;
for (S::iterator i = x.s.begin(), e = x.s.end(); i != e; ++i) {
f(x);
MutableVal k = *i;
}
for (T::iterator i = x.t.begin(), e = x.t.end(); i != e; ++i) {
f(x);
int k = *i;
}
for (S::iterator i = x.s.begin(), e = x.s.end(); i != e; ++i) {
f(x.s);
MutableVal k = *i;
}
for (T::iterator i = x.t.begin(), e = x.t.end(); i != e; ++i) {
f(x.t);
int k = *i;
}
for (S::iterator i = x.getS().begin(), e = x.getS().end(); i != e; ++i) {
f(x.getS());
MutableVal k = *i;
}
X exes[5];
int index = 0;
for (S::iterator i = exes[index].getS().begin(),
e = exes[index].getS().end(); i != e; ++i) {
index++;
MutableVal k = *i;
}
}