-// RUN: %python %S/check_clang_tidy.py %s cert-err52-cpp %t -- -std=c++11
+// RUN: %check_clang_tidy %s cert-err52-cpp %t -- -std=c++11
typedef void *jmp_buf;
extern int __setjmpimpl(jmp_buf);
-// RUN: %python %S/check_clang_tidy.py %s cert-dcl50-cpp %t
+// RUN: %check_clang_tidy %s cert-dcl50-cpp %t
// Variadic function definitions are diagnosed.
void f1(int, ...) {}
[optional clang-tidy arguments]
Example:
- // RUN: %python %S/check_clang_tidy.py %s llvm-include-order %t -- -isystem $(dirname %s)/Inputs/Headers
+ // RUN: %check_clang_tidy %s llvm-include-order %t -- -isystem $(dirname %s)/Inputs/Headers
"""
import re
// RUN: sed 's/placeholder_for_f/f/' %s > %t.cpp
// RUN: clang-tidy -checks=-*,modernize-use-override %t.cpp -- -std=c++11 | FileCheck -check-prefix=CHECK-SANITY %s
-// RUN: not diff -U0 %s %t.cpp | %python %S/../../clang-tidy/tool/clang-tidy-diff.py -checks=-*,modernize-use-override -- -std=c++11 2>&1 | FileCheck %s
+// RUN: not diff -U0 %s %t.cpp | %clang_tidy_diff -checks=-*,modernize-use-override -- -std=c++11 2>&1 | FileCheck %s
struct A {
virtual void f() {}
virtual void g() {}
-// RUN: %python %S/check_clang_tidy.py %s cppcoreguidelines-pro-bounds-pointer-arithmetic %t
+// RUN: %check_clang_tidy %s cppcoreguidelines-pro-bounds-pointer-arithmetic %t
enum E {
ENUM_LITERAL = 1
-// RUN: %python %S/check_clang_tidy.py %s cppcoreguidelines-pro-type-const-cast %t
+// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-const-cast %t
const int *i;
int *j;
-// RUN: %python %S/check_clang_tidy.py %s cppcoreguidelines-pro-type-reinterpret-cast %t
+// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-reinterpret-cast %t
int i = 0;
void *j;
-// RUN: %python %S/check_clang_tidy.py %s cppcoreguidelines-pro-type-static-cast-downcast %t
+// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-static-cast-downcast %t
class Base {
};
-// RUN: %python %S/check_clang_tidy.py %s cppcoreguidelines-pro-type-union-access %t
+// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-union-access %t
union U {
bool union_member1;
-// RUN: %python %S/check_clang_tidy.py %s cppcoreguidelines-pro-type-vararg %t
+// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-vararg %t
void f(int i);
void f_vararg(int i, ...);
-// RUN: %python %S/check_clang_tidy.py %s google-build-explicit-make-pair %t
+// RUN: %check_clang_tidy %s google-build-explicit-make-pair %t
namespace std {
template <class T1, class T2>
-// RUN: %python %S/check_clang_tidy.py %s google-explicit-constructor %t
+// RUN: %check_clang_tidy %s google-explicit-constructor %t
namespace std {
typedef decltype(sizeof(int)) size_t;
-// RUN: %python %S/check_clang_tidy.py %s google-runtime-operator %t
+// RUN: %check_clang_tidy %s google-runtime-operator %t
struct Foo {
void *operator&();
-// RUN: %python %S/check_clang_tidy.py %s google-readability-casting %t -- -x c
+// RUN: %check_clang_tidy %s google-readability-casting %t -- -x c
// The testing script always adds .cpp extension to the input file name, so we
// need to run clang-tidy directly in order to verify handling of .c files:
// RUN: clang-tidy --checks=-*,google-readability-casting %s -- -x c++ | FileCheck %s -check-prefix=CHECK-MESSAGES -implicit-check-not='{{warning|error}}:'
-// RUN: %python %S/check_clang_tidy.py %s google-readability-casting %t
+// RUN: %check_clang_tidy %s google-readability-casting %t
bool g() { return false; }
-// RUN: %python %S/check_clang_tidy.py %s google-readability-namespace-comments %t
+// RUN: %check_clang_tidy %s google-readability-namespace-comments %t
namespace n1 {
namespace n2 {
-// RUN: %python %S/check_clang_tidy.py %s google-readability-todo %t -config="{User: 'some user'}" --
+// RUN: %check_clang_tidy %s google-readability-todo %t -config="{User: 'some user'}" --
// TODOfix this1
// CHECK-MESSAGES: [[@LINE-1]]:1: warning: missing username/bug in TODO
-// RUN: %python %S/check_clang_tidy.py %s google-runtime-int %t \
+// RUN: %check_clang_tidy %s google-runtime-int %t \
// RUN: -config='{CheckOptions: [ \
// RUN: {key: google-runtime-int.UnsignedTypePrefix, value: "std::uint"}, \
// RUN: {key: google-runtime-int.SignedTypePrefix, value: "std::int"}, \
-// RUN: %python %S/check_clang_tidy.py %s google-runtime-int %t
+// RUN: %check_clang_tidy %s google-runtime-int %t
long a();
// CHECK-MESSAGES: [[@LINE-1]]:1: warning: consider replacing 'long' with 'int{{..}}'
-// RUN: %python %S/check_clang_tidy.py %s google-runtime-member-string-references %t
+// RUN: %check_clang_tidy %s google-runtime-member-string-references %t
namespace std {
template<typename T>
-// RUN: %python %S/check_clang_tidy.py %s google-runtime-memset %t
+// RUN: %check_clang_tidy %s google-runtime-memset %t
void *memset(void *, int, __SIZE_TYPE__);
-// RUN: %python %S/check_clang_tidy.py %s llvm-include-order %t -- -isystem %S/Inputs/Headers
+// RUN: %check_clang_tidy %s llvm-include-order %t -- -isystem %S/Inputs/Headers
// CHECK-MESSAGES: [[@LINE+2]]:1: warning: #includes are not sorted properly
#include "j.h"
-// RUN: %python %S/check_clang_tidy.py %s llvm-twine-local %t
+// RUN: %check_clang_tidy %s llvm-twine-local %t
namespace llvm {
class Twine {
-// RUN: %python %S/check_clang_tidy.py %s misc-argument-comment %t
+// RUN: %check_clang_tidy %s misc-argument-comment %t
// FIXME: clang-tidy should provide a -verify mode to make writing these checks
// easier and more accurate.
-// RUN: %python %S/check_clang_tidy.py %s misc-assert-side-effect %t -config="{CheckOptions: [{key: misc-assert-side-effect.CheckFunctionCalls, value: 1}, {key: misc-assert-side-effect.AssertMacros, value: 'assert,assert2,my_assert,convoluted_assert'}]}" -- -fexceptions
+// RUN: %check_clang_tidy %s misc-assert-side-effect %t -config="{CheckOptions: [{key: misc-assert-side-effect.CheckFunctionCalls, value: 1}, {key: misc-assert-side-effect.AssertMacros, value: 'assert,assert2,my_assert,convoluted_assert'}]}" -- -fexceptions
//===--- assert definition block ------------------------------------------===//
int abort() { return 0; }
-// RUN: %python %S/check_clang_tidy.py %s misc-assign-operator-signature %t
+// RUN: %check_clang_tidy %s misc-assign-operator-signature %t
struct Good {
Good& operator=(const Good&);
-// RUN: %python %S/check_clang_tidy.py %s misc-bool-pointer-implicit-conversion %t
+// RUN: %check_clang_tidy %s misc-bool-pointer-implicit-conversion %t
bool *SomeFunction();
void SomeOtherFunction(bool*);
-// RUN: %python %S/check_clang_tidy.py %s misc-inaccurate-erase %t
+// RUN: %check_clang_tidy %s misc-inaccurate-erase %t
namespace std {
template <typename T> struct vec_iterator {
-// RUN: %python %S/check_clang_tidy.py %s misc-inefficient-algorithm %t
+// RUN: %check_clang_tidy %s misc-inefficient-algorithm %t
namespace std {
template <typename T> struct less {
-// RUN: %python %S/check_clang_tidy.py %s misc-macro-parentheses %t
+// RUN: %check_clang_tidy %s misc-macro-parentheses %t
#define BAD1 -1
// CHECK-MESSAGES: :[[@LINE-1]]:27: warning: macro replacement list should be enclosed in parentheses [misc-macro-parentheses]
-// RUN: %python %S/check_clang_tidy.py %s misc-move-constructor-init %t -- -std=c++11 -isystem %S/Inputs/Headers
+// RUN: %check_clang_tidy %s misc-move-constructor-init %t -- -std=c++11 -isystem %S/Inputs/Headers
#include <s.h>
-// RUN: %python %S/check_clang_tidy.py %s misc-new-delete-overloads %t -- -std=c++14 -fsized-deallocation
+// RUN: %check_clang_tidy %s misc-new-delete-overloads %t -- -std=c++14 -fsized-deallocation
typedef decltype(sizeof(int)) size_t;
-// RUN: %python %S/check_clang_tidy.py %s misc-new-delete-overloads %t -- -std=c++14
+// RUN: %check_clang_tidy %s misc-new-delete-overloads %t -- -std=c++14
typedef decltype(sizeof(int)) size_t;
-// RUN: %python %S/check_clang_tidy.py %s misc-noexcept-move-constructor %t
+// RUN: %check_clang_tidy %s misc-noexcept-move-constructor %t
class A {
A(A &&);
-// RUN: %python %S/check_clang_tidy.py %s misc-non-copyable-objects %t\r
+// RUN: %check_clang_tidy %s misc-non-copyable-objects %t\r
\r
typedef struct FILE {} FILE;\r
typedef struct pthread_cond_t {} pthread_cond_t;\r
-// RUN: %python %S/check_clang_tidy.py %s misc-non-copyable-objects %t
+// RUN: %check_clang_tidy %s misc-non-copyable-objects %t
namespace std {
typedef struct FILE {} FILE;
-// RUN: %python %S/check_clang_tidy.py %s misc-macro-repeated-side-effects %t
+// RUN: %check_clang_tidy %s misc-macro-repeated-side-effects %t
#define badA(x,y) ((x)+((x)+(y))+(y))
void bad(int ret, int a, int b) {
-// RUN: %python %S/check_clang_tidy.py %s misc-sizeof-container %t -- -std=c++11 -target x86_64-unknown-unknown
+// RUN: %check_clang_tidy %s misc-sizeof-container %t -- -std=c++11 -target x86_64-unknown-unknown
namespace std {
-// RUN: %python %S/check_clang_tidy.py %s misc-static-assert %t -- -std=c11\r
+// RUN: %check_clang_tidy %s misc-static-assert %t -- -std=c11\r
// RUN: clang-tidy %s -checks=-*,misc-static-assert -- -std=c99 | count 0\r
\r
void abort() {}\r
-// RUN: %python %S/check_clang_tidy.py %s misc-static-assert %t
+// RUN: %check_clang_tidy %s misc-static-assert %t
void abort() {}
#ifdef NDEBUG
-// RUN: %python %S/check_clang_tidy.py %s misc-swapped-arguments %t
+// RUN: %check_clang_tidy %s misc-swapped-arguments %t
void F(int, double);
-// RUN: %python %S/check_clang_tidy.py %s misc-throw-by-value-catch-by-reference %t -- -std=c++11 -fcxx-exceptions
+// RUN: %check_clang_tidy %s misc-throw-by-value-catch-by-reference %t -- -std=c++11 -fcxx-exceptions
class logic_error {
-// RUN: %python %S/check_clang_tidy.py %s misc-undelegated-constructor %t
+// RUN: %check_clang_tidy %s misc-undelegated-constructor %t
struct Ctor;
Ctor foo();
-// RUN: %python %S/check_clang_tidy.py %s misc-uniqueptr-reset-release %t
+// RUN: %check_clang_tidy %s misc-uniqueptr-reset-release %t
namespace std {
-// RUN: %python %S/check_clang_tidy.py %s misc-unused-alias-decls %t
+// RUN: %check_clang_tidy %s misc-unused-alias-decls %t
namespace my_namespace {
class C {};
-// RUN: %python %S/check_clang_tidy.py %s misc-unused-parameters %t -- -xc
+// RUN: %check_clang_tidy %s misc-unused-parameters %t -- -xc
// Basic removal
// =============
// RUN: echo "static void staticFunctionHeader(int i) {}" > %T/header.h
// RUN: echo "static void staticFunctionHeader(int /*i*/) {}" > %T/header-fixed.h
-// RUN: %python %S/check_clang_tidy.py %s misc-unused-parameters %t -header-filter='.*' -- -std=c++11 -fno-delayed-template-parsing
+// RUN: %check_clang_tidy %s misc-unused-parameters %t -header-filter='.*' -- -std=c++11 -fno-delayed-template-parsing
// RUN: diff %T/header.h %T/header-fixed.h
#include "header.h"
-// RUN: %python %S/check_clang_tidy.py %s misc-unused-raii %t
+// RUN: %check_clang_tidy %s misc-unused-raii %t
struct Foo {
Foo();
-// RUN: %python %S/check_clang_tidy.py %s modernize-loop-convert %t -- -std=c++11 -I %S/Inputs/modernize-loop-convert
+// RUN: %check_clang_tidy %s modernize-loop-convert %t -- -std=c++11 -I %S/Inputs/modernize-loop-convert
#include "structures.h"
-// RUN: %python %S/check_clang_tidy.py %s modernize-loop-convert %t \
+// RUN: %check_clang_tidy %s modernize-loop-convert %t \
// RUN: -config="{CheckOptions: [{key: modernize-loop-convert.NamingStyle, value: 'camelBack'}]}" \
// RUN: -- -std=c++11 -I %S/Inputs/modernize-loop-convert
-// RUN: %python %S/check_clang_tidy.py %s modernize-loop-convert %t -- -std=c++11 -I %S/Inputs/modernize-loop-convert
+// RUN: %check_clang_tidy %s modernize-loop-convert %t -- -std=c++11 -I %S/Inputs/modernize-loop-convert
#include "structures.h"
-// RUN: %python %S/check_clang_tidy.py %s modernize-loop-convert %t \
+// RUN: %check_clang_tidy %s modernize-loop-convert %t \
// RUN: -config="{CheckOptions: [{key: modernize-loop-convert.NamingStyle, value: 'lower_case'}]}" \
// RUN: -- -std=c++11 -I %S/Inputs/modernize-loop-convert
-// RUN: %python %S/check_clang_tidy.py %s modernize-loop-convert %t -- -std=c++11 -I %S/Inputs/modernize-loop-convert
+// RUN: %check_clang_tidy %s modernize-loop-convert %t -- -std=c++11 -I %S/Inputs/modernize-loop-convert
#include "structures.h"
-// RUN: %python %S/check_clang_tidy.py %s modernize-loop-convert %t \
+// RUN: %check_clang_tidy %s modernize-loop-convert %t \
// RUN: -config="{CheckOptions: [{key: modernize-loop-convert.NamingStyle, value: 'UPPER_CASE'}]}" \
// RUN: -- -std=c++11 -I %S/Inputs/modernize-loop-convert
-// RUN: %python %S/check_clang_tidy.py %s modernize-make-unique %t
+// RUN: %check_clang_tidy %s modernize-make-unique %t
namespace std {
-// RUN: %python %S/check_clang_tidy.py %s modernize-pass-by-value %t -- -std=c++11 -fno-delayed-template-parsing
+// RUN: %check_clang_tidy %s modernize-pass-by-value %t -- -std=c++11 -fno-delayed-template-parsing
// CHECK-FIXES: #include <utility>
-// RUN: %python %S/check_clang_tidy.py %s modernize-replace-auto-ptr %t -- \
+// RUN: %check_clang_tidy %s modernize-replace-auto-ptr %t -- \
// RUN: -std=c++11 -I %S/Inputs/modernize-replace-auto-ptr
// CHECK-FIXES: #include <utility>
-// RUN: %python %S/check_clang_tidy.py %s modernize-shrink-to-fit %t
+// RUN: %check_clang_tidy %s modernize-shrink-to-fit %t
namespace std {
template <typename T> struct vector { void swap(vector &other); };
-// RUN: %python %S/check_clang_tidy.py %s modernize-use-auto %t -- \
+// RUN: %check_clang_tidy %s modernize-use-auto %t -- \
// RUN: -std=c++11 -I %S/Inputs/modernize-use-auto
#include "containers.h"
-// RUN: %python %S/check_clang_tidy.py %s modernize-use-auto %t
+// RUN: %check_clang_tidy %s modernize-use-auto %t
class MyType {};
-// RUN: %python %S/check_clang_tidy.py %s modernize-use-default %t -- -std=c++11 -fno-delayed-template-parsing
+// RUN: %check_clang_tidy %s modernize-use-default %t -- -std=c++11 -fno-delayed-template-parsing
class A {
public:
-// RUN: %python %S/check_clang_tidy.py %s modernize-use-nullptr %t -- \
+// RUN: %check_clang_tidy %s modernize-use-nullptr %t -- \
// RUN: -std=c++98 -Wno-non-literal-null-conversion
//
// Some parts of the test (e.g. assignment of `const int` to `int *`) fail in
-// RUN: %python %S/check_clang_tidy.py %s modernize-use-nullptr %t \
+// RUN: %check_clang_tidy %s modernize-use-nullptr %t \
// RUN: -config="{CheckOptions: [{key: modernize-use-nullptr.NullMacros, value: 'MY_NULL,NULL'}]}" \
// RUN: -- -std=c++11
-// RUN: %python %S/check_clang_tidy.py %s modernize-use-override %t -- -std=c++98
+// RUN: %check_clang_tidy %s modernize-use-override %t -- -std=c++98
struct Base {
virtual ~Base() {}
-// RUN: %python %S/check_clang_tidy.py %s modernize-use-override %t
+// RUN: %check_clang_tidy %s modernize-use-override %t
#define ABSTRACT = 0
-// RUN: %python %S/check_clang_tidy.py %s readability-braces-around-statements %t -config="{CheckOptions: [{key: readability-braces-around-statements.ShortStatementLines, value: 4}]}" --
+// RUN: %check_clang_tidy %s readability-braces-around-statements %t -config="{CheckOptions: [{key: readability-braces-around-statements.ShortStatementLines, value: 4}]}" --
void do_something(const char *) {}
-// RUN: %python %S/check_clang_tidy.py %s readability-braces-around-statements %t -config="{CheckOptions: [{key: readability-braces-around-statements.ShortStatementLines, value: 1}]}" --
+// RUN: %check_clang_tidy %s readability-braces-around-statements %t -config="{CheckOptions: [{key: readability-braces-around-statements.ShortStatementLines, value: 1}]}" --
void do_something(const char *) {}
-// RUN: %python %S/check_clang_tidy.py %s readability-braces-around-statements %t -config="{CheckOptions: [{key: readability-braces-around-statements.ShortStatementLines, value: 2}]}" --
+// RUN: %check_clang_tidy %s readability-braces-around-statements %t -config="{CheckOptions: [{key: readability-braces-around-statements.ShortStatementLines, value: 2}]}" --
void do_something(const char *) {}
-// RUN: %python %S/check_clang_tidy.py %s readability-braces-around-statements %t
+// RUN: %check_clang_tidy %s readability-braces-around-statements %t
void do_something(const char *) {}
-// RUN: %python %S/check_clang_tidy.py %s readability-container-size-empty %t
+// RUN: %check_clang_tidy %s readability-container-size-empty %t
namespace std {
template <typename T> struct vector {
-// RUN: %python %S/check_clang_tidy.py %s readability-else-after-return %t
+// RUN: %check_clang_tidy %s readability-else-after-return %t
void f(int a) {
if (a > 0)
-// RUN: %python %S/check_clang_tidy.py %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
+// RUN: %check_clang_tidy %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
void foo1() {
}
-// RUN: %python %S/check_clang_tidy.py %s readability-identifier-naming %t \
+// RUN: %check_clang_tidy %s readability-identifier-naming %t \
// RUN: -config='{CheckOptions: [ \
// RUN: {key: readability-identifier-naming.AbstractClassCase, value: CamelCase}, \
// RUN: {key: readability-identifier-naming.AbstractClassPrefix, value: 'A'}, \
-// RUN: %python %S/check_clang_tidy.py %s readability-inconsistent-declaration-parameter-name %t -- -std=c++11 -fno-delayed-template-parsing
+// RUN: %check_clang_tidy %s readability-inconsistent-declaration-parameter-name %t -- -std=c++11 -fno-delayed-template-parsing
void consistentFunction(int a, int b, int c);
void consistentFunction(int a, int b, int c);
-// RUN: %python %S/check_clang_tidy.py %s readability-named-parameter %t
+// RUN: %check_clang_tidy %s readability-named-parameter %t
void Method(char *) { /* */ }
// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: all parameters should be named in a function
-// RUN: %python %S/check_clang_tidy.py %s readability-redundant-smartptr-get %t
+// RUN: %check_clang_tidy %s readability-redundant-smartptr-get %t
#define NULL __null
-// RUN: %python %S/check_clang_tidy.py %s readability-redundant-string-cstr %t
+// RUN: %check_clang_tidy %s readability-redundant-string-cstr %t
namespace std {
template <typename T>
-// RUN: %python %S/check_clang_tidy.py %s readability-simplify-boolean-expr %t -config="{CheckOptions: [{key: "readability-simplify-boolean-expr.ChainedConditionalAssignment", value: 1}]}" --
+// RUN: %check_clang_tidy %s readability-simplify-boolean-expr %t -config="{CheckOptions: [{key: "readability-simplify-boolean-expr.ChainedConditionalAssignment", value: 1}]}" --
void chained_conditional_compound_assignment(int i) {
bool b;
-// RUN: %python %S/check_clang_tidy.py %s readability-simplify-boolean-expr %t -config="{CheckOptions: [{key: "readability-simplify-boolean-expr.ChainedConditionalReturn", value: 1}]}" --
+// RUN: %check_clang_tidy %s readability-simplify-boolean-expr %t -config="{CheckOptions: [{key: "readability-simplify-boolean-expr.ChainedConditionalReturn", value: 1}]}" --
bool chained_conditional_compound_return(int i) {
if (i < 0) {
-// RUN: %python %S/check_clang_tidy.py %s readability-simplify-boolean-expr %t
+// RUN: %check_clang_tidy %s readability-simplify-boolean-expr %t
bool a1 = false;
-// RUN: %python %S/check_clang_tidy.py %s readability-uniqueptr-delete-release %t
+// RUN: %check_clang_tidy %s readability-uniqueptr-delete-release %t
namespace std {
template <typename T>
if platform.system() not in ['Windows']:
config.available_features.add('ansi-escape-sequences')
-config.substitutions.append( ('%python', config.python_executable) )
+check_clang_tidy = os.path.join(
+ config.test_source_root, "clang-tidy", "check_clang_tidy.py")
+config.substitutions.append(
+ ('%check_clang_tidy',
+ '%s %s' % (config.python_executable, check_clang_tidy)) )
+clang_tidy_diff = os.path.join(
+ config.test_source_root, "..", "clang-tidy", "tool", "clang-tidy-diff.py")
+config.substitutions.append(
+ ('%clang_tidy_diff',
+ '%s %s' % (config.python_executable, clang_tidy_diff)) )