github / github/codeql

C++: getACanonicalMemberFunction does not return some unused members

未關閉
#12,397 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
question
主要語言
CodeQL
星號
10.1k
分支
2.1k
平均合併
2 天 15 小時
30 天內合併 PR
141

描述

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.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。