[clang-tools-extra] [clang-tidy] Add C++ member function support to custom bugprone-unsafe-functions matches (PR #117165)

via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 4 05:03:24 PST 2024


Discookie wrote:

``::open`` and ``::std::fstream::open`` are matched as two different things already.

```c++
#include <fcntl.h>
#include <fstream>

void f() {
  int fd = open("file.txt", O_RDONLY, 0);

  std::ifstream file;
  file.open("file.txt");
}
```
```
 -- matches ::open
{CheckOptions:{bugprone-unsafe-functions.ReportDefaultFunctions: false, bugprone-unsafe-functions.CustomFunctions: '^::open$,replacement,bla'}}
 -- matches .open
{CheckOptions:{bugprone-unsafe-functions.ReportDefaultFunctions: false, bugprone-unsafe-functions.CustomFunctions: 'std::basic_ifstream.*::open,replacement,bla'}}
```

I do realize that the matching of templates and child classes in general need a bit of a cleanup.

https://github.com/llvm/llvm-project/pull/117165


More information about the cfe-commits mailing list