#14 support for C++'s "using" keyword

open
None
5
2014-08-13
2002-11-16
No

I'd like to have support for C++'s using keyword. Take
the following
example:

---------------------------------
#include <iostream>
using namespace std;

struct A
{
void f() {cout<<"A"<<endl;};
};

struct B
{
void f() {cout<<"B"<<endl;};
};

struct C: public A,public B
{
using B::f;
};

int main()
{
C c;
c.f();
};

--------------------------

I'd like ctags to be able to generate the following 2
lines (either of
them or both depending on command line flags):

1. a line for the symbol C::f, which is (except for the
symbol name)
identical to that for B::f

2. a line for the using directive like this:
C::f temp.cpp <pattern> kind:using line:16
language:C++ class:C access:public

I understand that C++ inheritance is too complicated
for ctags to
understand, so that generating appropriate tags for
inherited symbols is too difficult to implement.
However, inherited symbols explicitly mentioned in the
scope of the derived class with a using directive
should not be difficult to extract.

Discussion

  • Darren Hiebert
    Darren Hiebert
    2002-11-24

    • assigned_to: nobody --> dhiebert
    • summary: support for C++'s "using" keyword --> support for C++'s "using" keyword
     
  • Darren Hiebert
    Darren Hiebert
    2002-12-21

    Logged In: YES
    user_id=38016

    One problem that I see with trying to add this is that it is
    not possible for ctags to know what kind of tag B::f is.
    Ctags will not know whether it is a function or a member
    variable, etc., and could not properly mark its kind in the
    tag file.

    Suggestions?

     
  • Logged In: YES
    user_id=508249

    Hmm. Probably impossible without making ctags understand
    inheritance and work globally rather than 1 file at a time.
    But emitting a line for the using line with type:using (see
    2. in my initial suggestion) would still be useful as this
    would give programs postprocessing ctags output at least the
    information that the using line is there. Which symbol it
    refers to can then be determined by looking at the complete
    ctags information.