JonasToth created this revision. JonasToth added reviewers: aaron.ballman, alexfh, hokein. Herald added subscribers: cfe-commits, xazax.hun.
Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D52186 Files: test/clang-tidy/bugprone-forwarding-reference-overload.cpp Index: test/clang-tidy/bugprone-forwarding-reference-overload.cpp =================================================================== --- test/clang-tidy/bugprone-forwarding-reference-overload.cpp +++ test/clang-tidy/bugprone-forwarding-reference-overload.cpp @@ -20,27 +20,34 @@ class Test1 { public: template <typename T> Test1(T &&n); - // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: constructor accepting a forwarding reference can hide the copy and move constructors [bugprone-forwarding-reference-overload] + // CHECK-NOTES: [[@LINE-1]]:25: warning: constructor accepting a forwarding reference can hide the copy and move constructors [bugprone-forwarding-reference-overload] + // CHECK-NOTES: 48:3: note: copy constructor declared here + // CHECK-NOTES: 49:3: note: copy constructor declared here + // CHECK-NOTES: 50:3: note: move constructor declared here template <typename T> Test1(T &&n, int i = 5, ...); - // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: constructor accepting a forwarding reference can hide the copy and move constructors + // CHECK-NOTES: :[[@LINE-1]]:25: warning: constructor accepting a forwarding reference can hide the copy and move constructors + // CHECK-NOTES: 48:3: note: copy constructor declared here + // CHECK-NOTES: 49:3: note: copy constructor declared here + // CHECK-NOTES: 50:3: note: move constructor declared here template <typename T, typename U = typename std::enable_if_nice<T>::type> Test1(T &&n); - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructor accepting a forwarding reference can hide the copy and move constructors + // CHECK-NOTES: :[[@LINE-1]]:3: warning: constructor accepting a forwarding reference can hide the copy and move constructors + // CHECK-NOTES: 48:3: note: copy constructor declared here + // CHECK-NOTES: 49:3: note: copy constructor declared here + // CHECK-NOTES: 50:3: note: move constructor declared here template <typename T> Test1(T &&n, typename foo::enable_if<long>::type i = 5, ...); - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructor accepting a forwarding reference can hide the copy and move constructors + // CHECK-NOTES: :[[@LINE-1]]:3: warning: constructor accepting a forwarding reference can hide the copy and move constructors + // CHECK-NOTES: 48:3: note: copy constructor declared here + // CHECK-NOTES: 49:3: note: copy constructor declared here + // CHECK-NOTES: 50:3: note: move constructor declared here Test1(const Test1 &other) {} - // CHECK-MESSAGES: :[[@LINE-1]]:3: note: copy constructor declared here - Test1(Test1 &other) {} - // CHECK-MESSAGES: :[[@LINE-1]]:3: note: copy constructor declared here - Test1(Test1 &&other) {} - // CHECK-MESSAGES: :[[@LINE-1]]:3: note: move constructor declared here }; template <typename U> class Test2 { @@ -96,10 +103,10 @@ class Test4 { public: template <typename T> Test4(T &&n); - // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: constructor accepting a forwarding reference can hide the copy and move constructors + // CHECK-NOTES: :[[@LINE-1]]:25: warning: constructor accepting a forwarding reference can hide the copy and move constructors Test4(const Test4 &rhs); - // CHECK-MESSAGES: :[[@LINE-1]]:3: note: copy constructor declared here + // CHECK-NOTES: :[[@LINE-1]]:3: note: copy constructor declared here }; // Nothing can be hidden, the copy constructor is implicitly deleted. @@ -114,10 +121,10 @@ class Test6 { public: template <typename T> Test6(T &&n); - // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: constructor accepting a forwarding reference can hide the move constructor + // CHECK-NOTES: :[[@LINE-1]]:25: warning: constructor accepting a forwarding reference can hide the move constructor Test6(Test6 &&rhs); - // CHECK-MESSAGES: :[[@LINE-1]]:3: note: move constructor declared here + // CHECK-NOTES: :[[@LINE-1]]:3: note: move constructor declared here private: Test6(const Test6 &rhs); }; @@ -141,5 +148,5 @@ public: template <class _Arg, class _Tp = __best_match_t<_Arg, _Types...> > constexpr variant(_Arg&& __arg) {} - // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: constructor accepting a forwarding reference can hide the copy and move constructors + // CHECK-NOTES: :[[@LINE-1]]:13: warning: constructor accepting a forwarding reference can hide the copy and move constructors };
Index: test/clang-tidy/bugprone-forwarding-reference-overload.cpp =================================================================== --- test/clang-tidy/bugprone-forwarding-reference-overload.cpp +++ test/clang-tidy/bugprone-forwarding-reference-overload.cpp @@ -20,27 +20,34 @@ class Test1 { public: template <typename T> Test1(T &&n); - // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: constructor accepting a forwarding reference can hide the copy and move constructors [bugprone-forwarding-reference-overload] + // CHECK-NOTES: [[@LINE-1]]:25: warning: constructor accepting a forwarding reference can hide the copy and move constructors [bugprone-forwarding-reference-overload] + // CHECK-NOTES: 48:3: note: copy constructor declared here + // CHECK-NOTES: 49:3: note: copy constructor declared here + // CHECK-NOTES: 50:3: note: move constructor declared here template <typename T> Test1(T &&n, int i = 5, ...); - // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: constructor accepting a forwarding reference can hide the copy and move constructors + // CHECK-NOTES: :[[@LINE-1]]:25: warning: constructor accepting a forwarding reference can hide the copy and move constructors + // CHECK-NOTES: 48:3: note: copy constructor declared here + // CHECK-NOTES: 49:3: note: copy constructor declared here + // CHECK-NOTES: 50:3: note: move constructor declared here template <typename T, typename U = typename std::enable_if_nice<T>::type> Test1(T &&n); - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructor accepting a forwarding reference can hide the copy and move constructors + // CHECK-NOTES: :[[@LINE-1]]:3: warning: constructor accepting a forwarding reference can hide the copy and move constructors + // CHECK-NOTES: 48:3: note: copy constructor declared here + // CHECK-NOTES: 49:3: note: copy constructor declared here + // CHECK-NOTES: 50:3: note: move constructor declared here template <typename T> Test1(T &&n, typename foo::enable_if<long>::type i = 5, ...); - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructor accepting a forwarding reference can hide the copy and move constructors + // CHECK-NOTES: :[[@LINE-1]]:3: warning: constructor accepting a forwarding reference can hide the copy and move constructors + // CHECK-NOTES: 48:3: note: copy constructor declared here + // CHECK-NOTES: 49:3: note: copy constructor declared here + // CHECK-NOTES: 50:3: note: move constructor declared here Test1(const Test1 &other) {} - // CHECK-MESSAGES: :[[@LINE-1]]:3: note: copy constructor declared here - Test1(Test1 &other) {} - // CHECK-MESSAGES: :[[@LINE-1]]:3: note: copy constructor declared here - Test1(Test1 &&other) {} - // CHECK-MESSAGES: :[[@LINE-1]]:3: note: move constructor declared here }; template <typename U> class Test2 { @@ -96,10 +103,10 @@ class Test4 { public: template <typename T> Test4(T &&n); - // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: constructor accepting a forwarding reference can hide the copy and move constructors + // CHECK-NOTES: :[[@LINE-1]]:25: warning: constructor accepting a forwarding reference can hide the copy and move constructors Test4(const Test4 &rhs); - // CHECK-MESSAGES: :[[@LINE-1]]:3: note: copy constructor declared here + // CHECK-NOTES: :[[@LINE-1]]:3: note: copy constructor declared here }; // Nothing can be hidden, the copy constructor is implicitly deleted. @@ -114,10 +121,10 @@ class Test6 { public: template <typename T> Test6(T &&n); - // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: constructor accepting a forwarding reference can hide the move constructor + // CHECK-NOTES: :[[@LINE-1]]:25: warning: constructor accepting a forwarding reference can hide the move constructor Test6(Test6 &&rhs); - // CHECK-MESSAGES: :[[@LINE-1]]:3: note: move constructor declared here + // CHECK-NOTES: :[[@LINE-1]]:3: note: move constructor declared here private: Test6(const Test6 &rhs); }; @@ -141,5 +148,5 @@ public: template <class _Arg, class _Tp = __best_match_t<_Arg, _Types...> > constexpr variant(_Arg&& __arg) {} - // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: constructor accepting a forwarding reference can hide the copy and move constructors + // CHECK-NOTES: :[[@LINE-1]]:13: warning: constructor accepting a forwarding reference can hide the copy and move constructors };
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits