Skip to content

Commit ff1e72d

Browse files
authored
[clang-tidy] hicpp-ignored-remove-result ignore functions with same prefixes as the target (#87587)
1 parent 66190af commit ff1e72d

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

clang-tools-extra/clang-tidy/hicpp/IgnoredRemoveResultCheck.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ IgnoredRemoveResultCheck::IgnoredRemoveResultCheck(llvm::StringRef Name,
1414
ClangTidyContext *Context)
1515
: UnusedReturnValueCheck(Name, Context,
1616
{
17-
"::std::remove",
18-
"::std::remove_if",
19-
"::std::unique",
17+
"::std::remove$",
18+
"::std::remove_if$",
19+
"::std::unique$",
2020
}) {
2121
// The constructor for ClangTidyCheck needs to have been called
2222
// before we can access options via Options.get().

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ Changes in existing checks
210210
- Improved :doc:`google-runtime-int <clang-tidy/checks/google/runtime-int>`
211211
check performance through optimizations.
212212

213+
- Improved :doc:`hicpp-ignored-remove-result <clang-tidy/checks/hicpp/ignored-remove-result>`
214+
check by ignoring other functions with same prefixes as the target specific
215+
functions.
216+
213217
- Improved :doc:`llvm-header-guard
214218
<clang-tidy/checks/llvm/header-guard>` check by replacing the local
215219
option `HeaderFileExtensions` by the global option of the same name.

clang-tools-extra/test/clang-tidy/checkers/hicpp/ignored-remove-result.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ ForwardIt unique(ForwardIt, ForwardIt);
1515
template <class InputIt, class T>
1616
InputIt find(InputIt, InputIt, const T&);
1717

18+
struct unique_disposable {
19+
void* release();
20+
};
21+
1822
class error_code {
1923
};
2024

@@ -63,4 +67,6 @@ void noWarning() {
6367
// bugprone-unused-return-value's checked return types.
6468
errorFunc();
6569
(void) errorFunc();
70+
71+
std::unique_disposable{}.release();
6672
}

0 commit comments

Comments
 (0)