Author: alexfh Date: Fri Sep 26 07:44:30 2014 New Revision: 218515 URL: http://llvm.org/viewvc/llvm-project?rev=218515&view=rev Log: [clang-tidy] Test username substitution in TODO() check.
Summary: This patch depends on D5501. Check user name substitution more specifically by specifying it via the new -config= option. This also lets clang-tidy tests specify clang-tidy options before the '--' when using check_clang_tidy_fix.sh. Reviewers: klimek Reviewed By: klimek Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D5502 Modified: clang-tools-extra/trunk/test/clang-tidy/avoid-c-style-casts.c clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy_fix.sh clang-tools-extra/trunk/test/clang-tidy/google-readability-todo.cpp clang-tools-extra/trunk/test/clang-tidy/llvm-include-order.cpp Modified: clang-tools-extra/trunk/test/clang-tidy/avoid-c-style-casts.c URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/avoid-c-style-casts.c?rev=218515&r1=218514&r2=218515&view=diff ============================================================================== --- clang-tools-extra/trunk/test/clang-tidy/avoid-c-style-casts.c (original) +++ clang-tools-extra/trunk/test/clang-tidy/avoid-c-style-casts.c Fri Sep 26 07:44:30 2014 @@ -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_fix.sh %s google-readability-casting %t -- -x c // REQUIRES: shell void f(const char *cpc) { Modified: clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy_fix.sh URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy_fix.sh?rev=218515&r1=218514&r2=218515&view=diff ============================================================================== --- clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy_fix.sh (original) +++ clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy_fix.sh Fri Sep 26 07:44:30 2014 @@ -6,17 +6,17 @@ # [optional compiler arguments] # # Example: -# // RUN: $(dirname %s)/check_clang_tidy_fix.sh %s llvm-include-order %t -isystem $(dirname %s)/Inputs/Headers +# // 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 after --. +# Feed the rest arguments to clang-tidy. shift 3 -CLANG_TIDY_ARGS=--std=c++11 -if [ "$#" -gt 0 ] ; then - CLANG_TIDY_ARGS=$* +if [ "$#" -eq 0 ] ; then + # Default to -- --std=c++11 + set - -- --std=c++11 fi set -o errexit @@ -26,8 +26,8 @@ set -o errexit # 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}" \ - -- ${CLANG_TIDY_ARGS} > ${TEMPORARY_FILE}.msg 2>&1 +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 Modified: clang-tools-extra/trunk/test/clang-tidy/google-readability-todo.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/google-readability-todo.cpp?rev=218515&r1=218514&r2=218515&view=diff ============================================================================== --- clang-tools-extra/trunk/test/clang-tidy/google-readability-todo.cpp (original) +++ clang-tools-extra/trunk/test/clang-tidy/google-readability-todo.cpp Fri Sep 26 07:44:30 2014 @@ -1,21 +1,21 @@ -// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s google-readability-todo %t +// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s google-readability-todo %t -config="{User: 'some user'}" -- // REQUIRES: shell // TODOfix this1 // CHECK-MESSAGES: [[@LINE-1]]:1: warning: missing username/bug in TODO -// CHECK-FIXES: // TODO({{[^)]+}}): fix this1 +// CHECK-FIXES: // TODO(some user): fix this1 // TODO fix this2 // CHECK-MESSAGES: [[@LINE-1]]:1: warning: missing username/bug in TODO -// CHECK-FIXES: // TODO({{[^)]+}}): fix this2 +// CHECK-FIXES: // TODO(some user): fix this2 // TODO fix this3 // CHECK-MESSAGES: [[@LINE-1]]:1: warning: missing username/bug in TODO -// CHECK-FIXES: // TODO({{[^)]+}}): fix this3 +// CHECK-FIXES: // TODO(some user): fix this3 // TODO: fix this4 // CHECK-MESSAGES: [[@LINE-1]]:1: warning: missing username/bug in TODO -// CHECK-FIXES: // TODO({{[^)]+}}): fix this4 +// CHECK-FIXES: // TODO(some user): fix this4 // TODO(clang)fix this5 Modified: clang-tools-extra/trunk/test/clang-tidy/llvm-include-order.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/llvm-include-order.cpp?rev=218515&r1=218514&r2=218515&view=diff ============================================================================== --- clang-tools-extra/trunk/test/clang-tidy/llvm-include-order.cpp (original) +++ clang-tools-extra/trunk/test/clang-tidy/llvm-include-order.cpp Fri Sep 26 07:44:30 2014 @@ -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_fix.sh %s llvm-include-order %t -- -isystem %S/Inputs/Headers // REQUIRES: shell // FIXME: Investigating. _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
