diff --git a/clang-tools-extra/test/clang-tidy/arg-comments.cpp b/clang-tools-extra/test/clang-tidy/arg-comments.cpp index 922c26627cbd..02dc83bb635a 100644 --- a/clang-tools-extra/test/clang-tidy/arg-comments.cpp +++ b/clang-tools-extra/test/clang-tidy/arg-comments.cpp @@ -1,4 +1,5 @@ -// RUN: clang-tidy --checks='-*,misc-argument-comment' %s -- -std=c++11 | FileCheck %s -implicit-check-not='{{warning:|error:}}' +// RUN: $(dirname %s)/check_clang_tidy.sh %s misc-argument-comment %t +// REQUIRES: shell // FIXME: clang-tidy should provide a -verify mode to make writing these checks // easier and more accurate. @@ -7,10 +8,10 @@ void ffff(int xxxx, int yyyy); void f(int x, int y); void g() { - // CHECK: [[@LINE+4]]:5: warning: argument name 'y' in comment does not match parameter name 'x' - // CHECK: :[[@LINE-3]]:12: note: 'x' declared here - // CHECK: [[@LINE+2]]:14: warning: argument name 'z' in comment does not match parameter name 'y' - // CHECK: :[[@LINE-5]]:19: note: 'y' declared here + // CHECK-MESSAGES: [[@LINE+4]]:5: warning: argument name 'y' in comment does not match parameter name 'x' + // CHECK-MESSAGES: :[[@LINE-3]]:12: note: 'x' declared here + // CHECK-MESSAGES: [[@LINE+2]]:14: warning: argument name 'z' in comment does not match parameter name 'y' + // CHECK-MESSAGES: :[[@LINE-5]]:19: note: 'y' declared here f(/*y=*/0, /*z=*/0); } @@ -36,5 +37,5 @@ void variadic2(int zzz, Args&&... args); void templates() { variadic(/*xxx=*/0, /*yyy=*/1); variadic2(/*zzZ=*/0, /*xxx=*/1, /*yyy=*/2); - // CHECK: [[@LINE-1]]:13: warning: argument name 'zzZ' in comment does not match parameter name 'zzz' + // CHECK-MESSAGES: [[@LINE-1]]:13: warning: argument name 'zzZ' in comment does not match parameter name 'zzz' } diff --git a/clang-tools-extra/test/clang-tidy/check_clang_tidy.sh b/clang-tools-extra/test/clang-tidy/check_clang_tidy.sh new file mode 100755 index 000000000000..0904d0da2df0 --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/check_clang_tidy.sh @@ -0,0 +1,45 @@ +#!/bin/sh +# +# Run clang-tidy in fix mode and verify fixes, messages or both. +# Usage: +# check_clang_tidy.sh \ +# [optional clang-tidy arguments] +# +# Example: +# // RUN: $(dirname %s)/check_clang_tidy.sh %s llvm-include-order %t -- -isystem $(dirname %s)/Inputs/Headers +# // REQUIRES: shell + +INPUT_FILE=$1 +CHECK_TO_RUN=$2 +TEMPORARY_FILE=$3.cpp +# Feed the rest arguments to clang-tidy. +shift 3 +if [ "$#" -eq 0 ] ; then + # Default to -- --std=c++11 + set - -- --std=c++11 +fi + +set -o errexit + +if ! grep -q 'CHECK-FIXES\|CHECK-MESSAGES' "${INPUT_FILE}"; then + echo "FAIL: Neither CHECK-FIXES nor CHECK-MESSAGES found in the input" + exit 1 +fi + +# Remove the contents of the CHECK lines to avoid CHECKs matching on themselves. +# We need to keep the comments to preserve line numbers while avoiding empty +# lines which could potentially trigger formatting-related checks. +sed 's#// *CHECK-[A-Z-]*:.*#//#' "${INPUT_FILE}" > "${TEMPORARY_FILE}" + +clang-tidy "${TEMPORARY_FILE}" -fix --checks="-*,${CHECK_TO_RUN}" "$@" \ + > "${TEMPORARY_FILE}.msg" 2>&1 + +if grep -q 'CHECK-FIXES' "${INPUT_FILE}"; then + FileCheck -input-file="${TEMPORARY_FILE}" "${INPUT_FILE}" \ + -check-prefix=CHECK-FIXES -strict-whitespace +fi + +if grep -q 'CHECK-MESSAGES' "${INPUT_FILE}"; then + FileCheck -input-file="${TEMPORARY_FILE}.msg" "${INPUT_FILE}" \ + -check-prefix=CHECK-MESSAGES -implicit-check-not='{{warning|error}}:' +fi diff --git a/clang-tools-extra/test/clang-tidy/check_clang_tidy_fix.sh b/clang-tools-extra/test/clang-tidy/check_clang_tidy_fix.sh deleted file mode 100755 index cccabd559ffb..000000000000 --- a/clang-tools-extra/test/clang-tidy/check_clang_tidy_fix.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# -# Run clang-tidy in fix mode and verify the result. -# Usage: -# check_clang_tidy_fix.sh \ -# [optional clang-tidy arguments] -# -# Example: -# // RUN: $(dirname %s)/check_clang_tidy_fix.sh %s llvm-include-order %t -- -isystem $(dirname %s)/Inputs/Headers -# // REQUIRES: shell - -INPUT_FILE=$1 -CHECK_TO_RUN=$2 -TEMPORARY_FILE=$3.cpp -# Feed the rest arguments to clang-tidy. -shift 3 -if [ "$#" -eq 0 ] ; then - # Default to -- --std=c++11 - set - -- --std=c++11 -fi - -set -o errexit - -# Remove the contents of the CHECK lines to avoid CHECKs matching on themselves. -# We need to keep the comments to preserve line numbers while avoiding empty -# lines which could potentially trigger formatting-related checks. -sed 's#// *CHECK-[A-Z-]*:.*#//#' ${INPUT_FILE} > ${TEMPORARY_FILE} - -clang-tidy ${TEMPORARY_FILE} -fix --checks="-*,${CHECK_TO_RUN}" "$@" \ - > ${TEMPORARY_FILE}.msg 2>&1 - -FileCheck -input-file=${TEMPORARY_FILE} ${INPUT_FILE} \ - -check-prefix=CHECK-FIXES -strict-whitespace - -if grep -q CHECK-MESSAGES ${INPUT_FILE}; then - FileCheck -input-file=${TEMPORARY_FILE}.msg ${INPUT_FILE} \ - -check-prefix=CHECK-MESSAGES -implicit-check-not="{{warning|error}}:" -fi diff --git a/clang-tools-extra/test/clang-tidy/google-explicit-make-pair.cpp b/clang-tools-extra/test/clang-tidy/google-explicit-make-pair.cpp index 895b8e69bf50..c8256c33fe47 100644 --- a/clang-tools-extra/test/clang-tidy/google-explicit-make-pair.cpp +++ b/clang-tools-extra/test/clang-tidy/google-explicit-make-pair.cpp @@ -1,4 +1,4 @@ -// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s google-build-explicit-make-pair %t +// RUN: $(dirname %s)/check_clang_tidy.sh %s google-build-explicit-make-pair %t // REQUIRES: shell namespace std { diff --git a/clang-tools-extra/test/clang-tidy/google-member-string-references.cpp b/clang-tools-extra/test/clang-tidy/google-member-string-references.cpp index 1536badad01b..6ce05cbcbe57 100644 --- a/clang-tools-extra/test/clang-tidy/google-member-string-references.cpp +++ b/clang-tools-extra/test/clang-tidy/google-member-string-references.cpp @@ -1,4 +1,5 @@ -// RUN: clang-tidy %s -checks='-*,google-runtime-member-string-references' -- | FileCheck %s -implicit-check-not="{{warning|error}}:" +// RUN: $(dirname %s)/check_clang_tidy.sh %s google-runtime-member-string-references %t +// REQUIRES: shell namespace std { template @@ -12,7 +13,7 @@ class string {}; struct A { const std::string &s; -// CHECK: :[[@LINE-1]]:3: warning: const string& members are dangerous. It is much better to use alternatives, such as pointers or simple constants. +// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: const string& members are dangerous. It is much better to use alternatives, such as pointers or simple constants. [google-runtime-member-string-references] }; struct B { @@ -28,14 +29,14 @@ struct D { D(); const T &s; const std::string &s2; -// CHECK: :[[@LINE-1]]:3: warning: const string& members are dangerous. It is much better to use alternatives, such as pointers or simple constants. +// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: const string& members are dangerous. }; D d; struct AA { const string &s; -// CHECK: :[[@LINE-1]]:3: warning: const string& members are dangerous. It is much better to use alternatives, such as pointers or simple constants. +// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: const string& members are dangerous. }; struct BB { diff --git a/clang-tools-extra/test/clang-tidy/google-memset-zero-length.cpp b/clang-tools-extra/test/clang-tidy/google-memset-zero-length.cpp index 91eae3651480..95d0d2367096 100644 --- a/clang-tools-extra/test/clang-tidy/google-memset-zero-length.cpp +++ b/clang-tools-extra/test/clang-tidy/google-memset-zero-length.cpp @@ -1,4 +1,4 @@ -// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s google-runtime-memset %t +// RUN: $(dirname %s)/check_clang_tidy.sh %s google-runtime-memset %t // REQUIRES: shell void *memset(void *, int, __SIZE_TYPE__); diff --git a/clang-tools-extra/test/clang-tidy/google-overloaded-unary-and.cpp b/clang-tools-extra/test/clang-tidy/google-overloaded-unary-and.cpp index ce3d55c7e4a6..3871330be029 100644 --- a/clang-tools-extra/test/clang-tidy/google-overloaded-unary-and.cpp +++ b/clang-tools-extra/test/clang-tidy/google-overloaded-unary-and.cpp @@ -1,24 +1,26 @@ -// RUN: clang-tidy %s -checks='-*,google-runtime-operator' -- | FileCheck %s -implicit-check-not="{{warning|error}}:" +// RUN: $(dirname %s)/check_clang_tidy.sh %s google-runtime-operator %t +// REQUIRES: shell struct Foo { void *operator&(); -// CHECK: :[[@LINE-1]]:3: warning: do not overload unary operator&, it is dangerous. +// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not overload unary operator&, it is dangerous. [google-runtime-operator] }; template struct TFoo { T *operator&(); -// CHECK: :[[@LINE-1]]:3: warning: do not overload unary operator&, it is dangerous. +// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not overload unary operator& }; TFoo tfoo; struct Bar; void *operator&(Bar &b); -// CHECK: :[[@LINE-1]]:1: warning: do not overload unary operator&, it is dangerous. +// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: do not overload unary operator& +// No warnings on binary operators. struct Qux { - void *operator&(Qux &q); // no-warning + void *operator&(Qux &q); }; -void *operator&(Qux &q, Qux &r); // no-warning +void *operator&(Qux &q, Qux &r); diff --git a/clang-tools-extra/test/clang-tidy/google-readability-casting.c b/clang-tools-extra/test/clang-tidy/google-readability-casting.c index 87d1dfcdf427..55ee0951667f 100644 --- a/clang-tools-extra/test/clang-tidy/google-readability-casting.c +++ b/clang-tools-extra/test/clang-tidy/google-readability-casting.c @@ -1,4 +1,4 @@ -// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s google-readability-casting %t -- -x c +// RUN: $(dirname %s)/check_clang_tidy.sh %s google-readability-casting %t -- -x c // REQUIRES: shell void f(const char *cpc) { diff --git a/clang-tools-extra/test/clang-tidy/google-readability-casting.cpp b/clang-tools-extra/test/clang-tidy/google-readability-casting.cpp index 414fa8bbcabb..97df3003790f 100644 --- a/clang-tools-extra/test/clang-tidy/google-readability-casting.cpp +++ b/clang-tools-extra/test/clang-tidy/google-readability-casting.cpp @@ -1,4 +1,4 @@ -// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s google-readability-casting %t +// RUN: $(dirname %s)/check_clang_tidy.sh %s google-readability-casting %t // REQUIRES: shell bool g() { return false; } diff --git a/clang-tools-extra/test/clang-tidy/google-readability-function.cpp b/clang-tools-extra/test/clang-tidy/google-readability-function.cpp index ae60f708a1ee..1c890196f25a 100644 --- a/clang-tools-extra/test/clang-tidy/google-readability-function.cpp +++ b/clang-tools-extra/test/clang-tidy/google-readability-function.cpp @@ -1,4 +1,4 @@ -// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s google-readability-function %t +// RUN: $(dirname %s)/check_clang_tidy.sh %s google-readability-function %t // REQUIRES: shell void Method(char *) { /* */ } diff --git a/clang-tools-extra/test/clang-tidy/google-readability-namespace-comments.cpp b/clang-tools-extra/test/clang-tidy/google-readability-namespace-comments.cpp index 5f55a360f5a9..d92af9423851 100644 --- a/clang-tools-extra/test/clang-tidy/google-readability-namespace-comments.cpp +++ b/clang-tools-extra/test/clang-tidy/google-readability-namespace-comments.cpp @@ -1,4 +1,4 @@ -// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s google-readability-namespace-comments %t +// RUN: $(dirname %s)/check_clang_tidy.sh %s google-readability-namespace-comments %t // REQUIRES: shell // CHECK-MESSAGES: :[[@LINE+2]]:11: warning: namespace not terminated with a closing comment [google-readability-namespace-comments] diff --git a/clang-tools-extra/test/clang-tidy/google-readability-todo.cpp b/clang-tools-extra/test/clang-tidy/google-readability-todo.cpp index cd4cd912b1be..9f4e3a863e12 100644 --- a/clang-tools-extra/test/clang-tidy/google-readability-todo.cpp +++ b/clang-tools-extra/test/clang-tidy/google-readability-todo.cpp @@ -1,4 +1,4 @@ -// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s google-readability-todo %t -config="{User: 'some user'}" -- +// RUN: $(dirname %s)/check_clang_tidy.sh %s google-readability-todo %t -config="{User: 'some user'}" -- // REQUIRES: shell // TODOfix this1 diff --git a/clang-tools-extra/test/clang-tidy/google-runtime-int.cpp b/clang-tools-extra/test/clang-tidy/google-runtime-int.cpp index 44d1b6502727..3a344b8097a8 100644 --- a/clang-tools-extra/test/clang-tidy/google-runtime-int.cpp +++ b/clang-tools-extra/test/clang-tidy/google-runtime-int.cpp @@ -1,13 +1,14 @@ -// RUN: clang-tidy -checks=-*,google-runtime-int %s -- -x c++ 2>&1 | FileCheck %s -implicit-check-not='{{warning:|error:}}' +// RUN: $(dirname %s)/check_clang_tidy.sh %s google-runtime-int %t +// REQUIRES: shell long a(); -// CHECK: [[@LINE-1]]:1: warning: consider replacing 'long' with 'int{{..}}' +// CHECK-MESSAGES: [[@LINE-1]]:1: warning: consider replacing 'long' with 'int{{..}}' typedef unsigned long long uint64; // NOLINT long b(long = 1); -// CHECK: [[@LINE-1]]:1: warning: consider replacing 'long' with 'int{{..}}' -// CHECK: [[@LINE-2]]:8: warning: consider replacing 'long' with 'int{{..}}' +// CHECK-MESSAGES: [[@LINE-1]]:1: warning: consider replacing 'long' with 'int{{..}}' +// CHECK-MESSAGES: [[@LINE-2]]:8: warning: consider replacing 'long' with 'int{{..}}' template void tmpl() { @@ -15,45 +16,45 @@ void tmpl() { } short bar(const short, unsigned short) { -// CHECK: [[@LINE-1]]:1: warning: consider replacing 'short' with 'int16' -// CHECK: [[@LINE-2]]:17: warning: consider replacing 'short' with 'int16' -// CHECK: [[@LINE-3]]:24: warning: consider replacing 'unsigned short' with 'uint16' +// CHECK-MESSAGES: [[@LINE-1]]:1: warning: consider replacing 'short' with 'int16' +// CHECK-MESSAGES: [[@LINE-2]]:17: warning: consider replacing 'short' with 'int16' +// CHECK-MESSAGES: [[@LINE-3]]:24: warning: consider replacing 'unsigned short' with 'uint16' long double foo = 42; uint64 qux = 42; unsigned short port; const unsigned short bar = 0; -// CHECK: [[@LINE-1]]:9: warning: consider replacing 'unsigned short' with 'uint16' +// CHECK-MESSAGES: [[@LINE-1]]:9: warning: consider replacing 'unsigned short' with 'uint16' long long *baar; -// CHECK: [[@LINE-1]]:3: warning: consider replacing 'long long' with 'int64' +// CHECK-MESSAGES: [[@LINE-1]]:3: warning: consider replacing 'long long' with 'int64' const unsigned short &bara = bar; -// CHECK: [[@LINE-1]]:9: warning: consider replacing 'unsigned short' with 'uint16' +// CHECK-MESSAGES: [[@LINE-1]]:9: warning: consider replacing 'unsigned short' with 'uint16' long const long moo = 1; -// CHECK: [[@LINE-1]]:3: warning: consider replacing 'long long' with 'int64' +// CHECK-MESSAGES: [[@LINE-1]]:3: warning: consider replacing 'long long' with 'int64' long volatile long wat = 42; -// CHECK: [[@LINE-1]]:3: warning: consider replacing 'long long' with 'int64' +// CHECK-MESSAGES: [[@LINE-1]]:3: warning: consider replacing 'long long' with 'int64' unsigned long y; -// CHECK: [[@LINE-1]]:3: warning: consider replacing 'unsigned long' with 'uint{{..}}' +// CHECK-MESSAGES: [[@LINE-1]]:3: warning: consider replacing 'unsigned long' with 'uint{{..}}' unsigned long long **const *tmp; -// CHECK: [[@LINE-1]]:3: warning: consider replacing 'unsigned long long' with 'uint64' +// CHECK-MESSAGES: [[@LINE-1]]:3: warning: consider replacing 'unsigned long long' with 'uint64' unsigned long long **const *&z = tmp; -// CHECK: [[@LINE-1]]:3: warning: consider replacing 'unsigned long long' with 'uint64' +// CHECK-MESSAGES: [[@LINE-1]]:3: warning: consider replacing 'unsigned long long' with 'uint64' unsigned short porthole; -// CHECK: [[@LINE-1]]:3: warning: consider replacing 'unsigned short' with 'uint16' +// CHECK-MESSAGES: [[@LINE-1]]:3: warning: consider replacing 'unsigned short' with 'uint16' uint64 cast = (short)42; -// CHECK: [[@LINE-1]]:18: warning: consider replacing 'short' with 'int16' +// CHECK-MESSAGES: [[@LINE-1]]:18: warning: consider replacing 'short' with 'int16' #define l long l x; tmpl(); -// CHECK: [[@LINE-1]]:8: warning: consider replacing 'short' with 'int16' +// CHECK-MESSAGES: [[@LINE-1]]:8: warning: consider replacing 'short' with 'int16' } void p(unsigned short port); void qux() { short port; -// CHECK: [[@LINE-1]]:3: warning: consider replacing 'short' with 'int16' +// CHECK-MESSAGES: [[@LINE-1]]:3: warning: consider replacing 'short' with 'int16' } diff --git a/clang-tools-extra/test/clang-tidy/llvm-include-order.cpp b/clang-tools-extra/test/clang-tidy/llvm-include-order.cpp index 4568cb72c4ca..8c6f178fe969 100644 --- a/clang-tools-extra/test/clang-tidy/llvm-include-order.cpp +++ b/clang-tools-extra/test/clang-tidy/llvm-include-order.cpp @@ -1,4 +1,4 @@ -// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s llvm-include-order %t -- -isystem %S/Inputs/Headers +// RUN: $(dirname %s)/check_clang_tidy.sh %s llvm-include-order %t -- -isystem %S/Inputs/Headers // REQUIRES: shell // FIXME: Investigating. diff --git a/clang-tools-extra/test/clang-tidy/llvm-twine-local.cpp b/clang-tools-extra/test/clang-tidy/llvm-twine-local.cpp index f36544efbb1d..e388eeab3f39 100644 --- a/clang-tools-extra/test/clang-tidy/llvm-twine-local.cpp +++ b/clang-tools-extra/test/clang-tidy/llvm-twine-local.cpp @@ -1,4 +1,4 @@ -// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s llvm-twine-local %t +// RUN: $(dirname %s)/check_clang_tidy.sh %s llvm-twine-local %t // REQUIRES: shell namespace llvm { diff --git a/clang-tools-extra/test/clang-tidy/misc-bool-pointer-implicit-conversion.cpp b/clang-tools-extra/test/clang-tidy/misc-bool-pointer-implicit-conversion.cpp index 2a27e6cd87a6..c8a7de930032 100644 --- a/clang-tools-extra/test/clang-tidy/misc-bool-pointer-implicit-conversion.cpp +++ b/clang-tools-extra/test/clang-tidy/misc-bool-pointer-implicit-conversion.cpp @@ -1,4 +1,4 @@ -// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s misc-bool-pointer-implicit-conversion %t +// RUN: $(dirname %s)/check_clang_tidy.sh %s misc-bool-pointer-implicit-conversion %t // REQUIRES: shell bool *SomeFunction(); diff --git a/clang-tools-extra/test/clang-tidy/misc-swapped-arguments.cpp b/clang-tools-extra/test/clang-tidy/misc-swapped-arguments.cpp index 1d43a49e9ee6..746ed5790e24 100644 --- a/clang-tools-extra/test/clang-tidy/misc-swapped-arguments.cpp +++ b/clang-tools-extra/test/clang-tidy/misc-swapped-arguments.cpp @@ -1,4 +1,4 @@ -// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s misc-swapped-arguments %t +// RUN: $(dirname %s)/check_clang_tidy.sh %s misc-swapped-arguments %t // REQUIRES: shell void F(int, double); diff --git a/clang-tools-extra/test/clang-tidy/misc-undelegated-constructor.cpp b/clang-tools-extra/test/clang-tidy/misc-undelegated-constructor.cpp index 09d683b8e755..7bed88aea71e 100644 --- a/clang-tools-extra/test/clang-tidy/misc-undelegated-constructor.cpp +++ b/clang-tools-extra/test/clang-tidy/misc-undelegated-constructor.cpp @@ -1,4 +1,5 @@ -// RUN: clang-tidy -checks='-*,misc-undelegated-constructor' %s -- -std=c++11 2>&1 | FileCheck %s -implicit-check-not='{{warning:|error:}}' +// RUN: $(dirname %s)/check_clang_tidy.sh %s misc-undelegated-constructor %t +// REQUIRES: shell struct Ctor; Ctor foo(); @@ -9,18 +10,18 @@ struct Ctor { Ctor(int, int); Ctor(Ctor *i) { Ctor(); -// CHECK: :[[@LINE-1]]:5: warning: did you intend to call a delegated constructor? A temporary object is created here instead +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: did you intend to call a delegated constructor? A temporary object is created here instead [misc-undelegated-constructor] Ctor(0); -// CHECK: :[[@LINE-1]]:5: warning: did you intend to call a delegated constructor? A temporary object is created here instead +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: did you intend to call a delegated constructor? Ctor(1, 2); -// CHECK: :[[@LINE-1]]:5: warning: did you intend to call a delegated constructor? A temporary object is created here instead +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: did you intend to call a delegated constructor? foo(); } }; Ctor::Ctor() { Ctor(1); -// CHECK: :[[@LINE-1]]:3: warning: did you intend to call a delegated constructor? A temporary object is created here instead +// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: did you intend to call a delegated constructor? } Ctor::Ctor(int i) : Ctor(i, 1) {} // properly delegated. @@ -31,11 +32,11 @@ struct Dtor { Dtor(int, int); Dtor(Ctor *i) { Dtor(); -// CHECK: :[[@LINE-1]]:5: warning: did you intend to call a delegated constructor? A temporary object is created here instead +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: did you intend to call a delegated constructor? Dtor(0); -// CHECK: :[[@LINE-1]]:5: warning: did you intend to call a delegated constructor? A temporary object is created here instead +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: did you intend to call a delegated constructor? Dtor(1, 2); -// CHECK: :[[@LINE-1]]:5: warning: did you intend to call a delegated constructor? A temporary object is created here instead +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: did you intend to call a delegated constructor? } ~Dtor(); }; @@ -43,7 +44,7 @@ struct Dtor { struct Base {}; struct Derived : public Base { Derived() { Base(); } -// CHECK: :[[@LINE-1]]:15: warning: did you intend to call a delegated constructor? A temporary object is created here instead +// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: did you intend to call a delegated constructor? }; template diff --git a/clang-tools-extra/test/clang-tidy/misc-unused-raii.cpp b/clang-tools-extra/test/clang-tidy/misc-unused-raii.cpp index e32410fbcc9f..89086b7623e9 100644 --- a/clang-tools-extra/test/clang-tidy/misc-unused-raii.cpp +++ b/clang-tools-extra/test/clang-tidy/misc-unused-raii.cpp @@ -1,4 +1,4 @@ -// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s misc-unused-raii %t +// RUN: $(dirname %s)/check_clang_tidy.sh %s misc-unused-raii %t // REQUIRES: shell struct Foo { diff --git a/clang-tools-extra/test/clang-tidy/misc-use-override.cpp b/clang-tools-extra/test/clang-tidy/misc-use-override.cpp index 63739ad4223a..ade067fef53f 100644 --- a/clang-tools-extra/test/clang-tidy/misc-use-override.cpp +++ b/clang-tools-extra/test/clang-tidy/misc-use-override.cpp @@ -1,4 +1,4 @@ -// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s misc-use-override %t +// RUN: $(dirname %s)/check_clang_tidy.sh %s misc-use-override %t // REQUIRES: shell #define ABSTRACT = 0 diff --git a/clang-tools-extra/test/clang-tidy/readability-braces-around-statements-few-lines.cpp b/clang-tools-extra/test/clang-tidy/readability-braces-around-statements-few-lines.cpp index d4a878104e9f..acf0c15481ee 100644 --- a/clang-tools-extra/test/clang-tidy/readability-braces-around-statements-few-lines.cpp +++ b/clang-tools-extra/test/clang-tidy/readability-braces-around-statements-few-lines.cpp @@ -1,4 +1,4 @@ -// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s readability-braces-around-statements %t -config="{CheckOptions: [{key: readability-braces-around-statements.ShortStatementLines, value: 4}]}" -- +// RUN: $(dirname %s)/check_clang_tidy.sh %s readability-braces-around-statements %t -config="{CheckOptions: [{key: readability-braces-around-statements.ShortStatementLines, value: 4}]}" -- // REQUIRES: shell void do_something(const char *) {} diff --git a/clang-tools-extra/test/clang-tidy/readability-braces-around-statements-same-line.cpp b/clang-tools-extra/test/clang-tidy/readability-braces-around-statements-same-line.cpp index a4a32ca44db7..a821ac770d72 100644 --- a/clang-tools-extra/test/clang-tidy/readability-braces-around-statements-same-line.cpp +++ b/clang-tools-extra/test/clang-tidy/readability-braces-around-statements-same-line.cpp @@ -1,4 +1,4 @@ -// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s readability-braces-around-statements %t -config="{CheckOptions: [{key: readability-braces-around-statements.ShortStatementLines, value: 1}]}" -- +// RUN: $(dirname %s)/check_clang_tidy.sh %s readability-braces-around-statements %t -config="{CheckOptions: [{key: readability-braces-around-statements.ShortStatementLines, value: 1}]}" -- // REQUIRES: shell void do_something(const char *) {} diff --git a/clang-tools-extra/test/clang-tidy/readability-braces-around-statements-single-line.cpp b/clang-tools-extra/test/clang-tidy/readability-braces-around-statements-single-line.cpp index a9bf1416c042..1547ef0c739a 100644 --- a/clang-tools-extra/test/clang-tidy/readability-braces-around-statements-single-line.cpp +++ b/clang-tools-extra/test/clang-tidy/readability-braces-around-statements-single-line.cpp @@ -1,4 +1,4 @@ -// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s readability-braces-around-statements %t -config="{CheckOptions: [{key: readability-braces-around-statements.ShortStatementLines, value: 2}]}" -- +// RUN: $(dirname %s)/check_clang_tidy.sh %s readability-braces-around-statements %t -config="{CheckOptions: [{key: readability-braces-around-statements.ShortStatementLines, value: 2}]}" -- // REQUIRES: shell void do_something(const char *) {} diff --git a/clang-tools-extra/test/clang-tidy/readability-braces-around-statements.cpp b/clang-tools-extra/test/clang-tidy/readability-braces-around-statements.cpp index 97bd05b9a28d..110adbc00203 100644 --- a/clang-tools-extra/test/clang-tidy/readability-braces-around-statements.cpp +++ b/clang-tools-extra/test/clang-tidy/readability-braces-around-statements.cpp @@ -1,4 +1,4 @@ -// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s readability-braces-around-statements %t +// RUN: $(dirname %s)/check_clang_tidy.sh %s readability-braces-around-statements %t // REQUIRES: shell void do_something(const char *) {} diff --git a/clang-tools-extra/test/clang-tidy/readability-function-size.cpp b/clang-tools-extra/test/clang-tidy/readability-function-size.cpp index 526e272de7f1..53a3928157f1 100644 --- a/clang-tools-extra/test/clang-tidy/readability-function-size.cpp +++ b/clang-tools-extra/test/clang-tidy/readability-function-size.cpp @@ -1,58 +1,55 @@ -// RUN: rm -rf %t -// RUN: mkdir -p %t -// RUN: sed 's#// *[A-Z-][A-Z-]*:.*#//#' %s > %t/t.cpp -// RUN: echo '{ Checks: "-*,readability-function-size", CheckOptions: [{key: readability-function-size.LineThreshold, value: 0}, {key: readability-function-size.StatementThreshold, value: 0}, {key: readability-function-size.BranchThreshold, value: 0}]}' > %t/.clang-tidy -// RUN: clang-tidy %t/t.cpp -- -std=c++11 2>&1 | FileCheck %s -implicit-check-not='{{warning:|error:|note:}}' +// RUN: $(dirname %s)/check_clang_tidy.sh %s readability-function-size %t -config='{CheckOptions: [{key: readability-function-size.LineThreshold, value: 0}, {key: readability-function-size.StatementThreshold, value: 0}, {key: readability-function-size.BranchThreshold, value: 0}]}' -- -std=c++11 +// REQUIRES: shell void foo1() { } void foo2() {;} -// CHECK: warning: function 'foo2' exceeds recommended size/complexity thresholds -// CHECK: note: 1 statements (threshold 0) +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'foo2' exceeds recommended size/complexity thresholds [readability-function-size] +// CHECK-MESSAGES: :[[@LINE-2]]:6: note: 1 statements (threshold 0) void foo3() { ; } -// CHECK: warning: function 'foo3' exceeds recommended size/complexity thresholds -// CHECK: note: 3 lines including whitespace and comments (threshold 0) -// CHECK: note: 1 statements (threshold 0) +// CHECK-MESSAGES: :[[@LINE-4]]:6: warning: function 'foo3' exceeds recommended size/complexity +// CHECK-MESSAGES: :[[@LINE-5]]:6: note: 3 lines including whitespace and comments (threshold 0) +// CHECK-MESSAGES: :[[@LINE-6]]:6: note: 1 statements (threshold 0) void foo4(int i) { if (i) {} else; {} } -// CHECK: warning: function 'foo4' exceeds recommended size/complexity thresholds -// CHECK: note: 1 lines including whitespace and comments (threshold 0) -// CHECK: note: 3 statements (threshold 0) -// CHECK: note: 1 branches (threshold 0) +// CHECK-MESSAGES: :[[@LINE-2]]:6: warning: function 'foo4' exceeds recommended size/complexity +// CHECK-MESSAGES: :[[@LINE-3]]:6: note: 1 lines including whitespace and comments (threshold 0) +// CHECK-MESSAGES: :[[@LINE-4]]:6: note: 3 statements (threshold 0) +// CHECK-MESSAGES: :[[@LINE-5]]:6: note: 1 branches (threshold 0) void foo5(int i) {for(;i;)while(i) do;while(i); } -// CHECK: warning: function 'foo5' exceeds recommended size/complexity thresholds -// CHECK: note: 2 lines including whitespace and comments (threshold 0) -// CHECK: note: 7 statements (threshold 0) -// CHECK: note: 3 branches (threshold 0) +// CHECK-MESSAGES: :[[@LINE-3]]:6: warning: function 'foo5' exceeds recommended size/complexity +// CHECK-MESSAGES: :[[@LINE-4]]:6: note: 2 lines including whitespace and comments (threshold 0) +// CHECK-MESSAGES: :[[@LINE-5]]:6: note: 7 statements (threshold 0) +// CHECK-MESSAGES: :[[@LINE-6]]:6: note: 3 branches (threshold 0) template T foo6(T i) {return i; } int x = foo6(0); -// CHECK: warning: function 'foo6' exceeds recommended size/complexity thresholds -// CHECK: note: 1 lines including whitespace and comments (threshold 0) -// CHECK: note: 1 statements (threshold 0) +// CHECK-MESSAGES: :[[@LINE-3]]:25: warning: function 'foo6' exceeds recommended size/complexity +// CHECK-MESSAGES: :[[@LINE-4]]:25: note: 1 lines including whitespace and comments (threshold 0) +// CHECK-MESSAGES: :[[@LINE-5]]:25: note: 1 statements (threshold 0) void bar1() { [](){;;;;;;;;;;;if(1){}}(); } -// CHECK: warning: function 'bar1' exceeds recommended size/complexity thresholds -// CHECK: note: 3 lines including whitespace and comments (threshold 0) -// CHECK: note: 14 statements (threshold 0) -// CHECK: note: 1 branches (threshold 0) +// CHECK-MESSAGES: :[[@LINE-4]]:6: warning: function 'bar1' exceeds recommended size/complexity +// CHECK-MESSAGES: :[[@LINE-5]]:6: note: 3 lines including whitespace and comments (threshold 0) +// CHECK-MESSAGES: :[[@LINE-6]]:6: note: 14 statements (threshold 0) +// CHECK-MESSAGES: :[[@LINE-7]]:6: note: 1 branches (threshold 0) void bar2() { class A { void barx() {;;} }; } -// CHECK: warning: function 'bar2' exceeds recommended size/complexity thresholds -// CHECK: note: 3 statements (threshold 0) +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'bar2' exceeds recommended size/complexity +// CHECK-MESSAGES: :[[@LINE-2]]:6: note: 3 statements (threshold 0) // -// CHECK: warning: function 'barx' exceeds recommended size/complexity thresholds -// CHECK: note: 2 statements (threshold 0) +// CHECK-MESSAGES: :[[@LINE-4]]:30: warning: function 'barx' exceeds recommended size/complexity +// CHECK-MESSAGES: :[[@LINE-5]]:30: note: 2 statements (threshold 0) diff --git a/clang-tools-extra/test/clang-tidy/readability-redundant-smartptr-get.cpp b/clang-tools-extra/test/clang-tidy/readability-redundant-smartptr-get.cpp index c69e1fa39c58..ef3c47f1e5f4 100644 --- a/clang-tools-extra/test/clang-tidy/readability-redundant-smartptr-get.cpp +++ b/clang-tools-extra/test/clang-tidy/readability-redundant-smartptr-get.cpp @@ -1,4 +1,4 @@ -// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s readability-redundant-smartptr-get %t +// RUN: $(dirname %s)/check_clang_tidy.sh %s readability-redundant-smartptr-get %t // REQUIRES: shell #define NULL __null