[clang-tools-extra] r343791 - [clang-tidy] NFC use CHECK-NOTES in tests for performance-move-constructor-init

Jonas Toth via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 4 08:55:37 PDT 2018


Author: jonastoth
Date: Thu Oct  4 08:55:37 2018
New Revision: 343791

URL: http://llvm.org/viewvc/llvm-project?rev=343791&view=rev
Log:
[clang-tidy] NFC use CHECK-NOTES in tests for performance-move-constructor-init

Reviewers: alexfh, aaron.ballman, hokein

Reviewed By: alexfh

Subscribers: lebedev.ri, xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D52691

Modified:
    clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py
    clang-tools-extra/trunk/test/clang-tidy/performance-move-constructor-init.cpp

Modified: clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py?rev=343791&r1=343790&r2=343791&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py (original)
+++ clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py Thu Oct  4 08:55:37 2018
@@ -164,7 +164,9 @@ def main():
 
   if has_check_notes:
     notes_file = temp_file_name + '.notes'
-    write_file(notes_file, clang_tidy_output)
+    filtered_output = [line for line in clang_tidy_output.splitlines()
+                       if not "note: FIX-IT applied suggested changes" in line]
+    write_file(notes_file, '\n'.join(filtered_output))
     try:
       subprocess.check_output(
           ['FileCheck', '-input-file=' + notes_file, input_file_name,

Modified: clang-tools-extra/trunk/test/clang-tidy/performance-move-constructor-init.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/performance-move-constructor-init.cpp?rev=343791&r1=343790&r2=343791&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/performance-move-constructor-init.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/performance-move-constructor-init.cpp Thu Oct  4 08:55:37 2018
@@ -30,9 +30,9 @@ struct B {
 struct D : B {
   D() : B() {}
   D(const D &RHS) : B(RHS) {}
-  // CHECK-MESSAGES: :[[@LINE+3]]:16: warning: move constructor initializes base class by calling a copy constructor [performance-move-constructor-init]
-  // CHECK-MESSAGES: 26:3: note: copy constructor being called
-  // CHECK-MESSAGES: 27:3: note: candidate move constructor here
+  // CHECK-NOTES: :[[@LINE+3]]:16: warning: move constructor initializes base class by calling a copy constructor [performance-move-constructor-init]
+  // CHECK-NOTES: 26:3: note: copy constructor being called
+  // CHECK-NOTES: 27:3: note: candidate move constructor here
   D(D &&RHS) : B(RHS) {}
 };
 
@@ -75,8 +75,10 @@ struct L : K {
 
 struct M {
   B Mem;
-  // CHECK-MESSAGES: :[[@LINE+1]]:16: warning: move constructor initializes class member by calling a copy constructor [performance-move-constructor-init]
+  // CHECK-NOTES: :[[@LINE+1]]:16: warning: move constructor initializes class member by calling a copy constructor [performance-move-constructor-init]
   M(M &&RHS) : Mem(RHS.Mem) {}
+  // CHECK-NOTES: 26:3: note: copy constructor being called
+  // CHECK-NOTES: 27:3: note: candidate move constructor here
 };
 
 struct N {
@@ -109,7 +111,7 @@ struct TriviallyCopyable {
 
 struct Positive {
   Positive(Movable M) : M_(M) {}
-  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: pass by value and use std::move [modernize-pass-by-value]
+  // CHECK-NOTES: [[@LINE-1]]:12: warning: pass by value and use std::move [modernize-pass-by-value]
   // CHECK-FIXES: Positive(Movable M) : M_(std::move(M)) {}
   Movable M_;
 };




More information about the cfe-commits mailing list