Skip to content

Commit c736ca8

Browse files
authored
[clang-tidy] Ensure functions are anchored in the global namespace (#99084)
The regular expressions match functions that aren't anchored in the global namespace. For example `::connect` matches `QObject::connect` This change is to remove these false positives
1 parent c077a4f commit c736ca8

File tree

1 file changed

+89
-89
lines changed

1 file changed

+89
-89
lines changed

clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp

Lines changed: 89 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -48,97 +48,97 @@ UnusedReturnValueCheck::UnusedReturnValueCheck(llvm::StringRef Name,
4848
ClangTidyContext *Context)
4949
: ClangTidyCheck(Name, Context),
5050
CheckedFunctions(utils::options::parseStringList(
51-
Options.get("CheckedFunctions", "::std::async$;"
52-
"::std::launder$;"
53-
"::std::remove$;"
54-
"::std::remove_if$;"
55-
"::std::unique$;"
56-
"::std::unique_ptr::release$;"
57-
"::std::basic_string::empty$;"
58-
"::std::vector::empty$;"
59-
"::std::back_inserter$;"
60-
"::std::distance$;"
61-
"::std::find$;"
62-
"::std::find_if$;"
63-
"::std::inserter$;"
64-
"::std::lower_bound$;"
65-
"::std::make_pair$;"
66-
"::std::map::count$;"
67-
"::std::map::find$;"
68-
"::std::map::lower_bound$;"
69-
"::std::multimap::equal_range$;"
70-
"::std::multimap::upper_bound$;"
71-
"::std::set::count$;"
72-
"::std::set::find$;"
73-
"::std::setfill$;"
74-
"::std::setprecision$;"
75-
"::std::setw$;"
76-
"::std::upper_bound$;"
77-
"::std::vector::at$;"
51+
Options.get("CheckedFunctions", "^::std::async$;"
52+
"^::std::launder$;"
53+
"^::std::remove$;"
54+
"^::std::remove_if$;"
55+
"^::std::unique$;"
56+
"^::std::unique_ptr::release$;"
57+
"^::std::basic_string::empty$;"
58+
"^::std::vector::empty$;"
59+
"^::std::back_inserter$;"
60+
"^::std::distance$;"
61+
"^::std::find$;"
62+
"^::std::find_if$;"
63+
"^::std::inserter$;"
64+
"^::std::lower_bound$;"
65+
"^::std::make_pair$;"
66+
"^::std::map::count$;"
67+
"^::std::map::find$;"
68+
"^::std::map::lower_bound$;"
69+
"^::std::multimap::equal_range$;"
70+
"^::std::multimap::upper_bound$;"
71+
"^::std::set::count$;"
72+
"^::std::set::find$;"
73+
"^::std::setfill$;"
74+
"^::std::setprecision$;"
75+
"^::std::setw$;"
76+
"^::std::upper_bound$;"
77+
"^::std::vector::at$;"
7878
// C standard library
79-
"::bsearch$;"
80-
"::ferror$;"
81-
"::feof$;"
82-
"::isalnum$;"
83-
"::isalpha$;"
84-
"::isblank$;"
85-
"::iscntrl$;"
86-
"::isdigit$;"
87-
"::isgraph$;"
88-
"::islower$;"
89-
"::isprint$;"
90-
"::ispunct$;"
91-
"::isspace$;"
92-
"::isupper$;"
93-
"::iswalnum$;"
94-
"::iswprint$;"
95-
"::iswspace$;"
96-
"::isxdigit$;"
97-
"::memchr$;"
98-
"::memcmp$;"
99-
"::strcmp$;"
100-
"::strcoll$;"
101-
"::strncmp$;"
102-
"::strpbrk$;"
103-
"::strrchr$;"
104-
"::strspn$;"
105-
"::strstr$;"
106-
"::wcscmp$;"
79+
"^::bsearch$;"
80+
"^::ferror$;"
81+
"^::feof$;"
82+
"^::isalnum$;"
83+
"^::isalpha$;"
84+
"^::isblank$;"
85+
"^::iscntrl$;"
86+
"^::isdigit$;"
87+
"^::isgraph$;"
88+
"^::islower$;"
89+
"^::isprint$;"
90+
"^::ispunct$;"
91+
"^::isspace$;"
92+
"^::isupper$;"
93+
"^::iswalnum$;"
94+
"^::iswprint$;"
95+
"^::iswspace$;"
96+
"^::isxdigit$;"
97+
"^::memchr$;"
98+
"^::memcmp$;"
99+
"^::strcmp$;"
100+
"^::strcoll$;"
101+
"^::strncmp$;"
102+
"^::strpbrk$;"
103+
"^::strrchr$;"
104+
"^::strspn$;"
105+
"^::strstr$;"
106+
"^::wcscmp$;"
107107
// POSIX
108-
"::access$;"
109-
"::bind$;"
110-
"::connect$;"
111-
"::difftime$;"
112-
"::dlsym$;"
113-
"::fnmatch$;"
114-
"::getaddrinfo$;"
115-
"::getopt$;"
116-
"::htonl$;"
117-
"::htons$;"
118-
"::iconv_open$;"
119-
"::inet_addr$;"
120-
"::isascii$;"
121-
"::isatty$;"
122-
"::mmap$;"
123-
"::newlocale$;"
124-
"::openat$;"
125-
"::pathconf$;"
126-
"::pthread_equal$;"
127-
"::pthread_getspecific$;"
128-
"::pthread_mutex_trylock$;"
129-
"::readdir$;"
130-
"::readlink$;"
131-
"::recvmsg$;"
132-
"::regexec$;"
133-
"::scandir$;"
134-
"::semget$;"
135-
"::setjmp$;"
136-
"::shm_open$;"
137-
"::shmget$;"
138-
"::sigismember$;"
139-
"::strcasecmp$;"
140-
"::strsignal$;"
141-
"::ttyname"))),
108+
"^::access$;"
109+
"^::bind$;"
110+
"^::connect$;"
111+
"^::difftime$;"
112+
"^::dlsym$;"
113+
"^::fnmatch$;"
114+
"^::getaddrinfo$;"
115+
"^::getopt$;"
116+
"^::htonl$;"
117+
"^::htons$;"
118+
"^::iconv_open$;"
119+
"^::inet_addr$;"
120+
"^::isascii$;"
121+
"^::isatty$;"
122+
"^::mmap$;"
123+
"^::newlocale$;"
124+
"^::openat$;"
125+
"^::pathconf$;"
126+
"^::pthread_equal$;"
127+
"^::pthread_getspecific$;"
128+
"^::pthread_mutex_trylock$;"
129+
"^::readdir$;"
130+
"^::readlink$;"
131+
"^::recvmsg$;"
132+
"^::regexec$;"
133+
"^::scandir$;"
134+
"^::semget$;"
135+
"^::setjmp$;"
136+
"^::shm_open$;"
137+
"^::shmget$;"
138+
"^::sigismember$;"
139+
"^::strcasecmp$;"
140+
"^::strsignal$;"
141+
"^::ttyname"))),
142142
CheckedReturnTypes(utils::options::parseStringList(
143143
Options.get("CheckedReturnTypes", "::std::error_code$;"
144144
"::std::error_condition$;"

0 commit comments

Comments
 (0)