[clang-tools-extra] [clang-tidy]avoid bugprone-unused-return-value false positive for function with the same prefix as the default argument (PR #84333)

2024-03-08 Thread Congcong Cai via cfe-commits

https://github.com/HerrCai0907 closed 
https://github.com/llvm/llvm-project/pull/84333
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy]avoid bugprone-unused-return-value false positive for function with the same prefix as the default argument (PR #84333)

2024-03-07 Thread Congcong Cai via cfe-commits

https://github.com/HerrCai0907 updated 
https://github.com/llvm/llvm-project/pull/84333

>From aaa9ea1db21b5de5d8be454ce1b1d05b219cccfc Mon Sep 17 00:00:00 2001
From: Congcong Cai 
Date: Thu, 7 Mar 2024 23:28:40 +0800
Subject: [PATCH 1/2] [clang-tidy]avoid bugprone-unused-return-value false
 negative for function with the same prefix as the default argument

string without `$` end will cause incorrectly match results.
Fixes: #84314.
---
 .../bugprone/UnusedReturnValueCheck.cpp   | 184 +-
 clang-tools-extra/docs/ReleaseNotes.rst   |   4 +-
 .../checkers/bugprone/unused-return-value.cpp |  14 ++
 3 files changed, 109 insertions(+), 93 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp
index b4bf85c912c3ca..1252b2f23805a1 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp
@@ -34,102 +34,102 @@ 
UnusedReturnValueCheck::UnusedReturnValueCheck(llvm::StringRef Name,
ClangTidyContext *Context)
 : ClangTidyCheck(Name, Context),
   CheckedFunctions(utils::options::parseStringList(
-  Options.get("CheckedFunctions", "::std::async;"
-  "::std::launder;"
-  "::std::remove;"
-  "::std::remove_if;"
-  "::std::unique;"
-  "::std::unique_ptr::release;"
-  "::std::basic_string::empty;"
-  "::std::vector::empty;"
-  "::std::back_inserter;"
-  "::std::distance;"
-  "::std::find;"
-  "::std::find_if;"
-  "::std::inserter;"
-  "::std::lower_bound;"
-  "::std::make_pair;"
-  "::std::map::count;"
-  "::std::map::find;"
-  "::std::map::lower_bound;"
-  "::std::multimap::equal_range;"
-  "::std::multimap::upper_bound;"
-  "::std::set::count;"
-  "::std::set::find;"
-  "::std::setfill;"
-  "::std::setprecision;"
-  "::std::setw;"
-  "::std::upper_bound;"
-  "::std::vector::at;"
+  Options.get("CheckedFunctions", "::std::async$;"
+  "::std::launder$;"
+  "::std::remove$;"
+  "::std::remove_if$;"
+  "::std::unique$;"
+  "::std::unique_ptr::release$;"
+  "::std::basic_string::empty$;"
+  "::std::vector::empty$;"
+  "::std::back_inserter$;"
+  "::std::distance$;"
+  "::std::find$;"
+  "::std::find_if$;"
+  "::std::inserter$;"
+  "::std::lower_bound$;"
+  "::std::make_pair$;"
+  "::std::map::count$;"
+  "::std::map::find$;"
+  "::std::map::lower_bound$;"
+  "::std::multimap::equal_range$;"
+  "::std::multimap::upper_bound$;"
+  "::std::set::count$;"
+  "::std::set::find$;"
+  "::std::setfill$;"
+  "::std::setprecision$;"
+  "::std::setw$;"
+  "::std::upper_bound$;"
+  "::std::vector::at$;"
   // C standard library
-  "::bsearch;"
-  "::ferror;"
- 

[clang-tools-extra] [clang-tidy]avoid bugprone-unused-return-value false positive for function with the same prefix as the default argument (PR #84333)

2024-03-07 Thread Julian Schmidt via cfe-commits

https://github.com/5chmidti approved this pull request.

+1 on the docs

https://github.com/llvm/llvm-project/pull/84333
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy]avoid bugprone-unused-return-value false positive for function with the same prefix as the default argument (PR #84333)

2024-03-07 Thread Piotr Zegar via cfe-commits

https://github.com/PiotrZSL approved this pull request.

LGTM, but I agree that documentation should be changed to put there 
configuration in format that it is in .cpp file.

https://github.com/llvm/llvm-project/pull/84333
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy]avoid bugprone-unused-return-value false positive for function with the same prefix as the default argument (PR #84333)

2024-03-07 Thread Oliver Stöneberg via cfe-commits

firewave wrote:

I think this might also require documentation changes.

The documentation is also a bit misleading in terms of the defaults: 
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/unused-return-value.html.
 I add issues detecting a custom function as it required the ``::` prefix.

https://github.com/llvm/llvm-project/pull/84333
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy]avoid bugprone-unused-return-value false positive for function with the same prefix as the default argument (PR #84333)

2024-03-07 Thread Congcong Cai via cfe-commits

https://github.com/HerrCai0907 updated 
https://github.com/llvm/llvm-project/pull/84333

>From aaa9ea1db21b5de5d8be454ce1b1d05b219cccfc Mon Sep 17 00:00:00 2001
From: Congcong Cai 
Date: Thu, 7 Mar 2024 23:28:40 +0800
Subject: [PATCH] [clang-tidy]avoid bugprone-unused-return-value false negative
 for function with the same prefix as the default argument

string without `$` end will cause incorrectly match results.
Fixes: #84314.
---
 .../bugprone/UnusedReturnValueCheck.cpp   | 184 +-
 clang-tools-extra/docs/ReleaseNotes.rst   |   4 +-
 .../checkers/bugprone/unused-return-value.cpp |  14 ++
 3 files changed, 109 insertions(+), 93 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp
index b4bf85c912c3ca..1252b2f23805a1 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp
@@ -34,102 +34,102 @@ 
UnusedReturnValueCheck::UnusedReturnValueCheck(llvm::StringRef Name,
ClangTidyContext *Context)
 : ClangTidyCheck(Name, Context),
   CheckedFunctions(utils::options::parseStringList(
-  Options.get("CheckedFunctions", "::std::async;"
-  "::std::launder;"
-  "::std::remove;"
-  "::std::remove_if;"
-  "::std::unique;"
-  "::std::unique_ptr::release;"
-  "::std::basic_string::empty;"
-  "::std::vector::empty;"
-  "::std::back_inserter;"
-  "::std::distance;"
-  "::std::find;"
-  "::std::find_if;"
-  "::std::inserter;"
-  "::std::lower_bound;"
-  "::std::make_pair;"
-  "::std::map::count;"
-  "::std::map::find;"
-  "::std::map::lower_bound;"
-  "::std::multimap::equal_range;"
-  "::std::multimap::upper_bound;"
-  "::std::set::count;"
-  "::std::set::find;"
-  "::std::setfill;"
-  "::std::setprecision;"
-  "::std::setw;"
-  "::std::upper_bound;"
-  "::std::vector::at;"
+  Options.get("CheckedFunctions", "::std::async$;"
+  "::std::launder$;"
+  "::std::remove$;"
+  "::std::remove_if$;"
+  "::std::unique$;"
+  "::std::unique_ptr::release$;"
+  "::std::basic_string::empty$;"
+  "::std::vector::empty$;"
+  "::std::back_inserter$;"
+  "::std::distance$;"
+  "::std::find$;"
+  "::std::find_if$;"
+  "::std::inserter$;"
+  "::std::lower_bound$;"
+  "::std::make_pair$;"
+  "::std::map::count$;"
+  "::std::map::find$;"
+  "::std::map::lower_bound$;"
+  "::std::multimap::equal_range$;"
+  "::std::multimap::upper_bound$;"
+  "::std::set::count$;"
+  "::std::set::find$;"
+  "::std::setfill$;"
+  "::std::setprecision$;"
+  "::std::setw$;"
+  "::std::upper_bound$;"
+  "::std::vector::at$;"
   // C standard library
-  "::bsearch;"
-  "::ferror;"
- 

[clang-tools-extra] [clang-tidy]avoid bugprone-unused-return-value false positive for function with the same prefix as the default argument (PR #84333)

2024-03-07 Thread Congcong Cai via cfe-commits

https://github.com/HerrCai0907 edited 
https://github.com/llvm/llvm-project/pull/84333
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits