codinuum / cca

Code Continuity Analysis Framework
https://codinuum.github.io/gallery-cca/
Apache License 2.0
20 stars 5 forks source link

cpp parser: declaration at the end of function bodies #21

Closed petr-bauch closed 2 years ago

petr-bauch commented 2 years ago

Hello and thanks again for your amazing project.

I've noticed a strange AST for the following code:

struct Foo {
  Foo(int b) {}
};
void bar() {
  Foo f(1);
}

The declaration of f is split into StatementMacro:Foo and function-call f(1). But if I add return statement after the declaration:

struct Foo {
  Foo(int b) {}
};
void bar() {
  Foo f(1);
  return;
}

The AST looks as expected.

codinuum commented 2 years ago

Thank you for reporting! We have just fixed the cpp parser.

petr-bauch commented 2 years ago

And thank you for fixing it so fast.