diff options
author | Alexander Kornienko <alexfh@google.com> | 2018-11-27 10:53:44 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2018-11-27 10:53:44 +0000 |
commit | 10df62d4afb10430fa4018623230f9a992650a50 (patch) | |
tree | 0db8b6365efa82167043c903a4f38642d66894a3 /clang-tools-extra/test | |
parent | 4811bde74c8bf7a3cc38dbdd3db3890a5cac7dee (diff) |
[clang-tidy] Avoid inconsistent notes in readability-container-size-empty
When a warning is issued in a template instantiation, the check would previously
use template arguments in a note, which would result in inconsistent or
duplicate warnings (depending on how deduplication was done). This patch removes
template arguments from the note.
Diffstat (limited to 'clang-tools-extra/test')
-rw-r--r-- | clang-tools-extra/test/clang-tidy/readability-container-size-empty.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/clang-tools-extra/test/clang-tidy/readability-container-size-empty.cpp b/clang-tools-extra/test/clang-tidy/readability-container-size-empty.cpp index 65d5c8ebdc4..c67d9275bbf 100644 --- a/clang-tools-extra/test/clang-tidy/readability-container-size-empty.cpp +++ b/clang-tools-extra/test/clang-tidy/readability-container-size-empty.cpp @@ -113,12 +113,12 @@ int main() { ; // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty] // CHECK-FIXES: {{^ }}if (intSet.empty()){{$}} - // CHECK-MESSAGES: :32:8: note: method 'set<int>'::empty() defined here + // CHECK-MESSAGES: :32:8: note: method 'set'::empty() defined here if (intSet == std::set<int>()) ; // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used to check for emptiness // CHECK-FIXES: {{^ }}if (intSet.empty()){{$}} - // CHECK-MESSAGES: :32:8: note: method 'set<int>'::empty() defined here + // CHECK-MESSAGES: :32:8: note: method 'set'::empty() defined here if (s_func() == "") ; // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used @@ -407,6 +407,7 @@ template <typename T> void f() { if (v.size()) ; // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty] + // CHECK-MESSAGES: :9:8: note: method 'vector'::empty() defined here // CHECK-FIXES: {{^ }}if (!v.empty()){{$}} if (v == std::vector<T>()) ; @@ -415,20 +416,24 @@ template <typename T> void f() { // CHECK-FIXES-NEXT: ; CHECKSIZE(v); // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: the 'empty' method should be used + // CHECK-MESSAGES: :9:8: note: method 'vector'::empty() defined here // CHECK-FIXES: CHECKSIZE(v); TemplatedContainer<T> templated_container; if (templated_container.size()) ; // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used + // CHECK-MESSAGES: :44:8: note: method 'TemplatedContainer'::empty() defined here // CHECK-FIXES: {{^ }}if (!templated_container.empty()){{$}} if (templated_container != TemplatedContainer<T>()) ; // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used + // CHECK-MESSAGES: :44:8: note: method 'TemplatedContainer'::empty() defined here // CHECK-FIXES: {{^ }}if (!templated_container.empty()){{$}} // CHECK-FIXES-NEXT: ; CHECKSIZE(templated_container); // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: the 'empty' method should be used + // CHECK-MESSAGES: :44:8: note: method 'TemplatedContainer'::empty() defined here // CHECK-FIXES: CHECKSIZE(templated_container); } |