diff options
4 files changed, 20 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/misc-use-after-move.cpp b/clang-tools-extra/test/clang-tidy/misc-use-after-move.cpp index 970364ba5a7..b0e96a6b908 100644 --- a/clang-tools-extra/test/clang-tidy/misc-use-after-move.cpp +++ b/clang-tools-extra/test/clang-tidy/misc-use-after-move.cpp @@ -723,6 +723,11 @@ void standardContainerClearIsReinit() { std::move(container); container.clear(); container.empty(); + + auto container2 = container; + std::move(container2); + container2.clear(); + container2.empty(); } { std::deque<int> container; diff --git a/clang-tools-extra/test/clang-tidy/performance-inefficient-string-concatenation.cpp b/clang-tools-extra/test/clang-tidy/performance-inefficient-string-concatenation.cpp index f4b293a04bf..1dbd56b3222 100644 --- a/clang-tools-extra/test/clang-tidy/performance-inefficient-string-concatenation.cpp +++ b/clang-tools-extra/test/clang-tidy/performance-inefficient-string-concatenation.cpp @@ -19,6 +19,8 @@ std::string g(std::string) {} int main() { std::string mystr1, mystr2; std::wstring mywstr1, mywstr2; + auto myautostr1 = mystr1; + auto myautostr2 = mystr2; for (int i = 0; i < 10; ++i) { f(mystr1 + mystr2 + mystr1); @@ -33,6 +35,8 @@ int main() { // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: string concatenation mywstr1 = mywstr2 + mywstr2 + mywstr2; // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: string concatenation + myautostr1 = myautostr1 + myautostr2; + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: string concatenation mywstr1 = mywstr2 + mywstr2; mystr1 = mystr2 + mystr2; diff --git a/clang-tools-extra/test/clang-tidy/readability-redundant-smartptr-get.cpp b/clang-tools-extra/test/clang-tidy/readability-redundant-smartptr-get.cpp index 985efc58e42..ce4c34be406 100644 --- a/clang-tools-extra/test/clang-tidy/readability-redundant-smartptr-get.cpp +++ b/clang-tools-extra/test/clang-tidy/readability-redundant-smartptr-get.cpp @@ -97,6 +97,12 @@ void Positive() { // CHECK-MESSAGES: int i = *ip.get(); // CHECK-FIXES: int i = *ip; + auto ip2 = ip; + i = *ip2.get(); + // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: redundant get() call + // CHECK-MESSAGES: i = *ip2.get(); + // CHECK-FIXES: i = *ip2; + std::unique_ptr<int> uu; std::shared_ptr<double> *ss; bool bb = uu.get() == nullptr; diff --git a/clang-tools-extra/test/clang-tidy/readability-uniqueptr-delete-release.cpp b/clang-tools-extra/test/clang-tidy/readability-uniqueptr-delete-release.cpp index aa8ae25944e..bd51bc62dba 100644 --- a/clang-tools-extra/test/clang-tidy/readability-uniqueptr-delete-release.cpp +++ b/clang-tools-extra/test/clang-tidy/readability-uniqueptr-delete-release.cpp @@ -24,6 +24,11 @@ void Positives() { // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: prefer '= nullptr' to 'delete x.release()' to reset unique_ptr<> objects [readability-uniqueptr-delete-release] // CHECK-FIXES: {{^}} P = nullptr; + auto P2 = P; + delete P2.release(); + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: prefer '= nullptr' to 'delete x.release()' to reset unique_ptr<> objects [readability-uniqueptr-delete-release] + // CHECK-FIXES: {{^}} P2 = nullptr; + std::unique_ptr<int> Array[20]; delete Array[4].release(); // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: prefer '= nullptr' to 'delete |