-
Notifications
You must be signed in to change notification settings - Fork 109
Ast visitor function for using declarations. #487
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
Conversation
|
Someone please put the WIP label on this, I don't have the right to do that. |
e6efc89 to
a69a2db
Compare
5a45324 to
73e1297
Compare
|
What is the status of this PR, @filbeofITK ? Is still work-in-progress, or is ready for review? |
|
It is ready for review I just can't manage flags so I can't remove the WIP. |
mcserep
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good based on the code, some minor changes required. Also, please apply the coding convention of the existing codebase, e.g. Allman indentation style instead of K&R.
I will check the functionality meanwhile.
67e2195 to
4529cd0
Compare
|
The change of this PR does not seem to fix #305 for me. Have you tested it @filbeofITK ? I have tested it on TinyXML2, there are few using statements in |
|
Consider the following code: namespace MyNamespace
{
void f() {}
}
using namespace MyNamespace; // UsingDirectiveDecl
using MyNamespace::f; // UsingDecl
int main()
{
}Since |
…th namespaces as well.
mcserep
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is still some issue with this functionality. E.g. if I clicked on the using namespace N; on line 4, the other, unrelated namespace using statement was also selected in the code and displayed in the Info Tree for some reason.
Test code:
https://github.com/mcserep/cc-tests/blob/master/namespaces/main.cpp
bcca4c9 to
52327cd
Compare
|
I have fixed the The using MyNamespace::f;Any suggestion @whisperity, @bruntib, how we could get the referenced |
I have given it some thought and I think I found the solution. So given and namespace foo {
int foo() { return 1; }
}
using foo::foo;
int main() { return foo(); }the relevant parts of the AST look like this: Importantly, there are two nodes created for the
Note that the help of this class shows that, as From here, Given namespace foo {
int bar() { return 1; }
}
using namespace foo;
int main() { return bar(); }however, this becomes a from which
namespace foo {
int bar() { return 1; }
}
namespace foo {
int baz() { return 2; }
}
using namespace foo;
int main() { return baz(); }observe that the "target" of the directive points to the "first" occurrence of |
|
Superseded by #645, closing this one. |


Recursive ast visitor function for using declarations.