C++: getACanonicalMemberFunction does not return some unused members
- 主要语言
- 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.
贡献指南
调研方向
使用 libstdc++-12 和给定的查询运行所提供的 C++20 示例,然后检查 getACanonicalMemberFunction 如何枚举 vector 类型的成员。将结果与仅在使用时出现的声明进行比较;完成标准是确定是否也应返回未使用的成员,并记录或修正该行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- cpp
- 领域
- devtools
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100