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
36 lines
886 B
C++
36 lines
886 B
C++
// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
|
|
// RUN: loop-convert . %t.cpp -- -I %S/Inputs
|
|
// RUN: FileCheck -input-file=%t.cpp %s
|
|
// RUN: loop-convert . %t.cpp -A2 -- -I %S/Inputs
|
|
// RUN: FileCheck -check-prefix=RISKY -input-file=%t.cpp %s
|
|
|
|
#include "structures.h"
|
|
|
|
void f() {
|
|
const int N = 5;
|
|
const int M = 7;
|
|
int (*pArr)[N];
|
|
int Arr[N][M];
|
|
int sum = 0;
|
|
|
|
for (int i = 0; i < M; ++i) {
|
|
sum += Arr[0][i];
|
|
}
|
|
// CHECK: for (int i = 0; i < M; ++i) {
|
|
// CHECK-NEXT: sum += Arr[0][i];
|
|
// CHECK-NEXT: }
|
|
// RISKY: for (auto & [[VAR:[a-z_]+]] : Arr[0]) {
|
|
// RISKY-NEXT: sum += [[VAR]];
|
|
// RISKY-NEXT: }
|
|
|
|
for (int i = 0; i < N; ++i) {
|
|
sum += (*pArr)[i];
|
|
}
|
|
// RISKY: for (auto & [[VAR:[a-z_]+]] : *pArr) {
|
|
// RISKY-NEXT: sum += [[VAR]];
|
|
// RISKY-NEXT: }
|
|
// CHECK: for (int i = 0; i < N; ++i) {
|
|
// CHECK-NEXT: sum += (*pArr)[i];
|
|
// CHECK-NEXT: }
|
|
}
|