extract: namespaced C++ this->m and parameter p->m accesses file under different container types

Open
#198 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp, rust
Domain
backend, devtools

Research direction

Start by reading commit dbb20a0 and trace how semcode records C++ member accesses for this and parameter types, especially namespace resolution. The issue does not name source files or tests, so locate the relevant extractor code and existing C++ access tests first. Done means both accesses resolve to outer::Box and a regression test confirms querying outer::Box::m returns both.

Written by the indexing model from the issue text.

Description

Inside a C++ namespace, member data accesses through this and through a parameter of the same class are recorded under different container_type keys, so a single accesses query misses half the accesses.

Reproducer

namespace outer {
struct Box { int m; void touch(); };
void Box::touch() { this->m = 1; }
void g(Box *p) { p->m = 2; }
}
  • this->m in Box::touch is recorded with container_type = Some("outer::Box").
  • p->m in g is recorded with container_type = Some("Box") (the spelling written in the parameter list).

Cause

Documented in dbb20a0: this takes the enclosing owner's full namespace-qualified path, while parameter types are recorded as written without namespace qualification.

Expected behavior

Both this->m and p->m inside namespace outer should resolve to the same container (outer::Box) so querying outer::Box::m returns both accesses.

Dominant language
Rust
Stars
187
Forks
53
Avg merge
1d 9h
Merged PRs (30d)
79

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from facebookexperimental/semcode

All issues in facebookexperimental/semcode

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.