flx created this revision.
flx added reviewers: alexfh, aaron.ballman, sbenza.
flx added a subscriber: cfe-commits.
flx set the repository for this revision to rL LLVM.
Move in complete type test which does not compile into its own test file.
Repository:
rL LLVM
https://reviews.llvm.org/D26369
Files:
test/clang-tidy/performance-unnecessary-value-param-incomplete-type.cpp
test/clang-tidy/performance-unnecessary-value-param.cpp
Index: test/clang-tidy/performance-unnecessary-value-param.cpp
===================================================================
--- test/clang-tidy/performance-unnecessary-value-param.cpp
+++ test/clang-tidy/performance-unnecessary-value-param.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t --
-fix-errors -- --std=c++11
+// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t
// CHECK-FIXES: #include <utility>
@@ -238,25 +238,11 @@
B = A;
}
-// Ensure that incomplete types result in an error from the frontend and not a
-// clang-tidy diagnostic about IncompleteType being expensive to copy.
-struct IncompleteType;
-void NegativeForIncompleteType(IncompleteType I) {
- // CHECK-MESSAGES: [[@LINE-1]]:47: error: variable has incomplete type
'IncompleteType' [clang-diagnostic-error]
-}
-
// Case where parameter in declaration is already const-qualified but not in
// implementation. Make sure a second 'const' is not added to the declaration.
void PositiveConstDeclaration(const ExpensiveToCopyType A);
// CHECK-FIXES: void PositiveConstDeclaration(const ExpensiveToCopyType& A);
void PositiveConstDeclaration(ExpensiveToCopyType A) {
// CHECK-MESSAGES: [[@LINE-1]]:51: warning: the parameter 'A' is copied
// CHECK-FIXES: void PositiveConstDeclaration(const ExpensiveToCopyType& A) {
}
-
-void PositiveNonConstDeclaration(ExpensiveToCopyType A);
-// CHECK-FIXES: void PositiveNonConstDeclaration(const ExpensiveToCopyType& A);
-void PositiveNonConstDeclaration(const ExpensiveToCopyType A) {
- // CHECK-MESSAGES: [[@LINE-1]]:60: warning: the const qualified parameter 'A'
- // CHECK-FIXES: void PositiveNonConstDeclaration(const ExpensiveToCopyType&
A) {
-}
Index: test/clang-tidy/performance-unnecessary-value-param-incomplete-type.cpp
===================================================================
--- /dev/null
+++ test/clang-tidy/performance-unnecessary-value-param-incomplete-type.cpp
@@ -0,0 +1,9 @@
+// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t --
-fix-errors -- --std=c++11
+
+// Ensure that incomplete types result in an error from the frontend and not a
+// clang-tidy diagnostic about IncompleteType being expensive to copy.
+struct IncompleteType;
+void NegativeForIncompleteType(IncompleteType I) {
+ // CHECK-MESSAGES: [[@LINE-1]]:47: error: variable has incomplete type
'IncompleteType' [clang-diagnostic-error]
+}
+
Index: test/clang-tidy/performance-unnecessary-value-param.cpp
===================================================================
--- test/clang-tidy/performance-unnecessary-value-param.cpp
+++ test/clang-tidy/performance-unnecessary-value-param.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t -- -fix-errors -- --std=c++11
+// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t
// CHECK-FIXES: #include <utility>
@@ -238,25 +238,11 @@
B = A;
}
-// Ensure that incomplete types result in an error from the frontend and not a
-// clang-tidy diagnostic about IncompleteType being expensive to copy.
-struct IncompleteType;
-void NegativeForIncompleteType(IncompleteType I) {
- // CHECK-MESSAGES: [[@LINE-1]]:47: error: variable has incomplete type 'IncompleteType' [clang-diagnostic-error]
-}
-
// Case where parameter in declaration is already const-qualified but not in
// implementation. Make sure a second 'const' is not added to the declaration.
void PositiveConstDeclaration(const ExpensiveToCopyType A);
// CHECK-FIXES: void PositiveConstDeclaration(const ExpensiveToCopyType& A);
void PositiveConstDeclaration(ExpensiveToCopyType A) {
// CHECK-MESSAGES: [[@LINE-1]]:51: warning: the parameter 'A' is copied
// CHECK-FIXES: void PositiveConstDeclaration(const ExpensiveToCopyType& A) {
}
-
-void PositiveNonConstDeclaration(ExpensiveToCopyType A);
-// CHECK-FIXES: void PositiveNonConstDeclaration(const ExpensiveToCopyType& A);
-void PositiveNonConstDeclaration(const ExpensiveToCopyType A) {
- // CHECK-MESSAGES: [[@LINE-1]]:60: warning: the const qualified parameter 'A'
- // CHECK-FIXES: void PositiveNonConstDeclaration(const ExpensiveToCopyType& A) {
-}
Index: test/clang-tidy/performance-unnecessary-value-param-incomplete-type.cpp
===================================================================
--- /dev/null
+++ test/clang-tidy/performance-unnecessary-value-param-incomplete-type.cpp
@@ -0,0 +1,9 @@
+// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t -- -fix-errors -- --std=c++11
+
+// Ensure that incomplete types result in an error from the frontend and not a
+// clang-tidy diagnostic about IncompleteType being expensive to copy.
+struct IncompleteType;
+void NegativeForIncompleteType(IncompleteType I) {
+ // CHECK-MESSAGES: [[@LINE-1]]:47: error: variable has incomplete type 'IncompleteType' [clang-diagnostic-error]
+}
+
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits