Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c improvements #82

Merged
merged 8 commits into from
Jul 9, 2024
Merged

c improvements #82

merged 8 commits into from
Jul 9, 2024

Conversation

prabhu
Copy link
Contributor

@prabhu prabhu commented Jul 9, 2024

Brings numerous improvements to full names and signature from upstream.

prabhu added 5 commits July 8, 2024 21:37
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
f2.signature shouldBe "void A.f (char)"
foo.fullName shouldBe "foo"
bar.fullName shouldBe "bar"
f1.fullName shouldBe "A.f:void(int)"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An example of the improvements.

cpg.method.fullName("Cat.eat").caller.fullName.toSet shouldBe Set("main")
cpg.method.fullName("Animal.eat").caller.fullName.toSet shouldBe Set("People.feedPets", "main")
cpg.method.name("eat").fullName.toSet shouldBe Set("Animal.eat:void()", "Cat.eat:void()", "People.eat:void()")
cpg.method.name("main").callee.fullName.toSet shouldBe Set("Animal.eat:void()", "Cat.eat:void()", "<operator>.addressOf")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually a bug since Animal.eat is never called from main. But this is for another day.

@@ -124,32 +124,32 @@ class AstCreationPassTests extends AbstractPassTest {
inside(cpg.method.fullNameExact(lambda1FullName).l) { case List(l1) =>
l1.name shouldBe lambda1FullName
l1.code should startWith("[] (int a, int b) -> int")
l1.signature shouldBe "int anonymous_lambda_0 (int,int)"
l1.signature shouldBe "int (int,int)"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function and lambda names are removed from the signature.

prabhu added 3 commits July 9, 2024 09:21
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
@prabhu prabhu marked this pull request as ready for review July 9, 2024 08:40
@prabhu prabhu merged commit 6b15d25 into main Jul 9, 2024
8 checks passed
@prabhu prabhu deleted the feature/c-improvements branch July 9, 2024 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant