github / github/codeql

C++: getACanonicalMemberFunction does not return some unused members

Đang mở
#12,397 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
question
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

consider the simple input

```cpp
#include

int main() {
std::vector vec;
}
```

in C++20 mode with `` from libstdc++-12.

The query

```codeql
import cpp

from VariableDeclarationEntry declEntry
where declEntry.getName() = "vec"
select declEntry.getDeclaration().getType().(Class).getACanonicalMemberFunction()
```

Returns the following:

```
| col0 |
+----------------------+
| vector |
| ~vector |
| _M_data_ptr |
| _M_data_ptr |
| _M_emplace_aux |
| _M_realloc_insert |
| _M_insert_aux |
| _M_range_insert |
| _M_range_insert |
| _M_insert_dispatch |
| _M_insert_dispatch |
| _M_assign_aux |
| _M_assign_aux |
| _M_assign_dispatch |
| _M_assign_dispatch |
| _M_range_initialize |
| _M_range_initialize |
| _M_allocate_and_copy |
| insert |
| emplace |
| emplace_back |
| assign |
| vector |
```

There are many declarations missing, such as the various operators, iterators, etc. If I use any of the missing functions, they appear in the query.

Is there something I'm doing wrong? My goal is to match all declarations where a specific member function exists.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.