Files
clang-p2996/clang-tools-extra/test/loop-convert/negative-pseudoarray-extra.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

30 lines
717 B
C++

// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
// RUN: loop-convert -A1 . %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 ({{.*[^:]:[^:].*}})
const int N = 6;
dependent<int> v;
dependent<int> *pv;
int sum = 0;
// Checks to see that non-const member functions are not called on the container
// object.
// These could be conceivably allowed with a lower required confidence level.
void memberFunctionCalled() {
for (int i = 0; i < v.size(); ++i) {
sum += v[i];
v.foo();
}
for (int i = 0; i < v.size(); ++i) {
sum += v[i];
dependent<int>::iterator it = v.begin();
}
}