[clang-tools-extra] r212814 - Modify the tests to use FileCheck -implicit-check-not option being proposed in D4462

Alexander Kornienko alexfh at google.com
Fri Jul 11 06:44:51 PDT 2014


Author: alexfh
Date: Fri Jul 11 08:44:51 2014
New Revision: 212814

URL: http://llvm.org/viewvc/llvm-project?rev=212814&view=rev
Log:
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

Modified:
    clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy_fix.sh
    clang-tools-extra/trunk/test/clang-tidy/llvm-twine-local.cpp
    clang-tools-extra/trunk/test/clang-tidy/redundant-smartptr-get.cpp
    clang-tools-extra/trunk/test/clang-tidy/use-override.cpp

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=212814&r1=212813&r2=212814&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 Jul 11 08:44:51 2014
@@ -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

Modified: clang-tools-extra/trunk/test/clang-tidy/llvm-twine-local.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/llvm-twine-local.cpp?rev=212814&r1=212813&r2=212814&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/llvm-twine-local.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/llvm-twine-local.cpp Fri Jul 11 08:44:51 2014
@@ -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";
 }

Modified: clang-tools-extra/trunk/test/clang-tidy/redundant-smartptr-get.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/redundant-smartptr-get.cpp?rev=212814&r1=212813&r2=212814&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/redundant-smartptr-get.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/redundant-smartptr-get.cpp Fri Jul 11 08:44:51 2014
@@ -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();

Modified: clang-tools-extra/trunk/test/clang-tidy/use-override.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/use-override.cpp?rev=212814&r1=212813&r2=212814&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/use-override.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/use-override.cpp Fri Jul 11 08:44:51 2014
@@ -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 TemplateBas
 
 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
 };
 template <> void MembersOfSpecializations<3>::a() {}
 void f() { MembersOfSpecializations<3>().a(); };
-
-// CHECK-MESSAGES-NOT: warning:





More information about the cfe-commits mailing list