Class member function calls don't map to class

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

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp, scala
Domain
devtools

Research direction

Start by reproducing the reported C++ snippet and inspecting the generated CALL and METHOD nodes for lines 4 and 13. The issue names no source files or tests, so first locate the parser and graph-generation entry points; done would require an agreed way to represent or resolve the call from foo->bar() to MyClass::bar().

Written by the indexing model from the issue text.

Description

Parsing this code:

1  class MyClass
2  {
3  public:
4      int bar()
5      {
6          return 1;
7      }
8  };
9
10 void myfunc()
11 {
12     MyClass *foo = new MyClass();
13     foo->bar();
14 }

I expect the CALL node name on line 13 to be MyClass::bar(), but the name is foo->bar(). Further, an internal METHOD node is correctly created for MyClass::bar(), but there is also one created for an external function called foo->bar().

Is this expected/correct? If yes, is there a way to determine that CALL foo->bar() node is referring to type MyClass, or would one need to implement some type propagation atop the graph to arrive at that?

Thanks!

Dominant language
Scala
Stars
599
Forks
84
Avg merge
18h 29m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

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 ShiftLeftSecurity/codepropertygraph

All issues in ShiftLeftSecurity/codepropertygraph

Similar issues

More Scala issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.