forked from OSchip/llvm-project
Modify the tests to use FileCheck -implicit-check-not option being proposed in D4462
Reviewers: djasper, sbenza, bkramer Reviewed By: bkramer Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4463 llvm-svn: 212814
This commit is contained in:
parent
c97126b1c9
commit
a2c4950e6e
|
@ -10,8 +10,14 @@ TEMPORARY_FILE=$3.cpp
|
|||
# We need to keep the comments to preserve line numbers while avoiding empty
|
||||
# lines which could potentially trigger formatting-related checks.
|
||||
sed 's#// *[A-Z-]\+:.*#//#' ${INPUT_FILE} > ${TEMPORARY_FILE}
|
||||
clang-tidy ${TEMPORARY_FILE} -fix --checks="-*,${CHECK_TO_RUN}" -- --std=c++11 > ${TEMPORARY_FILE}.msg 2>&1
|
||||
FileCheck -input-file=${TEMPORARY_FILE} ${INPUT_FILE} -check-prefix=CHECK-FIXES -strict-whitespace || exit $?
|
||||
|
||||
clang-tidy ${TEMPORARY_FILE} -fix --checks="-*,${CHECK_TO_RUN}" -- --std=c++11 \
|
||||
> ${TEMPORARY_FILE}.msg 2>&1
|
||||
|
||||
FileCheck -input-file=${TEMPORARY_FILE} ${INPUT_FILE} \
|
||||
-check-prefix=CHECK-FIXES -strict-whitespace || exit $?
|
||||
|
||||
if grep -q CHECK-MESSAGES ${INPUT_FILE}; then
|
||||
FileCheck -input-file=${TEMPORARY_FILE}.msg ${INPUT_FILE} -check-prefix=CHECK-MESSAGES || exit $?
|
||||
FileCheck -input-file=${TEMPORARY_FILE}.msg ${INPUT_FILE} \
|
||||
-check-prefix=CHECK-MESSAGES -implicit-check-not="warning:" || exit $?
|
||||
fi
|
||||
|
|
|
@ -15,19 +15,19 @@ using namespace llvm;
|
|||
void foo(const Twine &x);
|
||||
|
||||
static Twine Moo = Twine("bark") + "bah";
|
||||
// CHECK-MESSAGES: twine variables are prone to use-after-free bugs
|
||||
// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: twine variables are prone to use-after-free bugs
|
||||
// CHECK-MESSAGES: note: FIX-IT applied suggested code changes
|
||||
// CHECK-FIXES: static std::string Moo = (Twine("bark") + "bah").str();
|
||||
|
||||
int main() {
|
||||
const Twine t = Twine("a") + "b" + Twine(42);
|
||||
// CHECK-MESSAGES: twine variables are prone to use-after-free bugs
|
||||
// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: twine variables are prone to use-after-free bugs
|
||||
// CHECK-MESSAGES: note: FIX-IT applied suggested code changes
|
||||
// CHECK-FIXES: std::string t = (Twine("a") + "b" + Twine(42)).str();
|
||||
foo(Twine("a") + "b");
|
||||
|
||||
Twine Prefix = false ? "__INT_FAST" : "__UINT_FAST";
|
||||
// CHECK-MESSAGES: twine variables are prone to use-after-free bugs
|
||||
// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: twine variables are prone to use-after-free bugs
|
||||
// CHECK-MESSAGES: note: FIX-IT applied suggested code changes
|
||||
// CHECK-FIXES: const char * Prefix = false ? "__INT_FAST" : "__UINT_FAST";
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s misc-redundant-smartptr-get %t
|
||||
// REQUIRES: shell
|
||||
|
||||
// CHECK-MESSAGES-NOT: warning
|
||||
|
||||
namespace std {
|
||||
|
||||
template <typename T>
|
||||
|
@ -103,8 +101,6 @@ void Positive() {
|
|||
// CHECK-FIXES: bb = nullptr != *ss;
|
||||
}
|
||||
|
||||
// CHECK-MESSAGES-NOT: warning:
|
||||
|
||||
void Negative() {
|
||||
struct NegPtr {
|
||||
int* get();
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s misc-use-override %t
|
||||
// REQUIRES: shell
|
||||
|
||||
// CHECK-MESSAGES-NOT: warning:
|
||||
|
||||
#define ABSTRACT = 0
|
||||
|
||||
#define OVERRIDE override
|
||||
|
@ -198,6 +196,7 @@ template <typename T> struct TemplateBase {
|
|||
|
||||
template <typename T> struct DerivedFromTemplate : public TemplateBase<T> {
|
||||
virtual void f(T t);
|
||||
// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: Prefer using
|
||||
// CHECK-FIXES: {{^ void f\(T t\) override;}}
|
||||
};
|
||||
void f() { DerivedFromTemplate<int>().f(2); }
|
||||
|
@ -220,5 +219,3 @@ struct MembersOfSpecializations : public Base {
|
|||
};
|
||||
template <> void MembersOfSpecializations<3>::a() {}
|
||||
void f() { MembersOfSpecializations<3>().a(); };
|
||||
|
||||
// CHECK-MESSAGES-NOT: warning:
|
||||
|
|
Loading…
Reference in New Issue