[clang-tools-extra] r247266 - [clang-tidy] Renamed tests files to be closer to the check names.
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 10 03:58:38 PDT 2015
Author: alexfh
Date: Thu Sep 10 05:58:38 2015
New Revision: 247266
URL: http://llvm.org/viewvc/llvm-project?rev=247266&view=rev
Log:
[clang-tidy] Renamed tests files to be closer to the check names.
Added:
clang-tools-extra/trunk/test/clang-tidy/google-build-explicit-make-pair.cpp
- copied unchanged from r247265, clang-tools-extra/trunk/test/clang-tidy/google-explicit-make-pair.cpp
clang-tools-extra/trunk/test/clang-tidy/google-runtime-member-string-references.cpp
- copied unchanged from r247265, clang-tools-extra/trunk/test/clang-tidy/google-member-string-references.cpp
clang-tools-extra/trunk/test/clang-tidy/google-runtime-memset-zero-length.cpp
- copied unchanged from r247265, clang-tools-extra/trunk/test/clang-tidy/google-memset-zero-length.cpp
Removed:
clang-tools-extra/trunk/test/clang-tidy/google-explicit-make-pair.cpp
clang-tools-extra/trunk/test/clang-tidy/google-member-string-references.cpp
clang-tools-extra/trunk/test/clang-tidy/google-memset-zero-length.cpp
Removed: clang-tools-extra/trunk/test/clang-tidy/google-explicit-make-pair.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/google-explicit-make-pair.cpp?rev=247265&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/google-explicit-make-pair.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/google-explicit-make-pair.cpp (removed)
@@ -1,51 +0,0 @@
-// RUN: %python %S/check_clang_tidy.py %s google-build-explicit-make-pair %t
-
-namespace std {
-template <class T1, class T2>
-struct pair {
- pair(T1 x, T2 y) {}
-};
-
-template <class T1, class T2>
-pair<T1, T2> make_pair(T1 x, T2 y) {
- return pair<T1, T2>(x, y);
-}
-}
-
-template <typename T>
-void templ(T a, T b) {
- std::make_pair<T, unsigned>(a, b);
- std::make_pair<int, int>(1, 2);
-// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: for C++11-compatibility, omit template arguments from make_pair
-// CHECK-FIXES: std::make_pair(1, 2)
-}
-
-template <typename T>
-int t();
-
-void test(int i) {
- std::make_pair<int, int>(i, i);
-// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: for C++11-compatibility, omit template arguments from make_pair
-// CHECK-FIXES: std::make_pair(i, i)
-
- std::make_pair<unsigned, int>(i, i);
-// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: for C++11-compatibility, use pair directly
-// CHECK-FIXES: std::pair<unsigned, int>(i, i)
-
- std::make_pair<int, unsigned>(i, i);
-// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: for C++11-compatibility, use pair directly
-// CHECK-FIXES: std::pair<int, unsigned>(i, i)
-
-#define M std::make_pair<int, unsigned>(i, i);
-M
-// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: for C++11-compatibility, use pair directly
-// Can't fix in macros.
-// CHECK-FIXES: #define M std::make_pair<int, unsigned>(i, i);
-// CHECK-FIXES-NEXT: M
-
- templ(i, i);
- templ(1U, 2U);
-
- std::make_pair(i, 1); // no-warning
- std::make_pair(t<int>, 1);
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/google-member-string-references.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/google-member-string-references.cpp?rev=247265&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/google-member-string-references.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/google-member-string-references.cpp (removed)
@@ -1,49 +0,0 @@
-// RUN: %python %S/check_clang_tidy.py %s google-runtime-member-string-references %t
-
-namespace std {
-template<typename T>
- class basic_string {};
-
-typedef basic_string<char> string;
-}
-
-class string {};
-
-
-struct A {
- const std::string &s;
-// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: const string& members are dangerous. It is much better to use alternatives, such as pointers or simple constants. [google-runtime-member-string-references]
-};
-
-struct B {
- std::string &s;
-};
-
-struct C {
- const std::string s;
-};
-
-template <typename T>
-struct D {
- D();
- const T &s;
- const std::string &s2;
-// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: const string& members are dangerous.
-};
-
-D<std::string> d;
-
-struct AA {
- const string &s;
-// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: const string& members are dangerous.
-};
-
-struct BB {
- string &s;
-};
-
-struct CC {
- const string s;
-};
-
-D<string> dd;
Removed: clang-tools-extra/trunk/test/clang-tidy/google-memset-zero-length.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/google-memset-zero-length.cpp?rev=247265&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/google-memset-zero-length.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/google-memset-zero-length.cpp (removed)
@@ -1,60 +0,0 @@
-// RUN: %python %S/check_clang_tidy.py %s google-runtime-memset %t
-
-void *memset(void *, int, __SIZE_TYPE__);
-
-namespace std {
- using ::memset;
-}
-
-template <int i, typename T>
-void memtmpl() {
- memset(0, sizeof(int), i);
- memset(0, sizeof(T), sizeof(T));
- memset(0, sizeof(T), 0);
-// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: memset of size zero, potentially swapped argument
-// CHECK-FIXES: memset(0, 0, sizeof(T));
- memset(0, sizeof(int), 0);
-// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: memset of size zero, potentially swapped argument
-// CHECK-FIXES: memset(0, 0, sizeof(int));
-}
-
-void foo(void *a, int xsize, int ysize) {
- memset(a, sizeof(int), 0);
-// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: memset of size zero, potentially swapped argument
-// CHECK-FIXES: memset(a, 0, sizeof(int));
-#define M memset(a, sizeof(int), 0);
- M
-// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: memset of size zero, potentially swapped argument
-// CHECK-FIXES: #define M memset(a, sizeof(int), 0);
- ::memset(a, xsize *
- ysize, 0);
-// CHECK-MESSAGES: :[[@LINE-2]]:3: warning: memset of size zero, potentially swapped argument
-// CHECK-FIXES: ::memset(a, 0, xsize *
-// CHECK-FIXES-NEXT: ysize);
- std::memset(a, sizeof(int), 0x00);
-// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: memset of size zero, potentially swapped argument
-// CHECK-FIXES: std::memset(a, 0x00, sizeof(int));
-
- const int v = 0;
- memset(a, sizeof(int), v);
-// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: memset of size zero, potentially swapped argument
-// CHECK-FIXES: memset(a, v, sizeof(int));
-
- memset(a, sizeof(int), v + v);
-// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: memset of size zero, potentially swapped argument
-// CHECK-FIXES: memset(a, v + v, sizeof(int));
-
- memset(a, sizeof(int), v + 1);
-
- memset(a, -1, sizeof(int));
- memset(a, 0xcd, 1);
- memset(a, v, 0);
-// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: memset of size zero
-// CHECK-FIXES: memset(a, v, 0);
-
- memset(a, -1, v);
-// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: memset of size zero
-// CHECK-FIXES: memset(a, -1, v);
-
- memtmpl<0, int>();
-}
More information about the cfe-commits
mailing list