diff options
author | Alexander Kornienko <alexfh@google.com> | 2015-09-10 10:58:38 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2015-09-10 10:58:38 +0000 |
commit | a24501b2e16a26ca18d0510caaa8b7860189fde1 (patch) | |
tree | 196196c0c027333fe36e380ee61f442702ac72d7 /clang-tools-extra/test/clang-tidy/google-runtime-member-string-references.cpp | |
parent | df9ce8408a2ca784856032f0a2e32022430e5fec (diff) | |
download | bcm5719-llvm-a24501b2e16a26ca18d0510caaa8b7860189fde1.tar.gz bcm5719-llvm-a24501b2e16a26ca18d0510caaa8b7860189fde1.zip |
[clang-tidy] Renamed tests files to be closer to the check names.
llvm-svn: 247266
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/google-runtime-member-string-references.cpp')
-rw-r--r-- | clang-tools-extra/test/clang-tidy/google-runtime-member-string-references.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/google-runtime-member-string-references.cpp b/clang-tools-extra/test/clang-tidy/google-runtime-member-string-references.cpp new file mode 100644 index 00000000000..09146456df4 --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/google-runtime-member-string-references.cpp @@ -0,0 +1,49 @@ +// 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; |