[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

llvm-svn: 218515
This commit is contained in:
Alexander Kornienko 2014-09-26 12:44:30 +00:00
parent 82d5c5139f
commit 761c25bc15
4 changed files with 14 additions and 14 deletions

View File

@ -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) {

View File

@ -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

View File

@ -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

View File

@ -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.