bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ scoping of cross-reference?


From: Shigio YAMAGUCHI
Subject: Re: C++ scoping of cross-reference?
Date: Wed, 06 Apr 2011 11:26:26 +0900

> The -a option prints absolute pathnames for a file instead of relative
> pathnames. It's unimportant for this example, I just always include it
> when calling global.

Could you please review your example so as not to include what is not
important? If there are such things, it is difficult to understand your
intention. Thank you in advance.

> Yes, exactly. How would that work when the implementation doesn't
> explicitly list the parent class though:
> 
> [Class hierarchy]
> 
>       class A
>         |- class B
> 
> [Source files]
> 
>       [classA.cc]
>       +--------------------------------
>       |...
>       |class A { void dump() {...}}
> 
> 
>       [classB.h]
>       +--------------------------------
>       |...
>       |class B : A { void dump() };
> 
>       [classB.cc]
>       +--------------------------------
>       |...
>       |void B::dump() {...}
> 
> 
> [Execution image] - should give
> 
>       $ global -x A::dump
>       A::dump         classA.cc        50 class A { void dump() {...} }
>       B::dump         classB.h         20 class B : A { void dump() }
>       B::dump         classB.cc       100 void B::dump() {...}
> 
> Would it still be possible to get that third line of output? 

Yes. It can be completely considered to be the same as the previous example.

> [Class hierarchy]
> 
>       class A
>         |- class B
> 
> [Source files]
> 
>       [classA.cc]
>       +--------------------------------
>       |...
>       |class A {
>       |       virtual void dump() {...};
>       |       void method2() {...};
>       |};
> 
> 
> 
>       [classB.h]
>       +--------------------------------
>       |...
>       |class B : A { void dump() };
> 
...
> 
> [Execution image] - should give
...
>       $ global -xr B::method2
>       B::method2      other.cc         20     b_p->method2();
>       B::method2      other.cc         25     local_b.method2();
>       $_

I have a question. What is the result of the following example?

        $ global -x B::method2

> I assumed this would be harder, because when a symbol is referenced
> (e.g. the call to method2()), then you need to know the class that it is
> actually referring to. However, I haven't looked at the internal
> mechanism of building the gtags database, so maybe it isn't as hard as I
> thought?

I understood.
--
Shigio YAMAGUCHI <address@hidden>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3



reply via email to

[Prev in Thread] Current Thread [Next in Thread]