Ast visitor function for using declarations.#487
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.
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.
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.